summaryrefslogtreecommitdiff
path: root/src/kernel/ao_data.h
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2018-10-20 17:26:53 -0700
committerKeith Packard <keithp@keithp.com>2018-10-20 17:31:57 -0700
commit345e3c37a1cf619392b54589bb91b4caf7844810 (patch)
treef5c77ce7be1f9dd3847ea3911db8e05e8e20a001 /src/kernel/ao_data.h
parent8c92656576aff3ceab5bead3c835d96c36098fe7 (diff)
altos/easymega-v2.0: Handle different mpu9250 orientation
The mpu9250 on EasyMega v2.0 is rotated 90° compared with EasyMega v1 and TeleMega IMU devices. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/kernel/ao_data.h')
-rw-r--r--src/kernel/ao_data.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/kernel/ao_data.h b/src/kernel/ao_data.h
index 3918f4e0..dda5de4c 100644
--- a/src/kernel/ao_data.h
+++ b/src/kernel/ao_data.h
@@ -382,6 +382,7 @@ typedef int16_t angle_t; /* in degrees */
/* X axis is aligned in the other board axis (across) */
/* Z axis is aligned perpendicular to the board (through) */
+#ifndef ao_data_along
#define ao_data_along(packet) ((packet)->mpu9250.accel_y)
#define ao_data_across(packet) ((packet)->mpu9250.accel_x)
#define ao_data_through(packet) ((packet)->mpu9250.accel_z)
@@ -389,6 +390,7 @@ typedef int16_t angle_t; /* in degrees */
#define ao_data_roll(packet) ((packet)->mpu9250.gyro_y)
#define ao_data_pitch(packet) ((packet)->mpu9250.gyro_x)
#define ao_data_yaw(packet) ((packet)->mpu9250.gyro_z)
+#endif
static inline float ao_convert_gyro(float sensor)
{
@@ -425,9 +427,11 @@ typedef int16_t ao_mag_t; /* in raw sample units */
* sensors. Also, the Z axis is flipped in sign.
*/
+#ifndef ao_data_mag_along
#define ao_data_mag_along(packet) ((packet)->mpu9250.mag_x)
#define ao_data_mag_across(packet) ((packet)->mpu9250.mag_y)
#define ao_data_mag_through(packet) ((packet)->mpu9250.mag_z)
+#endif
#endif