A class for the TDK InvenSense ICM-42670 6-axis accelerometer + gyroscope. More...
#include <ICM42670.h>
Public Member Functions | |
| bool | begin () |
| Initialize the IMU. | |
| bool | enableAccelGyroLnMode (void) |
| Enable low-noise mode for both accelerometer and gyroscope. | |
| ICM42670 () | |
| Construct a new ICM42670 object Default constructor uses the default Wire I2C bus. You can also provide a custom TwoWire instance if needed. | |
| bool | readSensorData (float &ax, float &ay, float &az, float &gx, float &gy, float &gz, float &t) |
| Enable low-noise mode for both accelerometer and gyroscope. | |
| bool | reset () |
| Perform a soft reset of the IMU. | |
| bool | startAccel (uint16_t odr_hz, uint16_t fsr_g) |
| Start the accelerometer. | |
| bool | startGyro (uint16_t odr_hz, uint16_t fsr_dps) |
| Start the gyroscope. | |
| bool | startWithDefaultValues (void) |
| Start IMU with SDK default settings and enable LN mode. | |
A class for the TDK InvenSense ICM-42670 6-axis accelerometer + gyroscope.
Datasheet can be found at: https://invensense.tdk.com/wp-content/uploads/2021/07/DS-000451-ICM-42670-P-v1.0.pdf Functions are based on TKJHAT C SDK with minimal modifications to fit Arduino style and the class structure.
The IMU is connected on I2C at ICM42670_I2C_ADDRESS (0x69).
Recommended defaults
Modes
| bool ICM42670::begin | ( | ) |
Initialize the IMU.
Performs a soft reset and verifies device identity (WHO_AM_I).
| bool ICM42670::enableAccelGyroLnMode | ( | void | ) |
Enable low-noise mode for both accelerometer and gyroscope.
| bool ICM42670::readSensorData | ( | float & | ax, |
| float & | ay, | ||
| float & | az, | ||
| float & | gx, | ||
| float & | gy, | ||
| float & | gz, | ||
| float & | t ) |
Enable low-noise mode for both accelerometer and gyroscope.
| bool ICM42670::reset | ( | ) |
Perform a soft reset of the IMU.
This function sends the appropriate command to reset the device and waits for it to become ready again.
| bool ICM42670::startAccel | ( | uint16_t | odr_hz, |
| uint16_t | fsr_g ) |
Start the accelerometer.
Configures the accelerometer with the requested ODR and FSR.
| odr_hz | Desired output data rate in Hz (e.g., ICM42670_ACCEL_ODR_DEFAULT). |
| fsr_g | Full-scale range in g (2, 4, 8, 16; e.g., ICM42670_ACCEL_FSR_DEFAULT). |
| bool ICM42670::startGyro | ( | uint16_t | odr_hz, |
| uint16_t | fsr_dps ) |
Start the gyroscope.
Configures the gyroscope with the requested ODR and FSR.
| odr_hz | Desired output data rate in Hz (e.g., ICM42670_GYRO_ODR_DEFAULT). |
| fsr_dps | Full-scale range in degrees per second (250, 500, 1000, 2000; e.g., ICM42670_GYRO_FSR_DEFAULT). |
| bool ICM42670::startWithDefaultValues | ( | void | ) |
Start IMU with SDK default settings and enable LN mode.
Calls: