Adafruit ICM20X Sensor Library
Public Member Functions | List of all members
Adafruit_ICM20649 Class Reference

Class that stores state and functions for interacting with the ST ICM20649 6-DoF Accelerometer and Gyro. More...

#include <Adafruit_ICM20649.h>

Inheritance diagram for Adafruit_ICM20649:
Adafruit_ICM20X

Public Member Functions

 Adafruit_ICM20649 ()
 Instantiates a new ICM20649 class!
 
bool begin_I2C (uint8_t i2c_addr=ICM20649_I2CADDR_DEFAULT, TwoWire *wire=&Wire, int32_t sensor_id=0)
 Sets up the hardware and initializes I2C. More...
 
icm20649_accel_range_t getAccelRange (void)
 Get the accelerometer's measurement range. More...
 
void setAccelRange (icm20649_accel_range_t new_accel_range)
 Sets the accelerometer's measurement range. More...
 
icm20649_gyro_range_t getGyroRange (void)
 Get the gyro's measurement range. More...
 
void setGyroRange (icm20649_gyro_range_t new_gyro_range)
 Sets the gyro's measurement range. 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_Accelerometeraccel_sensor
 Accelerometer data object. More...
 
Adafruit_ICM20X_Gyrogyro_sensor = NULL
 Gyro data object.
 
Adafruit_ICM20X_Magnetometermag_sensor
 Magnetometer sensor data object. More...
 
Adafruit_ICM20X_Temptemp_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
 

Detailed Description

Class that stores state and functions for interacting with the ST ICM20649 6-DoF Accelerometer and Gyro.

Member Function Documentation

◆ begin_I2C()

bool Adafruit_ICM20649::begin_I2C ( uint8_t  i2c_address = ICM20649_I2CADDR_DEFAULT,
TwoWire *  wire = &Wire,
int32_t  sensor_id = 0 
)
virtual

Sets up the hardware and initializes I2C.

Parameters
i2c_addressThe I2C address to be used.
wireThe Wire object to be used for I2C connections.
sensor_idAn 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.
Returns
True if initialization was successful, otherwise false.

Reimplemented from Adafruit_ICM20X.

◆ getAccelRange()

icm20649_accel_range_t Adafruit_ICM20649::getAccelRange ( void  )

Get the accelerometer's measurement range.

Returns
The accelerometer's measurement range (icm20649_accel_range_t).

◆ setAccelRange()

void Adafruit_ICM20649::setAccelRange ( icm20649_accel_range_t  new_accel_range)

Sets the accelerometer's measurement range.

Parameters
new_accel_rangeMeasurement range to be set. Must be an icm20649_accel_range_t.

◆ getGyroRange()

icm20649_gyro_range_t Adafruit_ICM20649::getGyroRange ( void  )

Get the gyro's measurement range.

Returns
The gyro's measurement range (icm20649_gyro_range_t).

◆ setGyroRange()

void Adafruit_ICM20649::setGyroRange ( icm20649_gyro_range_t  new_gyro_range)

Sets the gyro's measurement range.

Parameters
new_gyro_rangeMeasurement range to be set. Must be an icm20649_gyro_range_t.

The documentation for this class was generated from the following files: