summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/driver/mpu9250.h1
-rw-r--r--model/driver/mpu9250.dfa3
-rw-r--r--src/driver/mpu9250.cc13
3 files changed, 17 insertions, 0 deletions
diff --git a/include/driver/mpu9250.h b/include/driver/mpu9250.h
index 914a9e0..70c7f46 100644
--- a/include/driver/mpu9250.h
+++ b/include/driver/mpu9250.h
@@ -291,6 +291,7 @@ class MPU9250 {
void accelOnly();
void gyroOnly();
void magnetOnly();
+ void nineAxis();
};
extern MPU9250 mpu9250;
diff --git a/model/driver/mpu9250.dfa b/model/driver/mpu9250.dfa
index f0f161a..1e4bafc 100644
--- a/model/driver/mpu9250.dfa
+++ b/model/driver/mpu9250.dfa
@@ -46,3 +46,6 @@ transition:
magnetOnly:
src: [SLEEP, STANDBY, LP_ACCEL, ACCEL, GYRO, NINEAXIS]
dst: MAGNET
+ nineAxis:
+ src: [SLEEP, STANDBY, LP_ACCEL, ACCEL, GYRO, MAGNET]
+ dst: NINEAXIS
diff --git a/src/driver/mpu9250.cc b/src/driver/mpu9250.cc
index e8f407e..58796c5 100644
--- a/src/driver/mpu9250.cc
+++ b/src/driver/mpu9250.cc
@@ -218,6 +218,15 @@ void MPU9250::getRawMagnet(int *x, int *y, int *z)
// mpu9250.dfa
+void MPU9250::nineAxis()
+{
+ gyroStandby = false;
+ AGWakeup();
+ MagWakeup();
+ setAccelEnable(true, true, true);
+ setGyroEnable(true, true, true);
+}
+
void MPU9250::sleep()
{
AGSleep();
@@ -229,6 +238,7 @@ void MPU9250::standby()
setGyroStandby(true);
MagSleep();
setAccelEnable(false, false, false);
+ // TODO setGyroEnable false/true?
}
void MPU9250::lowPowerAccelOnly(unsigned char rate)
@@ -241,6 +251,7 @@ void MPU9250::lowPowerAccelOnly(unsigned char rate)
txbuf[1] = 1<<5;
i2c.xmit(address, 2, txbuf, 0, rxbuf);
setGyroEnable(false, false, false);
+ // TODO setAccelEnable true?
}
void MPU9250::accelOnly()
@@ -249,6 +260,7 @@ void MPU9250::accelOnly()
AGWakeup();
MagSleep();
setGyroEnable(false, false, false);
+ // TODO setAccelEnable true?
}
void MPU9250::gyroOnly()
@@ -257,6 +269,7 @@ void MPU9250::gyroOnly()
AGWakeup();
MagSleep();
setAccelEnable(false, false, false);
+ // TODO setGyroEnable true?
}
void MPU9250::magnetOnly()