ICM20648 - 6-axis Motion Sensor Driver
Detailed Description
Driver for the Invensense ICM20648 6-axis motion sensor.
Functions |
|
uint32_t | ICM20648_accelBandwidthSet (uint8_t accelBw) |
Sets the bandwidth of the accelerometer.
|
|
uint32_t | ICM20648_accelDataRead (float *accel) |
Reads the raw acceleration value and converts to g value based on the actual resolution.
|
|
uint32_t | ICM20648_accelFullscaleSet (uint8_t accelFs) |
Sets the full scale value of the accelerometer.
|
|
uint32_t | ICM20648_accelGyroCalibrate (float *accelBiasScaled, float *gyroBiasScaled) |
Accelerometer and gyroscope calibration function. Reads the gyroscope and accelerometer values while the device is at rest and in level. The resulting values are loaded to the accel and gyro bias registers to cancel the static offset error.
|
|
uint32_t | ICM20648_accelResolutionGet (float *accelRes) |
Gets the actual resolution of the accelerometer.
|
|
float | ICM20648_accelSampleRateSet (float sampleRate) |
Sets the sample rate of the gyroscope.
|
|
void | ICM20648_bankSelect (uint8_t bank) |
Select the desired register bank.
|
|
uint32_t | ICM20648_cycleModeEnable (bool enable) |
Enables or disables the cycle mode operation of the accel and gyro.
|
|
uint32_t | ICM20648_deInit (void) |
De-initializes the ICM20648 sensor by disconnecting the supply and SPI lines.
|
|
uint32_t | ICM20648_getDeviceID (uint8_t *devID) |
Reads the device ID of the ICM20648.
|
|
uint32_t | ICM20648_gyroBandwidthSet (uint8_t gyroBw) |
Sets the bandwidth of the gyroscope.
|
|
uint32_t | ICM20648_gyroCalibrate (float *gyroBiasScaled) |
Gyroscope calibration function. Reads the gyroscope values while the device is at rest and in level. The resulting values are loaded to the gyro bias registers to cancel the static offset error.
|
|
uint32_t | ICM20648_gyroDataRead (float *gyro) |
Reads the raw gyroscope value and converts to deg/sec value based on the actual resolution.
|
|
uint32_t | ICM20648_gyroFullscaleSet (uint8_t gyroFs) |
Sets the full scale value of the gyroscope.
|
|
uint32_t | ICM20648_gyroResolutionGet (float *gyroRes) |
Gets the actual resolution of the gyroscope.
|
|
float | ICM20648_gyroSampleRateSet (float sampleRate) |
Sets the sample rate of the accelerometer.
|
|
uint32_t | ICM20648_init (void) |
Initializes the ICM20648 sensor. Enables the power supply and SPI lines, sets up the host SPI controller, configures the chip control interface, clock generator and interrupt line.
|
|
uint32_t | ICM20648_interruptEnable (bool dataReadyEnable, bool womEnable) |
Enables or disables the interrupts in the ICM20648 chip.
|
|
uint32_t | ICM20648_interruptStatusRead (uint32_t *intStatus) |
Reads the interrupt status registers of the ICM20648 chip.
|
|
bool | ICM20648_isDataReady (void) |
Checks if new data is available for read.
|
|
uint32_t | ICM20648_lowPowerModeEnter (bool enAccel, bool enGyro, bool enTemp) |
Enables or disables the sensors in low power mode in the ICM20648 chip.
|
|
void | ICM20648_registerRead (uint16_t addr, int numBytes, uint8_t *data) |
Reads register from the ICM20648 device.
|
|
void | ICM20648_registerWrite (uint16_t addr, uint8_t data) |
Writes a register in the ICM20648 device.
|
|
uint32_t | ICM20648_reset (void) |
Performs soft reset on the ICM20648 chip.
|
|
uint32_t | ICM20648_sampleRateSet (float sampleRate) |
Sets the sample rate both of the accelerometer and the gyroscope.
|
|
uint32_t | ICM20648_sensorEnable (bool accel, bool gyro, bool temp) |
Enables or disables the sensors in the ICM20648 chip.
|
|
uint32_t | ICM20648_sleepModeEnable (bool enable) |
Enables or disables the sleep mode of the device.
|
|
uint32_t | ICM20648_spiInit (void) |
Initializes the SPI bus in order to communicate with the ICM20648.
|
|
uint32_t | ICM20648_temperatureRead (float *temperature) |
Reads the temperature sensor raw value and converts to Celsius.
|
|
uint32_t | ICM20648_wakeOnMotionITEnable (bool enable, uint8_t womThreshold, float sampleRate) |
Sets up and enables the Wake-up On Motion feature.
|
|
Error Codes |
|
#define | ICM20648_OK 0x0000 |
#define | ICM20648_ERROR_INVALID_DEVICE_ID 0x0001 |
ICM20648 register banks |
|
#define | ICM20648_BANK_0 (0 << 7) |
#define | ICM20648_BANK_1 (1 << 7) |
#define | ICM20648_BANK_2 (2 << 7) |
#define | ICM20648_BANK_3 (3 << 7) |
Macro Definition Documentation
#define ICM20648_ACCEL_BW_111HZÂ Â Â ( (0x02 << ICM20648_SHIFT_ACCEL_DLPCFG) | ICM20648_BIT_ACCEL_FCHOICE) |
Accel Bandwidth = 111 Hz
Definition at line
233
of file
icm20648.h
.
#define ICM20648_ACCEL_BW_1210HZÂ Â Â (0x00 << ICM20648_SHIFT_ACCEL_DLPCFG) |
Accel Bandwidth = 1210 Hz
Definition at line
230
of file
icm20648.h
.
Referenced by ICM20648_wakeOnMotionITEnable() , and IMU_config() .
#define ICM20648_ACCEL_BW_12HZÂ Â Â ( (0x05 << ICM20648_SHIFT_ACCEL_DLPCFG) | ICM20648_BIT_ACCEL_FCHOICE) |
Accel Bandwidth = 12 Hz
Definition at line
236
of file
icm20648.h
.
#define ICM20648_ACCEL_BW_246HZÂ Â Â ( (0x00 << ICM20648_SHIFT_ACCEL_DLPCFG) | ICM20648_BIT_ACCEL_FCHOICE) |
Accel Bandwidth = 246 Hz
Definition at line
232
of file
icm20648.h
.
Referenced by ICM20648_accelGyroCalibrate() .
#define ICM20648_ACCEL_BW_24HZÂ Â Â ( (0x04 << ICM20648_SHIFT_ACCEL_DLPCFG) | ICM20648_BIT_ACCEL_FCHOICE) |
Accel Bandwidth = 24 Hz
Definition at line
235
of file
icm20648.h
.
#define ICM20648_ACCEL_BW_470HZÂ Â Â ( (0x07 << ICM20648_SHIFT_ACCEL_DLPCFG) | ICM20648_BIT_ACCEL_FCHOICE) |
Accel Bandwidth = 470 Hz
Definition at line
231
of file
icm20648.h
.
#define ICM20648_ACCEL_BW_50HZÂ Â Â ( (0x03 << ICM20648_SHIFT_ACCEL_DLPCFG) | ICM20648_BIT_ACCEL_FCHOICE) |
Accel Bandwidth = 50 Hz
Definition at line
234
of file
icm20648.h
.
#define ICM20648_ACCEL_BW_6HZÂ Â Â ( (0x06 << ICM20648_SHIFT_ACCEL_DLPCFG) | ICM20648_BIT_ACCEL_FCHOICE) |
Accel Bandwidth = 6 Hz
Definition at line
237
of file
icm20648.h
.
#define ICM20648_ACCEL_FULLSCALE_16GÂ Â Â (0x03 << ICM20648_SHIFT_ACCEL_FS) |
Accel Full Scale = 16 g
Definition at line
229
of file
icm20648.h
.
Referenced by ICM20648_accelResolutionGet() .
#define ICM20648_ACCEL_FULLSCALE_2GÂ Â Â (0x00 << ICM20648_SHIFT_ACCEL_FS) |
Accel Full Scale = 2 g
Definition at line
226
of file
icm20648.h
.
Referenced by ICM20648_accelGyroCalibrate() , ICM20648_accelResolutionGet() , ICM20648_wakeOnMotionITEnable() , and IMU_config() .
#define ICM20648_ACCEL_FULLSCALE_4GÂ Â Â (0x01 << ICM20648_SHIFT_ACCEL_FS) |
Accel Full Scale = 4 g
Definition at line
227
of file
icm20648.h
.
Referenced by ICM20648_accelResolutionGet() .
#define ICM20648_ACCEL_FULLSCALE_8GÂ Â Â (0x02 << ICM20648_SHIFT_ACCEL_FS) |
Accel Full Scale = 8 g
Definition at line
228
of file
icm20648.h
.
Referenced by ICM20648_accelResolutionGet() .
#define ICM20648_BANK_0Â Â Â (0 << 7) |
Register bank 0
Definition at line
59
of file
icm20648.h
.
#define ICM20648_BANK_1Â Â Â (1 << 7) |
Register bank 1
Definition at line
60
of file
icm20648.h
.
#define ICM20648_BANK_2Â Â Â (2 << 7) |
Register bank 2
Definition at line
61
of file
icm20648.h
.
#define ICM20648_BANK_3Â Â Â (3 << 7) |
Register bank 3
Definition at line
62
of file
icm20648.h
.
#define ICM20648_BIT_ACCEL_CTENÂ Â Â 0x1C |
Accelerometer Self-Test Enable bits
Definition at line
240
of file
icm20648.h
.
#define ICM20648_BIT_ACCEL_CYCLEÂ Â Â 0x20 |
Accelerometer cycle mode enable
Definition at line
84
of file
icm20648.h
.
Referenced by ICM20648_cycleModeEnable() .
#define ICM20648_BIT_ACCEL_FCHOICEÂ Â Â 0x01 |
Accel Digital Low-Pass Filter enable bit
Definition at line
221
of file
icm20648.h
.
#define ICM20648_BIT_ACCEL_FIFO_ENÂ Â Â 0x10 |
Enable writing acceleration data to FIFO bit
Definition at line
145
of file
icm20648.h
.
Referenced by ICM20648_accelGyroCalibrate() .
#define ICM20648_BIT_ACCEL_INTEL_ENÂ Â Â 0x02 |
Wake-up On Motion enable bit
Definition at line
215
of file
icm20648.h
.
Referenced by ICM20648_wakeOnMotionITEnable() .
#define ICM20648_BIT_ACCEL_INTEL_MODEÂ Â Â 0x01 |
WOM algorithm selection bit
Definition at line
216
of file
icm20648.h
.
Referenced by ICM20648_wakeOnMotionITEnable() .
#define ICM20648_BIT_CLK_PLLÂ Â Â 0x01 |
Auto clock source selection setting
Definition at line
92
of file
icm20648.h
.
Referenced by ICM20648_init() .
#define ICM20648_BIT_DIAMOND_DMP_RSTÂ Â Â 0x04 |
SRAM module reset bit
Definition at line
80
of file
icm20648.h
.
#define ICM20648_BIT_DMP_ENÂ Â Â 0x80 |
DMP enable bit
Definition at line
75
of file
icm20648.h
.
#define ICM20648_BIT_DMP_RSTÂ Â Â 0x08 |
DMP module reset bit
Definition at line
79
of file
icm20648.h
.
#define ICM20648_BIT_FIFO_ENÂ Â Â 0x40 |
FIFO enable bit
Definition at line
76
of file
icm20648.h
.
Referenced by ICM20648_accelGyroCalibrate() , and ICM20648_gyroCalibrate() .
#define ICM20648_BIT_FIFO_OVERFLOW_EN_0Â Â Â 0x01 |
FIFO overflow interrupt enable bit
Definition at line
111
of file
icm20648.h
.
#define ICM20648_BIT_GYRO_CTENÂ Â Â 0x38 |
Gyroscope Self-Test Enable bits
Definition at line
200
of file
icm20648.h
.
#define ICM20648_BIT_GYRO_CYCLEÂ Â Â 0x10 |
Gyroscope cycle mode enable
Definition at line
85
of file
icm20648.h
.
Referenced by ICM20648_cycleModeEnable() .
#define ICM20648_BIT_GYRO_FCHOICEÂ Â Â 0x01 |
Gyro Digital Low-Pass Filter enable bit
Definition at line
180
of file
icm20648.h
.
#define ICM20648_BIT_H_RESETÂ Â Â 0x80 |
#define ICM20648_BIT_I2C_BYTE_SWÂ Â Â 0x40 |
I2C Slave Byte Swap enable bit
Definition at line
283
of file
icm20648.h
.
#define ICM20648_BIT_I2C_GRPÂ Â Â 0x10 |
I2C Slave Group bit
Definition at line
285
of file
icm20648.h
.
#define ICM20648_BIT_I2C_IF_DISÂ Â Â 0x10 |
Disable I2C, enable SPI bit
Definition at line
78
of file
icm20648.h
.
Referenced by ICM20648_init() .
#define ICM20648_BIT_I2C_MST_CYCLEÂ Â Â 0x40 |
I2C master cycle mode enable
Definition at line
83
of file
icm20648.h
.
#define ICM20648_BIT_I2C_MST_ENÂ Â Â 0x20 |
I2C master I/F enable bit
Definition at line
77
of file
icm20648.h
.
#define ICM20648_BIT_I2C_MST_P_NSRÂ Â Â 0x10 |
Stop between reads enabling bit
Definition at line
248
of file
icm20648.h
.
#define ICM20648_BIT_I2C_READÂ Â Â 0x80 |
I2C Slave R/W bit
Definition at line
286
of file
icm20648.h
.
#define ICM20648_BIT_I2C_REG_DISÂ Â Â 0x20 |
I2C Slave Do Not Write Register Value bit
Definition at line
284
of file
icm20648.h
.
#define ICM20648_BIT_I2C_SLV_ENÂ Â Â 0x80 |
I2C Slave Enable bit
Definition at line
282
of file
icm20648.h
.
#define ICM20648_BIT_INT_ACTLÂ Â Â 0x80 |
#define ICM20648_BIT_INT_LATCH_ENÂ Â Â 0x20 |
Latch enable bit
Definition at line
102
of file
icm20648.h
.
#define ICM20648_BIT_INT_OPENÂ Â Â 0x40 |
Open collector onfiguration bit
Definition at line
101
of file
icm20648.h
.
Referenced by ICM20648_init() .
#define ICM20648_BIT_LP_ENÂ Â Â 0x20 |
Low Power feature enable bit
Definition at line
90
of file
icm20648.h
.
Referenced by ICM20648_lowPowerModeEnter() .
#define ICM20648_BIT_MULTI_FIFO_CFGÂ Â Â 0x01 |
Interrupt status for each sensor is required
Definition at line
159
of file
icm20648.h
.
#define ICM20648_BIT_PLL_RDYÂ Â Â 0x04 |
PLL ready interrupt occured bit
Definition at line
117
of file
icm20648.h
.
#define ICM20648_BIT_PWR_ACCEL_STBYÂ Â Â 0x38 |
Disable accelerometer
Definition at line
95
of file
icm20648.h
.
Referenced by ICM20648_sensorEnable() .
#define ICM20648_BIT_PWR_ALL_OFFÂ Â Â 0x7F |
Disable both accel and gyro
Definition at line
97
of file
icm20648.h
.
#define ICM20648_BIT_PWR_GYRO_STBYÂ Â Â 0x07 |
Disable gyroscope
Definition at line
96
of file
icm20648.h
.
Referenced by ICM20648_sensorEnable() .
#define ICM20648_BIT_RAW_DATA_0_RDYÂ Â Â 0x01 |
Raw Data Ready bit
Definition at line
156
of file
icm20648.h
.
#define ICM20648_BIT_RAW_DATA_0_RDY_ENÂ Â Â 0x01 |
Raw data ready interrupt enable bit
Definition at line
108
of file
icm20648.h
.
Referenced by ICM20648_interruptEnable() .
#define ICM20648_BIT_RAW_DATA_0_RDY_INTÂ Â Â 0x01 |
Raw data ready interrupt occured bit
Definition at line
120
of file
icm20648.h
.
Referenced by ICM20648_isDataReady() .
#define ICM20648_BIT_SINGLE_FIFO_CFGÂ Â Â 0x00 |
Interrupt status for only a single sensor is required
Definition at line
160
of file
icm20648.h
.
#define ICM20648_BIT_SLEEPÂ Â Â 0x40 |
Sleep mode enable bit
Definition at line
89
of file
icm20648.h
.
Referenced by ICM20648_sleepModeEnable() .
#define ICM20648_BIT_SLV0_DLY_ENÂ Â Â 0x01 |
I2C Slave0 Delay Enable bit
Definition at line
251
of file
icm20648.h
.
#define ICM20648_BIT_SLV1_DLY_ENÂ Â Â 0x02 |
I2C Slave1 Delay Enable bit
Definition at line
252
of file
icm20648.h
.
#define ICM20648_BIT_SLV2_DLY_ENÂ Â Â 0x04 |
I2C Slave2 Delay Enable bit
Definition at line
253
of file
icm20648.h
.
#define ICM20648_BIT_SLV3_DLY_ENÂ Â Â 0x08 |
I2C Slave3 Delay Enable bit
Definition at line
254
of file
icm20648.h
.
#define ICM20648_BIT_TEMP_DISÂ Â Â 0x08 |
Temperature sensor disable bit
Definition at line
91
of file
icm20648.h
.
Referenced by ICM20648_sensorEnable() .
#define ICM20648_BIT_WOM_INTÂ Â Â 0x08 |
Wake-up on motion interrupt occured bit
Definition at line
116
of file
icm20648.h
.
#define ICM20648_BIT_WOM_INT_ENÂ Â Â 0x08 |
Wake-up On Motion enable bit
Definition at line
105
of file
icm20648.h
.
Referenced by ICM20648_interruptEnable() .
#define ICM20648_BITS_GYRO_FIFO_ENÂ Â Â 0x0E |
Enable writing gyroscope data to FIFO bit
Definition at line
146
of file
icm20648.h
.
Referenced by ICM20648_accelGyroCalibrate() , and ICM20648_gyroCalibrate() .
#define ICM20648_DEVICE_IDÂ Â Â 0xE0 |
ICM20648 Device ID value
Definition at line
291
of file
icm20648.h
.
Referenced by ICM20648_init() .
#define ICM20648_ERROR_INVALID_DEVICE_IDÂ Â Â 0x0001 |
#define ICM20648_GYRO_BW_120HZÂ Â Â ( (0x02 << ICM20648_SHIFT_GYRO_DLPCFG) | ICM20648_BIT_GYRO_FCHOICE) |
Gyro Bandwidth = 120 Hz
Definition at line
193
of file
icm20648.h
.
#define ICM20648_GYRO_BW_12100HZÂ Â Â (0x00 << ICM20648_SHIFT_GYRO_DLPCFG) |
Gyro Bandwidth = 12100 Hz
Definition at line
189
of file
icm20648.h
.
#define ICM20648_GYRO_BW_12HZÂ Â Â ( (0x05 << ICM20648_SHIFT_GYRO_DLPCFG) | ICM20648_BIT_GYRO_FCHOICE) |
Gyro Bandwidth = 12 Hz
Definition at line
196
of file
icm20648.h
.
Referenced by ICM20648_accelGyroCalibrate() , and ICM20648_gyroCalibrate() .
#define ICM20648_GYRO_BW_150HZÂ Â Â ( (0x01 << ICM20648_SHIFT_GYRO_DLPCFG) | ICM20648_BIT_GYRO_FCHOICE) |
Gyro Bandwidth = 150 Hz
Definition at line
192
of file
icm20648.h
.
#define ICM20648_GYRO_BW_200HZÂ Â Â ( (0x00 << ICM20648_SHIFT_GYRO_DLPCFG) | ICM20648_BIT_GYRO_FCHOICE) |
Gyro Bandwidth = 200 Hz
Definition at line
191
of file
icm20648.h
.
#define ICM20648_GYRO_BW_24HZÂ Â Â ( (0x04 << ICM20648_SHIFT_GYRO_DLPCFG) | ICM20648_BIT_GYRO_FCHOICE) |
Gyro Bandwidth = 24 Hz
Definition at line
195
of file
icm20648.h
.
#define ICM20648_GYRO_BW_360HZÂ Â Â ( (0x07 << ICM20648_SHIFT_GYRO_DLPCFG) | ICM20648_BIT_GYRO_FCHOICE) |
Gyro Bandwidth = 360 Hz
Definition at line
190
of file
icm20648.h
.
#define ICM20648_GYRO_BW_51HZÂ Â Â ( (0x03 << ICM20648_SHIFT_GYRO_DLPCFG) | ICM20648_BIT_GYRO_FCHOICE) |
#define ICM20648_GYRO_BW_6HZÂ Â Â ( (0x06 << ICM20648_SHIFT_GYRO_DLPCFG) | ICM20648_BIT_GYRO_FCHOICE) |
Gyro Bandwidth = 6 Hz
Definition at line
197
of file
icm20648.h
.
#define ICM20648_GYRO_FULLSCALE_1000DPSÂ Â Â (0x02 << ICM20648_SHIFT_GYRO_FS_SEL) |
Gyro Full Scale = 1000 deg/sec
Definition at line
187
of file
icm20648.h
.
Referenced by ICM20648_gyroResolutionGet() .
#define ICM20648_GYRO_FULLSCALE_2000DPSÂ Â Â (0x03 << ICM20648_SHIFT_GYRO_FS_SEL) |
Gyro Full Scale = 2000 deg/sec
Definition at line
188
of file
icm20648.h
.
Referenced by ICM20648_gyroResolutionGet() .
#define ICM20648_GYRO_FULLSCALE_250DPSÂ Â Â (0x00 << ICM20648_SHIFT_GYRO_FS_SEL) |
Gyro Full Scale = 250 deg/sec
Definition at line
185
of file
icm20648.h
.
Referenced by ICM20648_accelGyroCalibrate() , ICM20648_gyroCalibrate() , ICM20648_gyroResolutionGet() , and IMU_config() .
#define ICM20648_GYRO_FULLSCALE_500DPSÂ Â Â (0x01 << ICM20648_SHIFT_GYRO_FS_SEL) |
Gyro Full Scale = 500 deg/sec
Definition at line
186
of file
icm20648.h
.
Referenced by ICM20648_gyroResolutionGet() .
#define ICM20648_MASK_ACCEL_BWÂ Â Â 0x39 |
Accel Bandwidth Select bitmask
Definition at line
225
of file
icm20648.h
.
Referenced by ICM20648_accelBandwidthSet() .
#define ICM20648_MASK_ACCEL_FULLSCALEÂ Â Â 0x06 |
Accel Full Scale Select bitmask
Definition at line
224
of file
icm20648.h
.
Referenced by ICM20648_accelFullscaleSet() , and ICM20648_accelResolutionGet() .
#define ICM20648_MASK_GYRO_BWÂ Â Â 0x39 |
Gyro Bandwidth Select bitmask
Definition at line
184
of file
icm20648.h
.
Referenced by ICM20648_gyroBandwidthSet() .
#define ICM20648_MASK_GYRO_FULLSCALEÂ Â Â 0x06 |
Gyro Full Scale Select bitmask
Definition at line
183
of file
icm20648.h
.
Referenced by ICM20648_gyroFullscaleSet() , and ICM20648_gyroResolutionGet() .
#define ICM20648_OKÂ Â Â 0x0000 |
No errors
Definition at line
51
of file
icm20648.h
.
Referenced by ICM20648_accelBandwidthSet() , ICM20648_accelDataRead() , ICM20648_accelFullscaleSet() , ICM20648_accelGyroCalibrate() , ICM20648_accelResolutionGet() , ICM20648_cycleModeEnable() , ICM20648_deInit() , ICM20648_getDeviceID() , ICM20648_gyroBandwidthSet() , ICM20648_gyroCalibrate() , ICM20648_gyroDataRead() , ICM20648_gyroFullscaleSet() , ICM20648_gyroResolutionGet() , ICM20648_init() , ICM20648_interruptEnable() , ICM20648_interruptStatusRead() , ICM20648_lowPowerModeEnter() , ICM20648_reset() , ICM20648_sampleRateSet() , ICM20648_sensorEnable() , ICM20648_sleepModeEnable() , ICM20648_spiInit() , ICM20648_temperatureRead() , ICM20648_wakeOnMotionITEnable() , and IMU_init() .
#define ICM20648_REG_ACCEL_CONFIGÂ Â Â ( ICM20648_BANK_2 | 0x14) |
Accelerometer Configuration register
Definition at line
220
of file
icm20648.h
.
Referenced by ICM20648_accelBandwidthSet() , ICM20648_accelFullscaleSet() , and ICM20648_accelResolutionGet() .
#define ICM20648_REG_ACCEL_CONFIG_2Â Â Â ( ICM20648_BANK_2 | 0x15) |
Accelerometer Configuration 2 register
Definition at line
239
of file
icm20648.h
.
#define ICM20648_REG_ACCEL_INTEL_CTRLÂ Â Â ( ICM20648_BANK_2 | 0x12) |
Accelerometer Hardware Intelligence Control register
Definition at line
214
of file
icm20648.h
.
Referenced by ICM20648_wakeOnMotionITEnable() .
#define ICM20648_REG_ACCEL_SMPLRT_DIV_1Â Â Â ( ICM20648_BANK_2 | 0x10) |
Acceleration Sensor Sample Rate Divider 1 register
Definition at line
211
of file
icm20648.h
.
Referenced by ICM20648_accelSampleRateSet() .
#define ICM20648_REG_ACCEL_SMPLRT_DIV_2Â Â Â ( ICM20648_BANK_2 | 0x11) |
Acceleration Sensor Sample Rate Divider 2 register
Definition at line
212
of file
icm20648.h
.
Referenced by ICM20648_accelSampleRateSet() .
#define ICM20648_REG_ACCEL_WOM_THRÂ Â Â ( ICM20648_BANK_2 | 0x13) |
Wake-up On Motion Threshold register
Definition at line
218
of file
icm20648.h
.
Referenced by ICM20648_wakeOnMotionITEnable() .
#define ICM20648_REG_ACCEL_XOUT_H_SHÂ Â Â ( ICM20648_BANK_0 | 0x2D) |
Accelerometer X-axis data high byte
Definition at line
124
of file
icm20648.h
.
Referenced by ICM20648_accelDataRead() .
#define ICM20648_REG_ACCEL_XOUT_L_SHÂ Â Â ( ICM20648_BANK_0 | 0x2E) |
Accelerometer X-axis data low byte
Definition at line
125
of file
icm20648.h
.
#define ICM20648_REG_ACCEL_YOUT_H_SHÂ Â Â ( ICM20648_BANK_0 | 0x2F) |
Accelerometer Y-axis data high byte
Definition at line
126
of file
icm20648.h
.
#define ICM20648_REG_ACCEL_YOUT_L_SHÂ Â Â ( ICM20648_BANK_0 | 0x30) |
Accelerometer Y-axis data low byte
Definition at line
127
of file
icm20648.h
.
#define ICM20648_REG_ACCEL_ZOUT_H_SHÂ Â Â ( ICM20648_BANK_0 | 0x31) |
Accelerometer Z-axis data high byte
Definition at line
128
of file
icm20648.h
.
#define ICM20648_REG_ACCEL_ZOUT_L_SHÂ Â Â ( ICM20648_BANK_0 | 0x32) |
Accelerometer Z-axis data low byte
Definition at line
129
of file
icm20648.h
.
#define ICM20648_REG_BANK_SELÂ Â Â 0x7F |
Bank Select register
Definition at line
289
of file
icm20648.h
.
Referenced by ICM20648_bankSelect() .
#define ICM20648_REG_DATA_RDY_STATUSÂ Â Â ( ICM20648_BANK_0 | 0x74) |
Data Ready Status register
Definition at line
155
of file
icm20648.h
.
#define ICM20648_REG_FIFO_CFGÂ Â Â ( ICM20648_BANK_0 | 0x76) |
FIFO Configuration register
Definition at line
158
of file
icm20648.h
.
#define ICM20648_REG_FIFO_COUNT_HÂ Â Â ( ICM20648_BANK_0 | 0x70) |
FIFO data count high byte
Definition at line
151
of file
icm20648.h
.
Referenced by ICM20648_accelGyroCalibrate() , and ICM20648_gyroCalibrate() .
#define ICM20648_REG_FIFO_COUNT_LÂ Â Â ( ICM20648_BANK_0 | 0x71) |
FIFO data count low byte
Definition at line
152
of file
icm20648.h
.
#define ICM20648_REG_FIFO_EN_1Â Â Â ( ICM20648_BANK_0 | 0x66) |
FIFO Enable 1 register
Definition at line
142
of file
icm20648.h
.
#define ICM20648_REG_FIFO_EN_2Â Â Â ( ICM20648_BANK_0 | 0x67) |
FIFO Enable 2 register
Definition at line
144
of file
icm20648.h
.
Referenced by ICM20648_accelGyroCalibrate() , and ICM20648_gyroCalibrate() .
#define ICM20648_REG_FIFO_MODEÂ Â Â ( ICM20648_BANK_0 | 0x69) |
FIFO Mode register
Definition at line
149
of file
icm20648.h
.
Referenced by ICM20648_accelGyroCalibrate() , and ICM20648_gyroCalibrate() .
#define ICM20648_REG_FIFO_R_WÂ Â Â ( ICM20648_BANK_0 | 0x72) |
FIFO Read/Write register
Definition at line
153
of file
icm20648.h
.
Referenced by ICM20648_accelGyroCalibrate() , and ICM20648_gyroCalibrate() .
#define ICM20648_REG_FIFO_RSTÂ Â Â ( ICM20648_BANK_0 | 0x68) |
FIFO Reset register
Definition at line
148
of file
icm20648.h
.
Referenced by ICM20648_accelGyroCalibrate() , and ICM20648_gyroCalibrate() .
#define ICM20648_REG_GYRO_CONFIG_1Â Â Â ( ICM20648_BANK_2 | 0x01) |
Gyroscope Configuration 1 register
Definition at line
179
of file
icm20648.h
.
Referenced by ICM20648_gyroBandwidthSet() , ICM20648_gyroFullscaleSet() , and ICM20648_gyroResolutionGet() .
#define ICM20648_REG_GYRO_CONFIG_2Â Â Â ( ICM20648_BANK_2 | 0x02) |
Gyroscope Configuration 2 register
Definition at line
199
of file
icm20648.h
.
#define ICM20648_REG_GYRO_SMPLRT_DIVÂ Â Â ( ICM20648_BANK_2 | 0x00) |
Gyroscope Sample Rate Divider regiser
Definition at line
177
of file
icm20648.h
.
Referenced by ICM20648_gyroSampleRateSet() .
#define ICM20648_REG_GYRO_XOUT_H_SHÂ Â Â ( ICM20648_BANK_0 | 0x33) |
Gyroscope X-axis data high byte
Definition at line
131
of file
icm20648.h
.
Referenced by ICM20648_gyroDataRead() .
#define ICM20648_REG_GYRO_XOUT_L_SHÂ Â Â ( ICM20648_BANK_0 | 0x34) |
Gyroscope X-axis data low byte
Definition at line
132
of file
icm20648.h
.
#define ICM20648_REG_GYRO_YOUT_H_SHÂ Â Â ( ICM20648_BANK_0 | 0x35) |
Gyroscope Y-axis data high byte
Definition at line
133
of file
icm20648.h
.
#define ICM20648_REG_GYRO_YOUT_L_SHÂ Â Â ( ICM20648_BANK_0 | 0x36) |
Gyroscope Y-axis data low byte
Definition at line
134
of file
icm20648.h
.
#define ICM20648_REG_GYRO_ZOUT_H_SHÂ Â Â ( ICM20648_BANK_0 | 0x37) |
Gyroscope Z-axis data high byte
Definition at line
135
of file
icm20648.h
.
#define ICM20648_REG_GYRO_ZOUT_L_SHÂ Â Â ( ICM20648_BANK_0 | 0x38) |
Gyroscope Z-axis data low byte
Definition at line
136
of file
icm20648.h
.
#define ICM20648_REG_I2C_MST_CTRLÂ Â Â ( ICM20648_BANK_3 | 0x01) |
I2C Master Control register
Definition at line
247
of file
icm20648.h
.
#define ICM20648_REG_I2C_MST_DELAY_CTRLÂ Â Â ( ICM20648_BANK_3 | 0x02) |
I2C Master Delay Control register
Definition at line
250
of file
icm20648.h
.
#define ICM20648_REG_I2C_MST_ODR_CONFIGÂ Â Â ( ICM20648_BANK_3 | 0x00) |
I2C Master Output Data Rate Configuration register
Definition at line
245
of file
icm20648.h
.
#define ICM20648_REG_I2C_SLV0_ADDRÂ Â Â ( ICM20648_BANK_3 | 0x03) |
I2C Slave0 Physical Address register
Definition at line
256
of file
icm20648.h
.
#define ICM20648_REG_I2C_SLV0_CTRLÂ Â Â ( ICM20648_BANK_3 | 0x05) |
I2C Slave0 Control register
Definition at line
258
of file
icm20648.h
.
#define ICM20648_REG_I2C_SLV0_DOÂ Â Â ( ICM20648_BANK_3 | 0x06) |
I2C Slave0 Data Out register
Definition at line
259
of file
icm20648.h
.
#define ICM20648_REG_I2C_SLV0_REGÂ Â Â ( ICM20648_BANK_3 | 0x04) |
I2C Slave0 Register Address register
Definition at line
257
of file
icm20648.h
.
#define ICM20648_REG_I2C_SLV1_ADDRÂ Â Â ( ICM20648_BANK_3 | 0x07) |
I2C Slave1 Physical Address register
Definition at line
261
of file
icm20648.h
.
#define ICM20648_REG_I2C_SLV1_CTRLÂ Â Â ( ICM20648_BANK_3 | 0x09) |
I2C Slave1 Control register
Definition at line
263
of file
icm20648.h
.
#define ICM20648_REG_I2C_SLV1_DOÂ Â Â ( ICM20648_BANK_3 | 0x0A) |
I2C Slave1 Data Out register
Definition at line
264
of file
icm20648.h
.
#define ICM20648_REG_I2C_SLV1_REGÂ Â Â ( ICM20648_BANK_3 | 0x08) |
I2C Slave1 Register Address register
Definition at line
262
of file
icm20648.h
.
#define ICM20648_REG_I2C_SLV2_ADDRÂ Â Â ( ICM20648_BANK_3 | 0x0B) |
I2C Slave2 Physical Address register
Definition at line
266
of file
icm20648.h
.
#define ICM20648_REG_I2C_SLV2_CTRLÂ Â Â ( ICM20648_BANK_3 | 0x0D) |
I2C Slave2 Control register
Definition at line
268
of file
icm20648.h
.
#define ICM20648_REG_I2C_SLV2_DOÂ Â Â ( ICM20648_BANK_3 | 0x0E) |
I2C Slave2 Data Out register
Definition at line
269
of file
icm20648.h
.
#define ICM20648_REG_I2C_SLV2_REGÂ Â Â ( ICM20648_BANK_3 | 0x0C) |
I2C Slave2 Register Address register
Definition at line
267
of file
icm20648.h
.
#define ICM20648_REG_I2C_SLV3_ADDRÂ Â Â ( ICM20648_BANK_3 | 0x0F) |
I2C Slave3 Physical Address register
Definition at line
271
of file
icm20648.h
.
#define ICM20648_REG_I2C_SLV3_CTRLÂ Â Â ( ICM20648_BANK_3 | 0x11) |
I2C Slave3 Control register
Definition at line
273
of file
icm20648.h
.
#define ICM20648_REG_I2C_SLV3_DOÂ Â Â ( ICM20648_BANK_3 | 0x12) |
I2C Slave3 Data Out register
Definition at line
274
of file
icm20648.h
.
#define ICM20648_REG_I2C_SLV3_REGÂ Â Â ( ICM20648_BANK_3 | 0x10) |
I2C Slave3 Register Address register
Definition at line
272
of file
icm20648.h
.
#define ICM20648_REG_I2C_SLV4_ADDRÂ Â Â ( ICM20648_BANK_3 | 0x13) |
I2C Slave4 Physical Address register
Definition at line
276
of file
icm20648.h
.
#define ICM20648_REG_I2C_SLV4_CTRLÂ Â Â ( ICM20648_BANK_3 | 0x15) |
I2C Slave4 Control register
Definition at line
278
of file
icm20648.h
.
#define ICM20648_REG_I2C_SLV4_DIÂ Â Â ( ICM20648_BANK_3 | 0x17) |
I2C Slave4 Data In register
Definition at line
280
of file
icm20648.h
.
#define ICM20648_REG_I2C_SLV4_DOÂ Â Â ( ICM20648_BANK_3 | 0x16) |
I2C Slave4 Data Out register
Definition at line
279
of file
icm20648.h
.
#define ICM20648_REG_I2C_SLV4_REGÂ Â Â ( ICM20648_BANK_3 | 0x14) |
I2C Slave4 Register Address register
Definition at line
277
of file
icm20648.h
.
#define ICM20648_REG_INT_ENABLEÂ Â Â ( ICM20648_BANK_0 | 0x10) |
Interrupt Enable register
Definition at line
104
of file
icm20648.h
.
Referenced by ICM20648_interruptEnable() .
#define ICM20648_REG_INT_ENABLE_1Â Â Â ( ICM20648_BANK_0 | 0x11) |
Interrupt Enable 1 register
Definition at line
107
of file
icm20648.h
.
Referenced by ICM20648_interruptEnable() .
#define ICM20648_REG_INT_ENABLE_2Â Â Â ( ICM20648_BANK_0 | 0x12) |
Interrupt Enable 2 register
Definition at line
110
of file
icm20648.h
.
#define ICM20648_REG_INT_ENABLE_3Â Â Â ( ICM20648_BANK_0 | 0x13) |
Interrupt Enable 2 register
Definition at line
113
of file
icm20648.h
.
#define ICM20648_REG_INT_PIN_CFGÂ Â Â ( ICM20648_BANK_0 | 0x0F) |
Interrupt Pin Configuration register
Definition at line
99
of file
icm20648.h
.
Referenced by ICM20648_init() .
#define ICM20648_REG_INT_STATUSÂ Â Â ( ICM20648_BANK_0 | 0x19) |
Interrupt Status register
Definition at line
115
of file
icm20648.h
.
Referenced by ICM20648_interruptStatusRead() .
#define ICM20648_REG_INT_STATUS_1Â Â Â ( ICM20648_BANK_0 | 0x1A) |
Interrupt Status 1 register
Definition at line
119
of file
icm20648.h
.
Referenced by ICM20648_isDataReady() .
#define ICM20648_REG_INT_STATUS_2Â Â Â ( ICM20648_BANK_0 | 0x1B) |
Interrupt Status 2 register
Definition at line
122
of file
icm20648.h
.
#define ICM20648_REG_LP_CONFIGÂ Â Â ( ICM20648_BANK_0 | 0x05) |
Low Power mode config register
Definition at line
82
of file
icm20648.h
.
Referenced by ICM20648_cycleModeEnable() .
#define ICM20648_REG_ODR_ALIGN_ENÂ Â Â ( ICM20648_BANK_2 | 0x09) |
Output Data Rate start time alignment
Definition at line
209
of file
icm20648.h
.
#define ICM20648_REG_PWR_MGMT_1Â Â Â ( ICM20648_BANK_0 | 0x06) |
Power Management 1 register
Definition at line
87
of file
icm20648.h
.
Referenced by ICM20648_init() , ICM20648_lowPowerModeEnter() , ICM20648_reset() , ICM20648_sensorEnable() , and ICM20648_sleepModeEnable() .
#define ICM20648_REG_PWR_MGMT_2Â Â Â ( ICM20648_BANK_0 | 0x07) |
Power Management 2 register
Definition at line
94
of file
icm20648.h
.
Referenced by ICM20648_sensorEnable() .
#define ICM20648_REG_TEMP_CONFIGÂ Â Â ( ICM20648_BANK_0 | 0x53) |
Temperature Configuration register
Definition at line
140
of file
icm20648.h
.
#define ICM20648_REG_TEMPERATURE_HÂ Â Â ( ICM20648_BANK_0 | 0x39) |
Temperature data high byte
Definition at line
138
of file
icm20648.h
.
Referenced by ICM20648_temperatureRead() .
#define ICM20648_REG_TEMPERATURE_LÂ Â Â ( ICM20648_BANK_0 | 0x3A) |
Temperature data low byte
Definition at line
139
of file
icm20648.h
.
#define ICM20648_REG_TIMEBASE_CORR_PLLÂ Â Â ( ICM20648_BANK_1 | 0x28) |
PLL Timebase Correction register
Definition at line
172
of file
icm20648.h
.
#define ICM20648_REG_USER_CTRLÂ Â Â ( ICM20648_BANK_0 | 0x03) |
User control register
Definition at line
74
of file
icm20648.h
.
Referenced by ICM20648_accelGyroCalibrate() , ICM20648_gyroCalibrate() , and ICM20648_init() .
#define ICM20648_REG_WHO_AM_IÂ Â Â ( ICM20648_BANK_0 | 0x00) |
Device ID register
Definition at line
72
of file
icm20648.h
.
Referenced by ICM20648_getDeviceID() , and ICM20648_init() .
#define ICM20648_REG_XA_OFFSET_HÂ Â Â ( ICM20648_BANK_1 | 0x14) |
Acceleration sensor X-axis offset cancellation high byte
Definition at line
165
of file
icm20648.h
.
Referenced by ICM20648_accelGyroCalibrate() .
#define ICM20648_REG_XA_OFFSET_LÂ Â Â ( ICM20648_BANK_1 | 0x15) |
Acceleration sensor X-axis offset cancellation low byte
Definition at line
166
of file
icm20648.h
.
Referenced by ICM20648_accelGyroCalibrate() .
#define ICM20648_REG_XG_OFFS_USRHÂ Â Â ( ICM20648_BANK_2 | 0x03) |
Gyroscope sensor X-axis offset cancellation high byte
Definition at line
202
of file
icm20648.h
.
Referenced by ICM20648_accelGyroCalibrate() , and ICM20648_gyroCalibrate() .
#define ICM20648_REG_XG_OFFS_USRLÂ Â Â ( ICM20648_BANK_2 | 0x04) |
Gyroscope sensor X-axis offset cancellation low byte
Definition at line
203
of file
icm20648.h
.
Referenced by ICM20648_accelGyroCalibrate() , and ICM20648_gyroCalibrate() .
#define ICM20648_REG_YA_OFFSET_HÂ Â Â ( ICM20648_BANK_1 | 0x17) |
Acceleration sensor Y-axis offset cancellation high byte
Definition at line
167
of file
icm20648.h
.
Referenced by ICM20648_accelGyroCalibrate() .
#define ICM20648_REG_YA_OFFSET_LÂ Â Â ( ICM20648_BANK_1 | 0x18) |
Acceleration sensor Y-axis offset cancellation low byte
Definition at line
168
of file
icm20648.h
.
Referenced by ICM20648_accelGyroCalibrate() .
#define ICM20648_REG_YG_OFFS_USRHÂ Â Â ( ICM20648_BANK_2 | 0x05) |
Gyroscope sensor Y-axis offset cancellation high byte
Definition at line
204
of file
icm20648.h
.
Referenced by ICM20648_accelGyroCalibrate() , and ICM20648_gyroCalibrate() .
#define ICM20648_REG_YG_OFFS_USRLÂ Â Â ( ICM20648_BANK_2 | 0x06) |
Gyroscope sensor Y-axis offset cancellation low byte
Definition at line
205
of file
icm20648.h
.
Referenced by ICM20648_accelGyroCalibrate() , and ICM20648_gyroCalibrate() .
#define ICM20648_REG_ZA_OFFSET_HÂ Â Â ( ICM20648_BANK_1 | 0x1A) |
Acceleration sensor Z-axis offset cancellation high byte
Definition at line
169
of file
icm20648.h
.
Referenced by ICM20648_accelGyroCalibrate() .
#define ICM20648_REG_ZA_OFFSET_LÂ Â Â ( ICM20648_BANK_1 | 0x1B) |
Acceleration sensor Z-axis offset cancellation low byte
Definition at line
170
of file
icm20648.h
.
Referenced by ICM20648_accelGyroCalibrate() .
#define ICM20648_REG_ZG_OFFS_USRHÂ Â Â ( ICM20648_BANK_2 | 0x07) |
Gyroscope sensor Z-axis offset cancellation high byte
Definition at line
206
of file
icm20648.h
.
Referenced by ICM20648_accelGyroCalibrate() , and ICM20648_gyroCalibrate() .
#define ICM20648_REG_ZG_OFFS_USRLÂ Â Â ( ICM20648_BANK_2 | 0x08) |
Gyroscope sensor Z-axis offset cancellation low byte
Definition at line
207
of file
icm20648.h
.
Referenced by ICM20648_accelGyroCalibrate() , and ICM20648_gyroCalibrate() .
#define ICM20648_SHIFT_ACCEL_DLPCFGÂ Â Â 3 |
Accel DLPF Config bit shift
Definition at line
223
of file
icm20648.h
.
#define ICM20648_SHIFT_ACCEL_FSÂ Â Â 1 |
Accel Full Scale Select bit shift
Definition at line
222
of file
icm20648.h
.
#define ICM20648_SHIFT_GYRO_DLPCFGÂ Â Â 3 |
Gyro DLPF Config bit shift
Definition at line
182
of file
icm20648.h
.
#define ICM20648_SHIFT_GYRO_FS_SELÂ Â Â 1 |
Gyro Full Scale Select bit shift
Definition at line
181
of file
icm20648.h
.
#define ICM20948_DEVICE_IDÂ Â Â 0xEA |
ICM20948 Device ID value
Definition at line
292
of file
icm20648.h
.
Referenced by ICM20648_init() .
Function Documentation
uint32_t ICM20648_accelBandwidthSet | ( | uint8_t |
accelBw
|
) |
Sets the bandwidth of the accelerometer.
- Parameters
-
[in] accelBw
The desired bandwidth value. Use the ICM20648_ACCEL_BW_yHZ macros, which are defined in the icm20648.h
file. The value of y can be 6, 12, 24, 50, 111, 246, 470 or 1210.
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
476
of file
icm20648.c
.
References ICM20648_MASK_ACCEL_BW , ICM20648_OK , ICM20648_REG_ACCEL_CONFIG , ICM20648_registerRead() , and ICM20648_registerWrite() .
Referenced by ICM20648_accelGyroCalibrate() , ICM20648_wakeOnMotionITEnable() , and IMU_config() .
uint32_t ICM20648_accelDataRead | ( | float * |
accel
|
) |
Reads the raw acceleration value and converts to g value based on the actual resolution.
- Parameters
-
[out] accel
A 3-element array of float numbers containing the acceleration values for the x, y and z axes in g units.
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
152
of file
icm20648.c
.
References ICM20648_accelResolutionGet() , ICM20648_OK , ICM20648_REG_ACCEL_XOUT_H_SH , and ICM20648_registerRead() .
Referenced by IMU_getAccelerometerData() .
uint32_t ICM20648_accelFullscaleSet | ( | uint8_t |
accelFs
|
) |
Sets the full scale value of the accelerometer.
- Parameters
-
[in] accelFs
The desired full scale value. Use the ICM20648_ACCEL_FULLSCALE_xG macros, which are defined in the icm20648.h
file. The value of x can be 2, 4, 8 or 16.
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
302
of file
icm20648.c
.
References ICM20648_MASK_ACCEL_FULLSCALE , ICM20648_OK , ICM20648_REG_ACCEL_CONFIG , ICM20648_registerRead() , and ICM20648_registerWrite() .
Referenced by ICM20648_accelGyroCalibrate() , ICM20648_wakeOnMotionITEnable() , and IMU_config() .
uint32_t ICM20648_accelGyroCalibrate | ( | float * |
accelBiasScaled,
|
float * |
gyroBiasScaled
|
||
) |
Accelerometer and gyroscope calibration function. Reads the gyroscope and accelerometer values while the device is at rest and in level. The resulting values are loaded to the accel and gyro bias registers to cancel the static offset error.
- Parameters
-
[out] accelBiasScaled
The mesured acceleration sensor bias in mg [out] gyroBiasScaled
The mesured gyro sensor bias in deg/sec
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
816
of file
icm20648.c
.
References ICM20648_ACCEL_BW_246HZ , ICM20648_ACCEL_FULLSCALE_2G , ICM20648_accelBandwidthSet() , ICM20648_accelFullscaleSet() , ICM20648_accelResolutionGet() , ICM20648_BIT_ACCEL_FIFO_EN , ICM20648_BIT_FIFO_EN , ICM20648_BITS_GYRO_FIFO_EN , ICM20648_GYRO_BW_12HZ , ICM20648_GYRO_FULLSCALE_250DPS , ICM20648_gyroBandwidthSet() , ICM20648_gyroFullscaleSet() , ICM20648_gyroResolutionGet() , ICM20648_OK , ICM20648_REG_FIFO_COUNT_H , ICM20648_REG_FIFO_EN_2 , ICM20648_REG_FIFO_MODE , ICM20648_REG_FIFO_R_W , ICM20648_REG_FIFO_RST , ICM20648_REG_USER_CTRL , ICM20648_REG_XA_OFFSET_H , ICM20648_REG_XA_OFFSET_L , ICM20648_REG_XG_OFFS_USRH , ICM20648_REG_XG_OFFS_USRL , ICM20648_REG_YA_OFFSET_H , ICM20648_REG_YA_OFFSET_L , ICM20648_REG_YG_OFFS_USRH , ICM20648_REG_YG_OFFS_USRL , ICM20648_REG_ZA_OFFSET_H , ICM20648_REG_ZA_OFFSET_L , ICM20648_REG_ZG_OFFS_USRH , ICM20648_REG_ZG_OFFS_USRL , ICM20648_registerRead() , ICM20648_registerWrite() , ICM20648_sampleRateSet() , ICM20648_sensorEnable() , and UTIL_delay() .
uint32_t ICM20648_accelResolutionGet | ( | float * |
accelRes
|
) |
Gets the actual resolution of the accelerometer.
- Parameters
-
[out] accelRes
The resolution in g/bit units
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
220
of file
icm20648.c
.
References ICM20648_ACCEL_FULLSCALE_16G , ICM20648_ACCEL_FULLSCALE_2G , ICM20648_ACCEL_FULLSCALE_4G , ICM20648_ACCEL_FULLSCALE_8G , ICM20648_MASK_ACCEL_FULLSCALE , ICM20648_OK , ICM20648_REG_ACCEL_CONFIG , and ICM20648_registerRead() .
Referenced by ICM20648_accelDataRead() , and ICM20648_accelGyroCalibrate() .
float ICM20648_accelSampleRateSet | ( | float |
sampleRate
|
) |
Sets the sample rate of the gyroscope.
- Parameters
-
[in] sampleRate
The desired sample rate in Hz
- Returns
- The actual sample rate. May be different from the desired value because of the finite and discrete number of divider settings
Definition at line
409
of file
icm20648.c
.
References ICM20648_REG_ACCEL_SMPLRT_DIV_1 , ICM20648_REG_ACCEL_SMPLRT_DIV_2 , and ICM20648_registerWrite() .
Referenced by ICM20648_sampleRateSet() , and IMU_config() .
void ICM20648_bankSelect | ( | uint8_t |
bank
|
) |
Select the desired register bank.
- Parameters
-
[in] bank
The address of the register bank (0..3)
- Returns
- None
Definition at line
1339
of file
icm20648.c
.
References ICM20648_REG_BANK_SEL , USART_Rx() , and USART_Tx() .
Referenced by ICM20648_registerRead() , and ICM20648_registerWrite() .
uint32_t ICM20648_cycleModeEnable | ( | bool |
enable
|
) |
Enables or disables the cycle mode operation of the accel and gyro.
- Parameters
-
[in] enable
If true both the accel and gyro sensors will operate in cycle mode. If false the senors working in continuous mode.
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
531
of file
icm20648.c
.
References ICM20648_BIT_ACCEL_CYCLE , ICM20648_BIT_GYRO_CYCLE , ICM20648_OK , ICM20648_REG_LP_CONFIG , and ICM20648_registerWrite() .
Referenced by ICM20648_lowPowerModeEnter() , and ICM20648_wakeOnMotionITEnable() .
uint32_t ICM20648_deInit | ( | void |
|
) |
De-initializes the ICM20648 sensor by disconnecting the supply and SPI lines.
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
114
of file
icm20648.c
.
References BOARD_imuEnable() , and ICM20648_OK .
Referenced by IMU_deInit() , and IMU_init() .
uint32_t ICM20648_getDeviceID | ( | uint8_t * |
devID
|
) |
Reads the device ID of the ICM20648.
- Parameters
-
[out] devID
The ID of the device read from teh WHO_AM_I register. Expected value? 0xE0
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
1196
of file
icm20648.c
.
References ICM20648_OK , ICM20648_REG_WHO_AM_I , and ICM20648_registerRead() .
Referenced by IMU_init() .
uint32_t ICM20648_gyroBandwidthSet | ( | uint8_t |
gyroBw
|
) |
Sets the bandwidth of the gyroscope.
- Parameters
-
[in] gyroBw
The desired bandwidth value. Use the ICM20648_GYRO_BW_xHZ macros, which are defined in the icm20648.h
file. The value of x can be 6, 12, 24, 51, 120, 150, 200, 360 or 12100.
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
449
of file
icm20648.c
.
References ICM20648_MASK_GYRO_BW , ICM20648_OK , ICM20648_REG_GYRO_CONFIG_1 , ICM20648_registerRead() , and ICM20648_registerWrite() .
Referenced by ICM20648_accelGyroCalibrate() , ICM20648_gyroCalibrate() , and IMU_config() .
uint32_t ICM20648_gyroCalibrate | ( | float * |
gyroBiasScaled
|
) |
Gyroscope calibration function. Reads the gyroscope values while the device is at rest and in level. The resulting values are loaded to the gyro bias registers to cancel the static offset error.
- Parameters
-
[out] gyroBiasScaled
The mesured gyro sensor bias in deg/sec
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
1025
of file
icm20648.c
.
References ICM20648_BIT_FIFO_EN , ICM20648_BITS_GYRO_FIFO_EN , ICM20648_GYRO_BW_12HZ , ICM20648_GYRO_FULLSCALE_250DPS , ICM20648_gyroBandwidthSet() , ICM20648_gyroFullscaleSet() , ICM20648_gyroResolutionGet() , ICM20648_OK , ICM20648_REG_FIFO_COUNT_H , ICM20648_REG_FIFO_EN_2 , ICM20648_REG_FIFO_MODE , ICM20648_REG_FIFO_R_W , ICM20648_REG_FIFO_RST , ICM20648_REG_USER_CTRL , ICM20648_REG_XG_OFFS_USRH , ICM20648_REG_XG_OFFS_USRL , ICM20648_REG_YG_OFFS_USRH , ICM20648_REG_YG_OFFS_USRL , ICM20648_REG_ZG_OFFS_USRH , ICM20648_REG_ZG_OFFS_USRL , ICM20648_registerRead() , ICM20648_registerWrite() , ICM20648_sampleRateSet() , ICM20648_sensorEnable() , and UTIL_delay() .
Referenced by IMU_init() .
uint32_t ICM20648_gyroDataRead | ( | float * |
gyro
|
) |
Reads the raw gyroscope value and converts to deg/sec value based on the actual resolution.
- Parameters
-
[out] gyro
A 3-element array of float numbers containing the gyroscope values for the x, y and z axes in deg/sec units.
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
187
of file
icm20648.c
.
References ICM20648_gyroResolutionGet() , ICM20648_OK , ICM20648_REG_GYRO_XOUT_H_SH , and ICM20648_registerRead() .
Referenced by IMU_getGyroData() .
uint32_t ICM20648_gyroFullscaleSet | ( | uint8_t |
gyroFs
|
) |
Sets the full scale value of the gyroscope.
- Parameters
-
[in] gyroFs
The desired full scale value. Use the ICM20648_GYRO_FULLSCALE_yDPS macros, which are defined in the icm20648.h
file. The value of y can be 250, 500, 1000 or 2000.
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
327
of file
icm20648.c
.
References ICM20648_MASK_GYRO_FULLSCALE , ICM20648_OK , ICM20648_REG_GYRO_CONFIG_1 , ICM20648_registerRead() , and ICM20648_registerWrite() .
Referenced by ICM20648_accelGyroCalibrate() , ICM20648_gyroCalibrate() , and IMU_config() .
uint32_t ICM20648_gyroResolutionGet | ( | float * |
gyroRes
|
) |
Gets the actual resolution of the gyroscope.
- Parameters
-
[out] gyroRes
The actual resolution in (deg/sec)/bit units
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
260
of file
icm20648.c
.
References ICM20648_GYRO_FULLSCALE_1000DPS , ICM20648_GYRO_FULLSCALE_2000DPS , ICM20648_GYRO_FULLSCALE_250DPS , ICM20648_GYRO_FULLSCALE_500DPS , ICM20648_MASK_GYRO_FULLSCALE , ICM20648_OK , ICM20648_REG_GYRO_CONFIG_1 , and ICM20648_registerRead() .
Referenced by ICM20648_accelGyroCalibrate() , ICM20648_gyroCalibrate() , and ICM20648_gyroDataRead() .
float ICM20648_gyroSampleRateSet | ( | float |
sampleRate
|
) |
Sets the sample rate of the accelerometer.
- Parameters
-
[in] sampleRate
The desired sample rate in Hz
- Returns
- The actual sample rate. May be different from the desired value because of the finite and discrete number of divider settings
Definition at line
371
of file
icm20648.c
.
References ICM20648_REG_GYRO_SMPLRT_DIV , and ICM20648_registerWrite() .
Referenced by ICM20648_sampleRateSet() , and IMU_config() .
uint32_t ICM20648_init | ( | void |
|
) |
Initializes the ICM20648 sensor. Enables the power supply and SPI lines, sets up the host SPI controller, configures the chip control interface, clock generator and interrupt line.
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
67
of file
icm20648.c
.
References BOARD_imuEnable() , ICM20648_BIT_CLK_PLL , ICM20648_BIT_I2C_IF_DIS , ICM20648_BIT_INT_ACTL , ICM20648_BIT_INT_OPEN , ICM20648_DEVICE_ID , ICM20648_ERROR_INVALID_DEVICE_ID , ICM20648_OK , ICM20648_REG_INT_PIN_CFG , ICM20648_REG_PWR_MGMT_1 , ICM20648_REG_USER_CTRL , ICM20648_REG_WHO_AM_I , ICM20648_registerRead() , ICM20648_registerWrite() , ICM20648_reset() , ICM20648_spiInit() , ICM20948_DEVICE_ID , and UTIL_delay() .
Referenced by IMU_init() .
uint32_t ICM20648_interruptEnable | ( | bool |
dataReadyEnable,
|
bool |
womEnable
|
||
) |
Enables or disables the interrupts in the ICM20648 chip.
- Parameters
-
[in] dataReadyEnable
If true enables the Raw Data Ready interrupt, otherwise disables. [in] womEnable
If true enables the Wake-up On Motion interrupt, otherwise disables.
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
663
of file
icm20648.c
.
References ICM20648_BIT_RAW_DATA_0_RDY_EN , ICM20648_BIT_WOM_INT_EN , ICM20648_OK , ICM20648_REG_INT_ENABLE , ICM20648_REG_INT_ENABLE_1 , and ICM20648_registerWrite() .
Referenced by ICM20648_wakeOnMotionITEnable() , IMU_config() , and IMU_gyroCalibrate() .
uint32_t ICM20648_interruptStatusRead | ( | uint32_t * |
intStatus
|
) |
Reads the interrupt status registers of the ICM20648 chip.
- Parameters
-
[out] intStatus
The content the four interrupt registers. LSByte is INT_STATUS, MSByte is INT_STATUS_3
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
701
of file
icm20648.c
.
References ICM20648_OK , ICM20648_REG_INT_STATUS , and ICM20648_registerRead() .
Referenced by IMU_config() .
bool ICM20648_isDataReady | ( | void |
|
) |
Checks if new data is available for read.
- Returns
- Returns true if the Raw Data Ready interrupt bit set, false otherwise
Definition at line
721
of file
icm20648.c
.
References ICM20648_BIT_RAW_DATA_0_RDY_INT , ICM20648_REG_INT_STATUS_1 , and ICM20648_registerRead() .
Referenced by IMU_isDataReady() .
uint32_t ICM20648_lowPowerModeEnter | ( | bool |
enAccel,
|
bool |
enGyro,
|
||
bool |
enTemp
|
||
) |
Enables or disables the sensors in low power mode in the ICM20648 chip.
- Parameters
-
[in] enAccel
If true enables the acceleration sensor in low power mode [in] enGyro
If true enables the gyroscope sensor in low power mode [in] enTemp
If true enables the temperature sensor in low power mode
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
614
of file
icm20648.c
.
References ICM20648_BIT_LP_EN , ICM20648_cycleModeEnable() , ICM20648_OK , ICM20648_REG_PWR_MGMT_1 , ICM20648_registerRead() , ICM20648_registerWrite() , ICM20648_sensorEnable() , ICM20648_sleepModeEnable() , and UTIL_delay() .
Referenced by ICM20648_wakeOnMotionITEnable() , and IMU_config() .
void ICM20648_registerRead | ( | uint16_t |
addr,
|
int |
numBytes,
|
||
uint8_t * |
data
|
||
) |
Reads register from the ICM20648 device.
- Parameters
-
[in] addr
The register address to read from in the sensor Bit[8:7] - bank address Bit[6:0] - register address [in] numBytes
The number of bytes to read [out] data
The data read from the register
- Returns
- None
Definition at line
1259
of file
icm20648.c
.
References ICM20648_bankSelect() , USART_Rx() , and USART_Tx() .
Referenced by ICM20648_accelBandwidthSet() , ICM20648_accelDataRead() , ICM20648_accelFullscaleSet() , ICM20648_accelGyroCalibrate() , ICM20648_accelResolutionGet() , ICM20648_getDeviceID() , ICM20648_gyroBandwidthSet() , ICM20648_gyroCalibrate() , ICM20648_gyroDataRead() , ICM20648_gyroFullscaleSet() , ICM20648_gyroResolutionGet() , ICM20648_init() , ICM20648_interruptStatusRead() , ICM20648_isDataReady() , ICM20648_lowPowerModeEnter() , ICM20648_sensorEnable() , ICM20648_sleepModeEnable() , and ICM20648_temperatureRead() .
void ICM20648_registerWrite | ( | uint16_t |
addr,
|
uint8_t |
data
|
||
) |
Writes a register in the ICM20648 device.
- Parameters
-
[in] addr
The register address to write Bit[8:7] - bank address Bit[6:0] - register address [in] data
The data to write to the register
- Returns
- None
Definition at line
1302
of file
icm20648.c
.
References ICM20648_bankSelect() , USART_Rx() , and USART_Tx() .
Referenced by ICM20648_accelBandwidthSet() , ICM20648_accelFullscaleSet() , ICM20648_accelGyroCalibrate() , ICM20648_accelSampleRateSet() , ICM20648_cycleModeEnable() , ICM20648_gyroBandwidthSet() , ICM20648_gyroCalibrate() , ICM20648_gyroFullscaleSet() , ICM20648_gyroSampleRateSet() , ICM20648_init() , ICM20648_interruptEnable() , ICM20648_lowPowerModeEnter() , ICM20648_reset() , ICM20648_sensorEnable() , ICM20648_sleepModeEnable() , and ICM20648_wakeOnMotionITEnable() .
uint32_t ICM20648_reset | ( | void |
|
) |
Performs soft reset on the ICM20648 chip.
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
129
of file
icm20648.c
.
References ICM20648_BIT_H_RESET , ICM20648_OK , ICM20648_REG_PWR_MGMT_1 , ICM20648_registerWrite() , and UTIL_delay() .
Referenced by ICM20648_init() .
uint32_t ICM20648_sampleRateSet | ( | float |
sampleRate
|
) |
Sets the sample rate both of the accelerometer and the gyroscope.
- Parameters
-
[in] sampleRate
The desired sample rate in Hz. Since the resolution of the sample rate divider is different in the accel and gyro stages it is possible that the two sensor will have different sample rate set.
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
352
of file
icm20648.c
.
References ICM20648_accelSampleRateSet() , ICM20648_gyroSampleRateSet() , and ICM20648_OK .
Referenced by ICM20648_accelGyroCalibrate() , ICM20648_gyroCalibrate() , and ICM20648_wakeOnMotionITEnable() .
uint32_t ICM20648_sensorEnable | ( | bool |
accel,
|
bool |
gyro,
|
||
bool |
temp
|
||
) |
Enables or disables the sensors in the ICM20648 chip.
- Parameters
-
[in] accel
If true enables the acceleration sensor [in] gyro
If true enables the gyroscope sensor [in] temp
If true enables the temperature sensor
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
562
of file
icm20648.c
.
References ICM20648_BIT_PWR_ACCEL_STBY , ICM20648_BIT_PWR_GYRO_STBY , ICM20648_BIT_TEMP_DIS , ICM20648_OK , ICM20648_REG_PWR_MGMT_1 , ICM20648_REG_PWR_MGMT_2 , ICM20648_registerRead() , and ICM20648_registerWrite() .
Referenced by ICM20648_accelGyroCalibrate() , ICM20648_gyroCalibrate() , ICM20648_lowPowerModeEnter() , ICM20648_wakeOnMotionITEnable() , and IMU_config() .
uint32_t ICM20648_sleepModeEnable | ( | bool |
enable
|
) |
Enables or disables the sleep mode of the device.
- Parameters
-
[in] enable
If true, sleep mode is enabled. Set to false to disable sleep mode.
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
501
of file
icm20648.c
.
References ICM20648_BIT_SLEEP , ICM20648_OK , ICM20648_REG_PWR_MGMT_1 , ICM20648_registerRead() , and ICM20648_registerWrite() .
Referenced by ICM20648_lowPowerModeEnter() , and ICM20648_wakeOnMotionITEnable() .
uint32_t ICM20648_spiInit | ( | void |
|
) |
Initializes the SPI bus in order to communicate with the ICM20648.
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
1210
of file
icm20648.c
.
References CMU_ClockEnable() , cmuClock_GPIO , GPIO_PinModeSet() , gpioModeInput , gpioModePushPull , ICM20648_OK , USART_InitSync() , and USART_Reset() .
Referenced by ICM20648_init() .
uint32_t ICM20648_temperatureRead | ( | float * |
temperature
|
) |
Reads the temperature sensor raw value and converts to Celsius.
- Parameters
-
[out] temperature
The mesured temperature in Celsius
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
1169
of file
icm20648.c
.
References ICM20648_OK , ICM20648_REG_TEMPERATURE_H , and ICM20648_registerRead() .
uint32_t ICM20648_wakeOnMotionITEnable | ( | bool |
enable,
|
uint8_t |
womThreshold,
|
||
float |
sampleRate
|
||
) |
Sets up and enables the Wake-up On Motion feature.
- Parameters
-
[in] enable
If true enables the WOM feature, disables otherwise [in] womThreshold
Threshold value for the Wake on Motion Interrupt for ACCEL x/y/z axes. LSB = 4mg. Range is 0mg to 1020mg [in] sampleRate
The desired sample rate of the accel sensor in Hz
- Returns
- Returns zero on OK, non-zero otherwise
Definition at line
753
of file
icm20648.c
.
References ICM20648_ACCEL_BW_1210HZ , ICM20648_ACCEL_FULLSCALE_2G , ICM20648_accelBandwidthSet() , ICM20648_accelFullscaleSet() , ICM20648_BIT_ACCEL_INTEL_EN , ICM20648_BIT_ACCEL_INTEL_MODE , ICM20648_cycleModeEnable() , ICM20648_interruptEnable() , ICM20648_lowPowerModeEnter() , ICM20648_OK , ICM20648_REG_ACCEL_INTEL_CTRL , ICM20648_REG_ACCEL_WOM_THR , ICM20648_registerWrite() , ICM20648_sampleRateSet() , ICM20648_sensorEnable() , ICM20648_sleepModeEnable() , and UTIL_delay() .