imu.h 530 B

1234567891011121314151617181920212223242526272829303132
  1. #ifndef IMU_H
  2. #define IMU_H
  3. #include <stdbool.h>
  4. #include <furi_hal.h>
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. struct imu_t {
  9. unsigned int address;
  10. bool (*begin)(void);
  11. void (*end)(void);
  12. int (*read)(double* vec);
  13. char* name;
  14. };
  15. #define ACC_DATA_READY (1 << 0)
  16. #define GYR_DATA_READY (1 << 1)
  17. static const double DEG_TO_RAD = 0.017453292519943295769236907684886;
  18. static const double GRAVITY = 9.81;
  19. bool imu_begin();
  20. void imu_end();
  21. int imu_read(double* vec);
  22. #ifdef __cplusplus
  23. }
  24. #endif
  25. #endif // IMU_H