summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/driver/mpu9250.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/driver/mpu9250.cc b/src/driver/mpu9250.cc
index de47597..3ad91c7 100644
--- a/src/driver/mpu9250.cc
+++ b/src/driver/mpu9250.cc
@@ -222,6 +222,21 @@ bool MPU9250::getRawMagnet(int *x, int *y, int *z)
}
}
+bool MPU9250::getMagnet(float *ut_x, float *ut_y, float *ut_z)
+{
+ int x, y, z;
+ bool success = getRawMagnet(&x, &y, &z);
+
+ if (!success) {
+ return false;
+ }
+
+ *ut_x = x * 0.15;
+ *ut_y = y * 0.15;
+ *ut_z = z * 0.15;
+ return true;
+}
+
// mpu9250.dfa
void MPU9250::nineAxis()