| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- #ifndef __Arduino_ICM20948_H__
- #define __Arduino_ICM20948_H__
- #include "main.h"
- #include "HAL_impl.h"
- #include "HAL_STM32_config.h"
- #include "SensorTypes.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();
- void setOperatingMode(uint8_t mode);
- void enableSensor(inv_sensor_type sensor_type, bool enable);
- void setSensorFrequency(inv_sensor_type sensor_type, uint32_t frequency_hz);
- 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
|