som
cyoung 2019-08-13 14:11:16 -04:00
rodzic 2a6e22aa1d
commit 66ca49a642
2 zmienionych plików z 4 dodań i 4 usunięć

Wyświetl plik

@ -33,7 +33,7 @@ var (
)
func initI2CSensors() {
i2cbus = embd.NewI2CBus(1)
i2cbus = embd.NewI2CBus(0)
go pollSensors()
go sensorAttitudeSender()
@ -124,7 +124,7 @@ func tempAndPressureSender() {
}
func initIMU() (ok bool) {
imu, err := sensors.NewMPU9250()
imu, err := sensors.NewMPU9250(&i2cbus)
if err == nil {
myIMUReader = imu
return true

Wyświetl plik

@ -19,14 +19,14 @@ type MPU9250 struct {
// NewMPU9250 returns an instance of the MPU9250 IMUReader, connected to an
// MPU9250 attached on the I2C bus with either valid address.
func NewMPU9250() (*MPU9250, error) {
func NewMPU9250(i2cbus *embd.I2CBus) (*MPU9250, error) {
var (
m MPU9250
mpu *mpu9250.MPU9250
err error
)
mpu, err = mpu9250.NewMPU9250(gyroRange, accelRange, updateFreq, true, false)
mpu, err = mpu9250.NewMPU9250(i2cbus, gyroRange, accelRange, updateFreq, true, false)
if err != nil {
return nil, err
}