Adafruit ICM20X Sensor Library
Adafruit_ICM20948.h
Go to the documentation of this file.
1 
18 #ifndef _ADAFRUIT_ICM20948_H
19 #define _ADAFRUIT_ICM20948_H
20 
21 #include "Adafruit_ICM20X.h"
22 
23 #define ICM20948_I2CADDR_DEFAULT 0x69
24 #define ICM20948_MAG_ID 0x09
25 
26 #define ICM20948_UT_PER_LSB 0.15
27 
28 #define AK09916_WIA2 0x01
29 #define AK09916_ST1 0x10
30 #define AK09916_HXL 0x11
31 #define AK09916_HXH 0x12
32 #define AK09916_HYL 0x13
33 #define AK09916_HYH 0x14
34 #define AK09916_HZL 0x15
35 #define AK09916_HZH 0x16
36 #define AK09916_ST2 0x18
37 #define AK09916_CNTL2 0x31
38 #define AK09916_CNTL3 0x32
39 
40 
41 typedef enum {
42  ICM20948_ACCEL_RANGE_2_G,
43  ICM20948_ACCEL_RANGE_4_G,
44  ICM20948_ACCEL_RANGE_8_G,
45  ICM20948_ACCEL_RANGE_16_G,
47 
49 typedef enum {
50  ICM20948_GYRO_RANGE_250_DPS,
51  ICM20948_GYRO_RANGE_500_DPS,
52  ICM20948_GYRO_RANGE_1000_DPS,
53  ICM20948_GYRO_RANGE_2000_DPS,
55 
61 typedef enum {
64  0x1,
71 
77 public:
79  ~Adafruit_ICM20948(){};
80  bool begin_I2C(uint8_t i2c_addr = ICM20948_I2CADDR_DEFAULT,
81  TwoWire *wire = &Wire, int32_t sensor_id = 0);
82 
84  void setAccelRange(icm20948_accel_range_t new_accel_range);
85 
87  void setGyroRange(icm20948_gyro_range_t new_gyro_range);
88 
91 
92 private:
93  uint8_t readMagRegister(uint8_t reg_addr);
94  bool writeMagRegister(uint8_t reg_addr, uint8_t value);
95 
96  uint8_t getMagId(void);
97  bool auxI2CBusSetupFailed(void);
98 
99  bool setupMag(void);
100  void scaleValues(void);
101 };
102 
103 #endif
void setGyroRange(icm20948_gyro_range_t new_gyro_range)
Sets the gyro's measurement range.
Definition: Adafruit_ICM20948.cpp:208
updates at 20Hz
Definition: Adafruit_ICM20948.h:67
bool begin_I2C(uint8_t i2c_addr=ICM20948_I2CADDR_DEFAULT, TwoWire *wire=&Wire, int32_t sensor_id=0)
Sets up the hardware and initializes I2C.
Definition: Adafruit_ICM20948.cpp:26
Class that stores state and functions for interacting with the ST ICM20X 6-DoF Accelerometer and Gyro...
Definition: Adafruit_ICM20X.h:168
updates at 50Hz
Definition: Adafruit_ICM20948.h:68
ak09916_data_rate_t
Data rates/modes for the embedded AsahiKASEI AK09916 3-axis magnetometer.
Definition: Adafruit_ICM20948.h:61
icm20948_accel_range_t
Definition: Adafruit_ICM20948.h:41
void setAccelRange(icm20948_accel_range_t new_accel_range)
Sets the accelerometer's measurement range.
Definition: Adafruit_ICM20948.cpp:187
updates at 100Hz
Definition: Adafruit_ICM20948.h:69
Adafruit_ICM20948()
Instantiates a new ICM20948 class!
Definition: Adafruit_ICM20948.cpp:13
Definition: Adafruit_ICM20948.h:63
bool setMagDataRate(ak09916_data_rate_t rate)
Set the magnetometer measurement rate.
Definition: Adafruit_ICM20948.cpp:229
icm20948_gyro_range_t getGyroRange(void)
Get the gyro's measurement range.
Definition: Adafruit_ICM20948.cpp:196
updates at 10Hz
Definition: Adafruit_ICM20948.h:66
Stops measurement updates.
Definition: Adafruit_ICM20948.h:62
Class that stores state and functions for interacting with the ST ICM2948 9-DoF Accelerometer, gyro, and magnetometer.
Definition: Adafruit_ICM20948.h:76
icm20948_accel_range_t getAccelRange(void)
Get the accelerometer's measurement range.
Definition: Adafruit_ICM20948.cpp:175
icm20948_gyro_range_t
Definition: Adafruit_ICM20948.h:49
#define ICM20948_I2CADDR_DEFAULT
ICM20948 default i2c address.
Definition: Adafruit_ICM20948.h:23
ak09916_data_rate_t getMagDataRate(void)
Get the current magnetometer measurement rate.
Definition: Adafruit_ICM20948.cpp:217