kopia lustrzana https://github.com/cyoung/stratux
Use i2c bus 0.
rodzic
2a6e22aa1d
commit
66ca49a642
|
@ -33,7 +33,7 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
func initI2CSensors() {
|
func initI2CSensors() {
|
||||||
i2cbus = embd.NewI2CBus(1)
|
i2cbus = embd.NewI2CBus(0)
|
||||||
|
|
||||||
go pollSensors()
|
go pollSensors()
|
||||||
go sensorAttitudeSender()
|
go sensorAttitudeSender()
|
||||||
|
@ -124,7 +124,7 @@ func tempAndPressureSender() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func initIMU() (ok bool) {
|
func initIMU() (ok bool) {
|
||||||
imu, err := sensors.NewMPU9250()
|
imu, err := sensors.NewMPU9250(&i2cbus)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
myIMUReader = imu
|
myIMUReader = imu
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -19,14 +19,14 @@ type MPU9250 struct {
|
||||||
|
|
||||||
// NewMPU9250 returns an instance of the MPU9250 IMUReader, connected to an
|
// NewMPU9250 returns an instance of the MPU9250 IMUReader, connected to an
|
||||||
// MPU9250 attached on the I2C bus with either valid address.
|
// MPU9250 attached on the I2C bus with either valid address.
|
||||||
func NewMPU9250() (*MPU9250, error) {
|
func NewMPU9250(i2cbus *embd.I2CBus) (*MPU9250, error) {
|
||||||
var (
|
var (
|
||||||
m MPU9250
|
m MPU9250
|
||||||
mpu *mpu9250.MPU9250
|
mpu *mpu9250.MPU9250
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
mpu, err = mpu9250.NewMPU9250(gyroRange, accelRange, updateFreq, true, false)
|
mpu, err = mpu9250.NewMPU9250(i2cbus, gyroRange, accelRange, updateFreq, true, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue