summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/driver/mpu9250.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/driver/mpu9250.cc b/src/driver/mpu9250.cc
index 32f78c7..9b34ef4 100644
--- a/src/driver/mpu9250.cc
+++ b/src/driver/mpu9250.cc
@@ -201,7 +201,7 @@ void MPU9250::getGyro(float *dps_x, float *dps_y, float *dps_z)
*dps_z = z * fsr_factor;
}
-void MPU9250::getRawMagnet(int *x, int *y, int *z)
+bool MPU9250::getRawMagnet(int *x, int *y, int *z)
{
txbuf[0] = 0x02;
i2c.xmit(0x0c, 1, txbuf, 8, rxbuf);
@@ -210,9 +210,10 @@ void MPU9250::getRawMagnet(int *x, int *y, int *z)
*x = ((signed int)rxbuf[2] << 8) + rxbuf[1];
*y = ((signed int)rxbuf[4] << 8) + rxbuf[3];
*z = ((signed int)rxbuf[6] << 8) + rxbuf[5];
+ return true;
}
else {
- *x = *y = *z = 0;
+ return false;
}
}