14 lines
297 B
Go
14 lines
297 B
Go
|
package mpu6050
|
||
|
|
||
|
import (
|
||
|
"encoding/binary"
|
||
|
)
|
||
|
|
||
|
func (d device) readWord(register byte) (int16, error) {
|
||
|
bytes := make([]byte, 2)
|
||
|
if err := d.device.ReadReg(register, bytes); err != nil {
|
||
|
return 0, err
|
||
|
}
|
||
|
return int16(binary.BigEndian.Uint16(bytes)), nil // !!! CHECK uint->int convertsion
|
||
|
}
|