imuboard: fix reading and sending of imu position
[fpv.git] / imuboard / imu.h
index 06755c9..d5455f4 100644 (file)
@@ -29,6 +29,9 @@
 #ifndef IMU_H_
 #define IMU_H_
 
+#include <math.h>
+#include <stdint.h>
+
 struct imu_info {
        /* gyro */
        double gx;
@@ -62,6 +65,13 @@ struct euler {
        double yaw;
 };
 
+/* angles in 1/100 degrees */
+struct imu_euler_int {
+       int16_t roll;
+       int16_t pitch;
+       int16_t yaw;
+};
+
 /* initialize the IMU */
 void imu_init(void);
 
@@ -72,12 +82,16 @@ int imu_log(uint8_t to_stdout);
  * the timer callback. Does not lock irq, so it's up to the user to do that. */
 void imu_get_info(struct imu_info *imu);
 
-/* return the latest position in a quaternion struct read in the timer
- * callback. Does not lock irq, so it's up to the user to do that. */
+/* return the latest position read in the timer callback in a quaternion
+ * struct. Does not lock irq, so it's up to the user to do that. */
 void imu_get_pos_quat(struct quaternion *pos);
 
-/* return the latest position in an euler struct read in the timer
- * callback. Does not lock irq, so it's up to the user to do that. */
+/* return the latest position read in the timer callback in an euler
+ * struct. Does not lock irq, so it's up to the user to do that. */
 void imu_get_pos_euler(struct euler *pos);
 
+/* return the latest position read in the timer callback in an imu_euler_int
+ * struct. Does not lock irq, so it's up to the user to do that. */
+void imu_get_pos_euler_int(struct imu_euler_int *pos);
+
 #endif