Commit c3286ffc authored by Daniel Friesel's avatar Daniel Friesel
Browse files

mpu9250: Add nineAxis function

parent 16a0da98
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -291,6 +291,7 @@ class MPU9250 {
		void accelOnly();
		void gyroOnly();
		void magnetOnly();
		void nineAxis();
};

extern MPU9250 mpu9250;
+3 −0
Original line number Diff line number Diff line
@@ -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
+13 −0
Original line number Diff line number Diff line
@@ -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()