kopia lustrzana https://github.com/cyoung/stratux
Pass i2cbus parameter for NewMPU9250().
rodzic
377d22b403
commit
93de565e4b
2
goflying
2
goflying
|
@ -1 +1 @@
|
||||||
Subproject commit 0ba3e51be74b4848488e06ec0fee74ebaa7ef705
|
Subproject commit d0268b1b182f79d34af4f3a7524ae0b4c18c41e0
|
|
@ -123,7 +123,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
|
||||||
|
|
|
@ -3,6 +3,7 @@ package sensors
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"../goflying/mpu9250"
|
"../goflying/mpu9250"
|
||||||
|
"github.com/kidoman/embd"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -19,14 +20,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