Adafruit ICM20X Sensor Library
|
Class that stores state and functions for interacting with the ST ICM2948 9-DoF Accelerometer, gyro, and magnetometer. More...
#include <Adafruit_ICM20948.h>
Public Member Functions | |
Adafruit_ICM20948 () | |
Instantiates a new ICM20948 class! | |
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. More... | |
icm20948_accel_range_t | getAccelRange (void) |
Get the accelerometer's measurement range. More... | |
void | setAccelRange (icm20948_accel_range_t new_accel_range) |
Sets the accelerometer's measurement range. More... | |
icm20948_gyro_range_t | getGyroRange (void) |
Get the gyro's measurement range. More... | |
void | setGyroRange (icm20948_gyro_range_t new_gyro_range) |
Sets the gyro's measurement range. More... | |
ak09916_data_rate_t | getMagDataRate (void) |
Get the current magnetometer measurement rate. More... | |
bool | setMagDataRate (ak09916_data_rate_t rate) |
Set the magnetometer measurement rate. More... | |
Public Member Functions inherited from Adafruit_ICM20X | |
Adafruit_ICM20X () | |
Instantiates a new ICM20X class! | |
~Adafruit_ICM20X () | |
Cleans up the ICM20X. | |
bool | begin_SPI (uint8_t cs_pin, SPIClass *theSPI=&SPI, int32_t sensor_id=0) |
Sets up the hardware and initializes hardware SPI. More... | |
bool | begin_SPI (int8_t cs_pin, int8_t sck_pin, int8_t miso_pin, int8_t mosi_pin, int32_t sensor_id=0) |
Sets up the hardware and initializes software SPI. More... | |
uint8_t | getGyroRateDivisor (void) |
Get the gyro's data rate divisor. More... | |
void | setGyroRateDivisor (uint8_t new_gyro_divisor) |
Sets the gyro's data rate divisor. More... | |
uint16_t | getAccelRateDivisor (void) |
Get the accelerometer's data rate divisor. More... | |
void | setAccelRateDivisor (uint16_t new_accel_divisor) |
Sets the accelerometer's data rate divisor. More... | |
bool | enableAccelDLPF (bool enable, icm20x_accel_cutoff_t cutoff_freq) |
Enable or disable the accelerometer's Digital Low Pass Filter. More... | |
bool | enableGyrolDLPF (bool enable, icm20x_gyro_cutoff_t cutoff_freq) |
Enable or disable the gyro's Digital Low Pass Filter. More... | |
void | reset (void) |
Reset the internal registers and restores the default settings. | |
void | setInt1ActiveLow (bool active_low) |
Sets the polarity of the int1 pin. More... | |
void | setInt2ActiveLow (bool active_low) |
Sets the polarity of the INT2 pin. More... | |
Adafruit_Sensor * | getAccelerometerSensor (void) |
Gets an Adafruit Unified Sensor object for the accelerometer sensor component. More... | |
Adafruit_Sensor * | getGyroSensor (void) |
Gets an Adafruit Unified Sensor object for the gyro sensor component. More... | |
Adafruit_Sensor * | getMagnetometerSensor (void) |
Gets an Adafruit Unified Sensor object for the magnetometer sensor component. More... | |
Adafruit_Sensor * | getTemperatureSensor (void) |
Gets an Adafruit Unified Sensor object for the temp sensor component. More... | |
bool | getEvent (sensors_event_t *accel, sensors_event_t *gyro, sensors_event_t *temp, sensors_event_t *mag=NULL) |
Gets the most recent sensor event, Adafruit Unified Sensor format. More... | |
uint8_t | readExternalRegister (uint8_t slv_addr, uint8_t reg_addr) |
Read a single byte from a given register address for an I2C slave device on the auxiliary I2C bus. More... | |
bool | writeExternalRegister (uint8_t slv_addr, uint8_t reg_addr, uint8_t value) |
Write a single byte to a given register address for an I2C slave device on the auxiliary I2C bus. More... | |
bool | configureI2CMaster (void) |
Set the I2C clock rate for the auxillary I2C bus to 345.60kHz and disable repeated start. More... | |
bool | enableI2CMaster (bool enable_i2c_master) |
Enable or disable the I2C mastercontroller. More... | |
void | resetI2CMaster (void) |
Reset the I2C master. | |
void | setI2CBypass (bool bypass_i2c) |
Sets the bypass status of the I2C master bus support. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Adafruit_ICM20X | |
void | _read (void) |
Updates the measurement data for all sensors simultaneously. | |
bool | _init (int32_t sensor_id) |
Initilizes the sensor. More... | |
void | _setBank (uint8_t bank_number) |
Sets register bank. More... | |
uint8_t | readAccelRange (void) |
Get the accelerometer's measurement range. More... | |
void | writeAccelRange (uint8_t new_accel_range) |
Sets the accelerometer's measurement range. More... | |
uint8_t | readGyroRange (void) |
Get the gyro's measurement range. More... | |
void | writeGyroRange (uint8_t new_gyro_range) |
Sets the gyro's measurement range. More... | |
Protected Attributes inherited from Adafruit_ICM20X | |
float | temperature |
Last reading's temperature (C) | |
float | accX |
Last reading's accelerometer X axis m/s^2. | |
float | accY |
Last reading's accelerometer Y axis m/s^2. | |
float | accZ |
Last reading's accelerometer Z axis m/s^2. | |
float | gyroX |
Last reading's gyro X axis in rad/s. | |
float | gyroY |
Last reading's gyro Y axis in rad/s. | |
float | gyroZ |
Last reading's gyro Z axis in rad/s. | |
float | magX |
Last reading's mag X axis in rad/s. | |
float | magY |
Last reading's mag Y axis in rad/s. | |
float | magZ |
Last reading's mag Z axis in rad/s. | |
Adafruit_I2CDevice * | i2c_dev = NULL |
Pointer to I2C bus interface. | |
Adafruit_SPIDevice * | spi_dev = NULL |
Pointer to SPI bus interface. | |
Adafruit_ICM20X_Accelerometer * | accel_sensor |
Accelerometer data object. More... | |
Adafruit_ICM20X_Gyro * | gyro_sensor = NULL |
Gyro data object. | |
Adafruit_ICM20X_Magnetometer * | mag_sensor |
Magnetometer sensor data object. More... | |
Adafruit_ICM20X_Temp * | temp_sensor = NULL |
Temp sensor data object. | |
uint16_t | _sensorid_accel |
ID number for accelerometer. | |
uint16_t | _sensorid_gyro |
ID number for gyro. | |
uint16_t | _sensorid_mag |
ID number for mag. | |
uint16_t | _sensorid_temp |
ID number for temperature. | |
int16_t | rawAccX |
temp variables | |
int16_t | rawAccY |
temp variables | |
int16_t | rawAccZ |
temp variables | |
int16_t | rawTemp |
temp variables | |
int16_t | rawGyroX |
temp variables | |
int16_t | rawGyroY |
temp variables | |
int16_t | rawGyroZ |
temp variables | |
int16_t | rawMagX |
temp variables | |
int16_t | rawMagY |
temp variables | |
int16_t | rawMagZ |
temp variables | |
uint8_t | current_accel_range |
accelerometer range cache | |
uint8_t | current_gyro_range |
gyro range cache | |
Class that stores state and functions for interacting with the ST ICM2948 9-DoF Accelerometer, gyro, and magnetometer.
|
virtual |
Sets up the hardware and initializes I2C.
i2c_address | The I2C address to be used. |
wire | The Wire object to be used for I2C connections. |
sensor_id | An optional parameter to set the sensor ids to differentiate similar sensors The passed value is assigned to the accelerometer and the gyro get +1 and the temperature sensor +2. |
Reimplemented from Adafruit_ICM20X.
icm20948_accel_range_t Adafruit_ICM20948::getAccelRange | ( | void | ) |
Get the accelerometer's measurement range.
icm20948_accel_range_t
). void Adafruit_ICM20948::setAccelRange | ( | icm20948_accel_range_t | new_accel_range | ) |
Sets the accelerometer's measurement range.
new_accel_range | Measurement range to be set. Must be an icm20948_accel_range_t . |
icm20948_gyro_range_t Adafruit_ICM20948::getGyroRange | ( | void | ) |
Get the gyro's measurement range.
icm20948_gyro_range_t
). void Adafruit_ICM20948::setGyroRange | ( | icm20948_gyro_range_t | new_gyro_range | ) |
Sets the gyro's measurement range.
new_gyro_range | Measurement range to be set. Must be an icm20948_gyro_range_t . |
ak09916_data_rate_t Adafruit_ICM20948::getMagDataRate | ( | void | ) |
Get the current magnetometer measurement rate.
bool Adafruit_ICM20948::setMagDataRate | ( | ak09916_data_rate_t | rate | ) |
Set the magnetometer measurement rate.
rate | The rate to set. |