altos: Add MPU9250 support to self test and data
[fw/altos] / src / kernel / ao_data.h
index 8f75ad876b612e3cc1480e1fc9aa9fc8024908bd..9a3b389c073dd6a291b6776faeb69829533b6ad5 100644 (file)
@@ -3,7 +3,8 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
 #define AO_DATA_MPU6000        0
 #endif
 
+#if HAS_MPU9250
+#include <ao_mpu9250.h>
+#define AO_DATA_MPU9250        (1 << 2)
+#else
+#define AO_DATA_MPU9250        0
+#endif
+
 #if HAS_HMC5883
 #include <ao_hmc5883.h>
 #define AO_DATA_HMC5883        (1 << 3)
@@ -56,7 +64,7 @@
 
 #ifdef AO_DATA_RING
 
-#define AO_DATA_ALL    (AO_DATA_ADC|AO_DATA_MS5607|AO_DATA_MPU6000|AO_DATA_HMC5883|AO_DATA_MMA655X)
+#define AO_DATA_ALL    (AO_DATA_ADC|AO_DATA_MS5607|AO_DATA_MPU6000|AO_DATA_HMC5883|AO_DATA_MMA655X|AO_DATA_MPU9250)
 
 struct ao_data {
        uint16_t                        tick;
@@ -73,6 +81,9 @@ struct ao_data {
        int16_t                         z_accel;
 #endif
 #endif
+#if HAS_MPU9250
+       struct ao_mpu9250_sample        mpu9250;
+#endif
 #if HAS_HMC5883
        struct ao_hmc5883_sample        hmc5883;
 #endif
@@ -269,6 +280,10 @@ typedef int16_t accel_t;
 
 #define AO_ACCEL_INVERT                4095
 
+#ifndef AO_MMA655X_INVERT
+#error AO_MMA655X_INVERT not defined
+#endif
+
 #define ao_data_accel(packet)                  ((packet)->mma655x)
 #if AO_MMA655X_INVERT
 #define ao_data_accel_cook(packet)             (AO_ACCEL_INVERT - (packet)->mma655x)