| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- #ifndef __Arduino_ICM20948_H__
- #define __Arduino_ICM20948_H__
- #include "main.h"
- #include "HAL_impl.h"
- #include "HAL_STM32_config.h"
- /*************************************************************************
- Defines
- *************************************************************************/
- static const uint8_t EXPECTED_WHOAMI[] = { 0xEA }; /* WHOAMI value for ICM20948 or derivative */
- #define AK0991x_DEFAULT_I2C_ADDR 0x0C
- #define AK0991x_SECONDARY_I2C_ADDR 0x0E /* The secondary I2C address for AK0991x Magnetometers */
- #define ICM_I2C_ADDR_REVA 0x68 /* I2C slave address for INV device on Rev A board */
- #define ICM_I2C_ADDR_REVB 0x69 /* I2C slave address for INV device on Rev B board */
- #define AD0_VAL 1 // The value of the last bit of the I2C address.
- #define THREE_AXES 3
- #ifdef __cplusplus
- typedef struct {
- int mode;
- uint8_t enable_gyroscope;
- uint8_t enable_accelerometer;
- uint8_t enable_magnetometer;
- uint8_t enable_gravity;
- uint8_t enable_linearAcceleration;
- uint8_t enable_quaternion6;
- uint8_t enable_quaternion9;
- uint8_t enable_har;
- uint8_t enable_steps;
- int gyroscope_frequency;
- int accelerometer_frequency;
- int magnetometer_frequency;
- int gravity_frequency;
- int linearAcceleration_frequency;
- int quaternion6_frequency;
- int quaternion9_frequency;
- int har_frequency;
- int steps_frequency;
- } DMP_ICM20948Settings;
- /*************************************************************************
- Class
- *************************************************************************/
- class DMP_ICM20948
- {
- public:
- DMP_ICM20948();
- //void init(TwoWire *theWire = &Wire, JTICM20948Settings settings);
- void init(DMP_ICM20948Settings settings);
- void task();
- bool gyroDataIsReady();
- bool accelDataIsReady();
- bool magDataIsReady();
- bool gravDataIsReady();
- bool linearAccelDataIsReady();
- bool quat6DataIsReady();
- bool euler6DataIsReady();
- bool quat9DataIsReady();
- bool euler9DataIsReady();
- bool harDataIsReady();
- bool stepsDataIsReady();
- void readGyroData(float *x, float *y, float *z);
- void readAccelData(float *x, float *y, float *z);
- void readMagData(float *x, float *y, float *z);
- void readGravData(float* x, float* y, float* z);
- void readLinearAccelData(float* x, float* y, float* z);
- void readQuat6Data(float *w, float *x, float *y, float *z);
- void readEuler6Data(float *roll, float *pitch, float *yaw);
- void readQuat9Data(float* w, float* x, float* y, float* z);
- void readEuler9Data(float* roll, float* pitch, float* yaw);
- void readHarData(char* activity);
- void readStepsData(unsigned long* steps_count);
- };
- #endif
- #endif
|