mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-17 13:23:26 +00:00
mma8653: rename ReadOrientation to ReadAcceleration
This commit is contained in:
+3
-2
@@ -36,8 +36,9 @@ func (d Device) Configure(speed DataRate) {
|
|||||||
d.bus.WriteRegister(Address, CTRL_REG1, []uint8{data})
|
d.bus.WriteRegister(Address, CTRL_REG1, []uint8{data})
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadOrientation reads the current orientation from the device and returns it.
|
// ReadAcceleration reads the current acceleration from the device and returns
|
||||||
func (d Device) ReadOrientation() (x int16, y int16, z int16) {
|
// it.
|
||||||
|
func (d Device) ReadAcceleration() (x int16, y int16, z int16) {
|
||||||
data := make([]byte, 6)
|
data := make([]byte, 6)
|
||||||
d.bus.ReadRegister(Address, OUT_X_MSB, data)
|
d.bus.ReadRegister(Address, OUT_X_MSB, data)
|
||||||
x = int16((uint16(data[0]) << 8) | uint16(data[1]))
|
x = int16((uint16(data[0]) << 8) | uint16(data[1]))
|
||||||
|
|||||||
Reference in New Issue
Block a user