DMP_ICM20948.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #ifndef __Arduino_ICM20948_H__
  2. #define __Arduino_ICM20948_H__
  3. //#include <stdint.h>
  4. #include "main.h"
  5. //#include "stm32l4xx_hal.h"
  6. #include "HAL_STM32_config.h"
  7. /*************************************************************************
  8. Defines
  9. *************************************************************************/
  10. #ifdef __cplusplus
  11. typedef struct {
  12. int mode;
  13. uint8_t enable_gyroscope;
  14. uint8_t enable_accelerometer;
  15. uint8_t enable_magnetometer;
  16. uint8_t enable_gravity;
  17. uint8_t enable_linearAcceleration;
  18. uint8_t enable_quaternion6;
  19. uint8_t enable_quaternion9;
  20. uint8_t enable_har;
  21. uint8_t enable_steps;
  22. int gyroscope_frequency;
  23. int accelerometer_frequency;
  24. int magnetometer_frequency;
  25. int gravity_frequency;
  26. int linearAcceleration_frequency;
  27. int quaternion6_frequency;
  28. int quaternion9_frequency;
  29. int har_frequency;
  30. int steps_frequency;
  31. } DMP_ICM20948Settings;
  32. /*************************************************************************
  33. Class
  34. *************************************************************************/
  35. class DMP_ICM20948
  36. {
  37. public:
  38. DMP_ICM20948();
  39. //void init(TwoWire *theWire = &Wire, JTICM20948Settings settings);
  40. void init(DMP_ICM20948Settings settings);
  41. void task();
  42. bool gyroDataIsReady();
  43. bool accelDataIsReady();
  44. bool magDataIsReady();
  45. bool gravDataIsReady();
  46. bool linearAccelDataIsReady();
  47. bool quat6DataIsReady();
  48. bool euler6DataIsReady();
  49. bool quat9DataIsReady();
  50. bool euler9DataIsReady();
  51. bool harDataIsReady();
  52. bool stepsDataIsReady();
  53. void readGyroData(float *x, float *y, float *z);
  54. void readAccelData(float *x, float *y, float *z);
  55. void readMagData(float *x, float *y, float *z);
  56. void readGravData(float* x, float* y, float* z);
  57. void readLinearAccelData(float* x, float* y, float* z);
  58. void readQuat6Data(float *w, float *x, float *y, float *z);
  59. void readEuler6Data(float *roll, float *pitch, float *yaw);
  60. void readQuat9Data(float* w, float* x, float* y, float* z);
  61. void readEuler9Data(float* roll, float* pitch, float* yaw);
  62. void readHarData(char* activity);
  63. void readStepsData(unsigned long* steps_count);
  64. };
  65. #endif
  66. #endif