imu.h 530 B

123456789101112131415161718192021222324252627282930313233
  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. {
  10. unsigned int address;
  11. bool (*begin)(void);
  12. void (*end)(void);
  13. int (*read)(double* vec);
  14. char* name;
  15. };
  16. #define ACC_DATA_READY (1 << 0)
  17. #define GYR_DATA_READY (1 << 1)
  18. static const double DEG_TO_RAD = 0.017453292519943295769236907684886;
  19. static const double GRAVITY = 9.81;
  20. bool imu_begin();
  21. void imu_end();
  22. int imu_read(double* vec);
  23. #ifdef __cplusplus
  24. }
  25. #endif
  26. #endif // IMU_H