DMP_ICM20948.h 2.2 KB

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