summaryrefslogtreecommitdiff
path: root/src/driver/mpu9250.cc
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2019-11-28 15:45:56 +0100
committerDaniel Friesel <daniel.friesel@uos.de>2019-11-28 15:45:56 +0100
commit9587125842f839acd79956f4827231e2df66ffc2 (patch)
tree6bad01d68a25358ccc04f60bc22f6b8315284253 /src/driver/mpu9250.cc
parente5436cc50e489487a150c5a6c8bff085ba4c63c7 (diff)
MPU9250: Add AEMR DFA driver functions and model
Diffstat (limited to 'src/driver/mpu9250.cc')
-rw-r--r--src/driver/mpu9250.cc50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/driver/mpu9250.cc b/src/driver/mpu9250.cc
index 1c6e02c..e8f407e 100644
--- a/src/driver/mpu9250.cc
+++ b/src/driver/mpu9250.cc
@@ -216,4 +216,54 @@ void MPU9250::getRawMagnet(int *x, int *y, int *z)
}
}
+// mpu9250.dfa
+
+void MPU9250::sleep()
+{
+ AGSleep();
+ MagSleep();
+}
+
+void MPU9250::standby()
+{
+ setGyroStandby(true);
+ MagSleep();
+ setAccelEnable(false, false, false);
+}
+
+void MPU9250::lowPowerAccelOnly(unsigned char rate)
+{
+ txbuf[0] = MPU9250_LP_ACCEL_ODR;
+ txbuf[1] = rate & 0x0f;
+ i2c.xmit(address, 2, txbuf, 0, rxbuf);
+ MagSleep();
+ txbuf[0] = 107;
+ txbuf[1] = 1<<5;
+ i2c.xmit(address, 2, txbuf, 0, rxbuf);
+ setGyroEnable(false, false, false);
+}
+
+void MPU9250::accelOnly()
+{
+ gyroStandby = false;
+ AGWakeup();
+ MagSleep();
+ setGyroEnable(false, false, false);
+}
+
+void MPU9250::gyroOnly()
+{
+ gyroStandby = false;
+ AGWakeup();
+ MagSleep();
+ setAccelEnable(false, false, false);
+}
+
+void MPU9250::magnetOnly()
+{
+ gyroStandby = false;
+ MagWakeup();
+ AGSleep();
+}
+
MPU9250 mpu9250;