10#ifndef ICM42670_DRIVER_H
11#define ICM42670_DRIVER_H
61 ICM42670_ACCEL_FS_16G = 0x00U,
62 ICM42670_ACCEL_FS_8G = 0x20U,
63 ICM42670_ACCEL_FS_4G = 0x40U,
64 ICM42670_ACCEL_FS_2G = 0x60U,
71 ICM42670_GYRO_FS_2000_DPS = 0x00U,
72 ICM42670_GYRO_FS_1000_DPS = 0x20U,
73 ICM42670_GYRO_FS_500_DPS = 0x40U,
74 ICM42670_GYRO_FS_250_DPS = 0x60U
81 ICM42670_ODR_1600_HZ = 0x05U,
82 ICM42670_ODR_800_HZ = 0x06U,
83 ICM42670_ODR_400_HZ = 0x07U,
84 ICM42670_ODR_200_HZ = 0x08U,
85 ICM42670_ODR_100_HZ = 0x09U,
86 ICM42670_ODR_50_HZ = 0x0AU,
87 ICM42670_ODR_25_HZ = 0x0BU,
88 ICM42670_ODR_12_5_HZ = 0x0CU,
89 ICM42670_ACCEL_ODR_6_25_HZ = 0x0DU,
90 ICM42670_ACCEL_ODR_3_125_HZ = 0x0EU,
91 ICM42670_ACCEL_ODR_1_5625_HZ = 0x0FU,
98 ICM42670_LPF_BYPASSED = 0x00U,
99 ICM42670_LPF_180_HZ = 0x01U,
100 ICM42670_LPF_121_HZ = 0x02U,
101 ICM42670_LPF_73_HZ = 0x03U,
102 ICM42670_LPF_53_HZ = 0x04U,
103 ICM42670_LPF_34_HZ = 0x05U,
104 ICM42670_LPF_25_HZ = 0x06U,
105 ICM42670_LPF_16_HZ = 0x07U,
182 int8_t (*read_reg)(
void *handle, uint8_t reg_addr, uint8_t *data,
185 int8_t (*write_reg)(
void *handle, uint8_t reg_addr,
const uint8_t *data,
187 void (*delay_ms)(uint32_t ms);
286 int16_t accel_raw[3]);
296 int16_t gyro_raw[3]);
ICM42670_Status_t ICM42670_SetPowerState(ICM42670_Config *config, ICM42670_PowerState_t state)
Switch the ICM-42670-P to one of the standard datasheet power modes.
Definition ICM42670_driver.c:144
ICM42670_Status_t ICM42670_ReadAccelRaw(const ICM42670_Config *config, int16_t accel_raw[3])
Read raw accelerometer counts.
Definition ICM42670_driver.c:288
ICM42670_Status_t ICM42670_SetGyroLpf(ICM42670_Config *config, ICM42670_Lpf_t lpf)
Set the gyroscope UI low-pass filter bandwidth.
Definition ICM42670_driver.c:230
ICM42670_Status_t ICM42670_ReadGyroRaw(const ICM42670_Config *config, int16_t gyro_raw[3])
Read raw gyroscope counts.
Definition ICM42670_driver.c:307
ICM42670_Status_t ICM42670_SetAccelRange(ICM42670_Config *config, ICM42670_AccelFS_t accel_fs)
Set the accelerometer full-scale range.
Definition ICM42670_driver.c:165
ICM42670_Status_t ICM42670_ReadTempRaw(const ICM42670_Config *config, int16_t *temp_raw)
Read the raw temperature register value.
Definition ICM42670_driver.c:326
ICM42670_Status_t ICM42670_ReadAccelG(const ICM42670_Config *config, ICM42670_Accel_t *accel)
Read accelerometer data converted to g.
Definition ICM42670_driver.c:343
ICM42670_GyroFS_t
Gyroscope full-scale range values for GYRO_CONFIG0.
Definition ICM42670_driver.h:70
ICM42670_AccelFS_t
Accelerometer full-scale range values for ACCEL_CONFIG0.
Definition ICM42670_driver.h:60
ICM42670_Status_t ICM42670_SetAccelLpf(ICM42670_Config *config, ICM42670_Lpf_t lpf)
Set the accelerometer UI low-pass filter bandwidth.
Definition ICM42670_driver.c:221
ICM42670_Status_t ICM42670_SetGyroRange(ICM42670_Config *config, ICM42670_GyroFS_t gyro_fs)
Set the gyroscope full-scale range.
Definition ICM42670_driver.c:179
ICM42670_Status_t ICM42670_ReadGyroDps(const ICM42670_Config *config, ICM42670_Gyro_t *gyro)
Read gyroscope data converted to degrees per second.
Definition ICM42670_driver.c:363
ICM42670_Status_t
Return codes used by the ICM-42670-P driver.
Definition ICM42670_driver.h:23
@ ICM42670_ERROR
Definition ICM42670_driver.h:25
@ ICM42670_OK
Definition ICM42670_driver.h:24
@ ICM42670_BUSY
Definition ICM42670_driver.h:26
ICM42670_Lpf_t
UI low-pass filter bandwidth selections.
Definition ICM42670_driver.h:97
ICM42670_Status_t ICM42670_Gyro_Calibration(ICM42670_Config *config)
Estimate gyroscope bias while the board is stationary.
Definition ICM42670_driver.c:402
ICM42670_Status_t ICM42670_SetAccelOdr(ICM42670_Config *config, ICM42670_Odr_t odr)
Set the accelerometer output data rate.
Definition ICM42670_driver.c:193
ICM42670_Odr_t
Output data rate values for accelerometer and gyroscope setup.
Definition ICM42670_driver.h:80
ICM42670_Status_t ICM42670_Init(ICM42670_Config *config)
Initialize the device and enter 6-axis low-noise mode.
Definition ICM42670_driver.c:239
ICM42670_PowerState_t
Standard PWR_MGMT0 power states exposed by the driver.
Definition ICM42670_driver.h:111
@ ICM42670_POWER_ACCEL_LP
Accelerometer low-power mode: gyro off, accel duty-cycled.
Definition ICM42670_driver.h:138
@ ICM42670_POWER_SLEEP
Sleep mode: gyro off, accel off.
Definition ICM42670_driver.h:118
@ ICM42670_POWER_6AXIS_LN
6-axis low-noise mode: gyro on, accel on.
Definition ICM42670_driver.h:162
@ ICM42670_POWER_GYRO_LN
Gyroscope low-noise mode: gyro on, accel off.
Definition ICM42670_driver.h:154
@ ICM42670_POWER_STANDBY
Standby mode: gyro drive on, accel off.
Definition ICM42670_driver.h:127
@ ICM42670_POWER_ACCEL_LN
Accelerometer low-noise mode: gyro off, accel on.
Definition ICM42670_driver.h:146
ICM42670_Status_t ICM42670_SetGyroOdr(ICM42670_Config *config, ICM42670_Odr_t odr)
Set the gyroscope output data rate.
Definition ICM42670_driver.c:207
ICM42670_Status_t ICM42670_ReadTempC(const ICM42670_Config *config, float *temp_c)
Read temperature converted to degrees Celsius.
Definition ICM42670_driver.c:386
Basic ICM-42670-P register addresses and field values.
Scaled accelerometer sample in g.
Definition ICM42670_driver.h:32
float z_g
Definition ICM42670_driver.h:35
float y_g
Definition ICM42670_driver.h:34
float x_g
Definition ICM42670_driver.h:33
Platform-independent driver configuration.
Definition ICM42670_driver.h:172
void * handle
Definition ICM42670_driver.h:181
ICM42670_AccelFS_t accel_fs
Definition ICM42670_driver.h:175
ICM42670_Odr_t gyro_odr
Definition ICM42670_driver.h:176
ICM42670_Gyro_Offsets_t gyro_offsets
Definition ICM42670_driver.h:179
ICM42670_GyroFS_t gyro_fs
Definition ICM42670_driver.h:177
ICM42670_Odr_t accel_odr
Definition ICM42670_driver.h:174
Raw gyroscope bias offsets subtracted by ICM42670_ReadGyroDps().
Definition ICM42670_driver.h:50
int16_t z_raw_offset
Definition ICM42670_driver.h:53
int16_t y_raw_offset
Definition ICM42670_driver.h:52
int16_t x_raw_offset
Definition ICM42670_driver.h:51
Scaled gyroscope sample in degrees per second.
Definition ICM42670_driver.h:41
float x_dps
Definition ICM42670_driver.h:42
float y_dps
Definition ICM42670_driver.h:43
float z_dps
Definition ICM42670_driver.h:44