DevLab_ICM20948 1.0.0
ICM-20948 9-Axis Motion Sensor Driver
Loading...
Searching...
No Matches
DevLab_ICM20948 Class Reference

#include <DevLab_ICM20948.h>

Public Member Functions

 DevLab_ICM20948 ()
 
bool beginI2C (uint8_t address=0x69, TwoWire &i2cPort=Wire, uint32_t i2cSpeed=400000)
 
bool beginSPI (uint8_t csPin, SPIClass &spiPort=SPI, uint32_t spiSpeed=1000000)
 
bool readWhoAmI (uint8_t &whoAmI)
 
bool selectBank (uint8_t bank)
 
bool softReset ()
 
bool sleep (bool en)
 
bool applyBasicDefaults ()
 
bool readAccel (float &x, float &y, float &z)
 
bool readGyro (float &x, float &y, float &z)
 
bool readTemperature (float &temperature)
 
bool readMag (float &x, float &y, float &z)
 
bool initMag ()
 
bool setMagOpMode (ICM20948_Op_Mode opMode)
 
bool setLowPower (bool enable)
 
bool getLowPower (bool &enable)
 
bool setClock (ICM20948_Clock_Source clock)
 
bool getClock (uint8_t &clock)
 
bool setGyroSampleRate (float sampleRate)
 
bool getGyroSampleRate (float &sampleRate)
 
bool setGyroDivRate (uint8_t divisor)
 
bool setDLPF (ICM20948_Gyro_DLPF dlpf, bool bypass)
 
bool getDLPF (uint8_t &dlpf, bool &bypass)
 
bool setGyroScale (ICM20948_Gyro_FullScale fullScale)
 
bool setGyroAveraging (ICM20948_Gyro_Average avg)
 
bool getGyroScale (uint8_t &fullScale)
 
bool selfTestGyro (bool x, bool y, bool z)
 
bool setAccelDivRate (uint16_t divisor)
 
bool setAccelSampleRate (uint16_t sampleRate)
 
bool getAccelSampleRate (float &sampleRate)
 
bool selfTestAccel (bool x, bool y, bool z)
 
bool setAccelScale (ICM20948_Accel_FullScale fullScale)
 
bool getAccelScale (uint8_t &fullScale)
 
bool setAccelDLPF (uint8_t dlpf, bool bypass)
 
bool getAccelDLPF (uint8_t &dlpf, bool &bypass)
 
bool setAccelAveraging (ICM20948_Accel_Average avg)
 
bool getAccelAveraging (uint8_t &avg)
 
bool setSensors (bool accel_on, bool gyro_on, bool temp_on)
 
bool getSensors (bool &accel_on, bool &gyro_on, bool &temp_on)
 
bool setGyroOffset (uint16_t offsetX, uint16_t offsetY, uint16_t offsetZ)
 
bool getGyroOffset (int16_t &offsetX, int16_t &offsetY, int16_t &offsetZ)
 
bool setAccelOffset (int16_t offsetX, int16_t offsetY, int16_t offsetZ)
 
bool getAccelOffset (int16_t &offsetX, int16_t &offsetY, int16_t &offsetZ)
 
bool intInit (const ICM20948_IntPinConfig &cfg)
 
bool intEnableConfig (const ICM20948_IntEnableConfig &cfg)
 
bool checkIntStatus (ICM20948_IntStatus &status)
 
bool auxMasterEnable (uint8_t clkFreq)
 
bool auxWriteByte (uint8_t slaveAddr, uint8_t reg, uint8_t data)
 
bool auxReadByte (uint8_t slaveAddr, uint8_t reg, uint8_t &data)
 
bool auxWriteCommand (uint8_t slaveAddr, uint8_t cmd)
 
bool auxConfigSlave (uint8_t slaveAddr, uint8_t reg, uint8_t numBytes)
 
bool auxReadSensorData (uint8_t *buf, uint8_t len)
 
bool auxReadResponse (uint8_t slaveAddr, uint8_t &data)
 
bool auxRead12bit (uint16_t &raw)
 

Detailed Description

Class

  • Manages ICM-20948 over I2C (SPI path disabled in this cut)
  • Caches scale factors for LSB->physical conversions

Definition at line 172 of file DevLab_ICM20948.h.

Constructor & Destructor Documentation

◆ DevLab_ICM20948()

DevLab_ICM20948::DevLab_ICM20948 ( )
  • Construct with default I2C address; call begin() to attach bus

Definition at line 4 of file DevLab_ICM20948.cpp.

Member Function Documentation

◆ applyBasicDefaults()

bool DevLab_ICM20948::applyBasicDefaults ( )

applyBasicDefaults

  • Apply basic sensor configuration
  • Configure power, filters, ranges, and sampling rates

Returns:

  • true → Configuration successful
  • false → Any register write failed

Definition at line 181 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ auxConfigSlave()

bool DevLab_ICM20948::auxConfigSlave ( uint8_t  slaveAddr,
uint8_t  reg,
uint8_t  numBytes 
)

auxConfigSlave

  • Configure SLV0 for automatic periodic reads from an auxiliary I2C slave
  • The ICM20948 master will read numBytes starting at reg on every ODR cycle
  • Data is deposited into EXT_SLV_SENS_DATA_00 and subsequent registers
  • Call once during initialization; read results with auxReadSensorData

Parameters:

  • slaveAddr: 7-bit I2C address of the auxiliary slave
  • reg: starting register address to read from on the slave
  • numBytes: number of bytes to read per cycle (1–15)

Returns:

  • true → SLV0 configured successfully
  • false → Operation failed

Definition at line 1374 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ auxMasterEnable()

bool DevLab_ICM20948::auxMasterEnable ( uint8_t  clkFreq)

auxMasterEnable

  • Enable the ICM20948 internal I2C master for auxiliary bus
  • Clears BYPASS_EN so the aux bus is controlled by the ICM
  • Sets I2C_MST_EN in USER_CTRL
  • Configures auxiliary master clock frequency

Parameters:

  • clkFreq: clock divider value (e.g. 0x07 ≈ 345.6 kHz, 0x0D ≈ 400 kHz)

Returns:

  • true → Master enabled successfully
  • false → Operation failed

Definition at line 1260 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ auxRead12bit()

bool DevLab_ICM20948::auxRead12bit ( uint16_t &  raw)

auxRead12bit

  • Read a 12-bit value previously configured via auxConfigSlave (SLV0, numBytes = 2)
  • Assumes little-endian packing: first byte = LSB, second byte = MSB
  • Result is masked to 12 bits (0-4095)

Returns:

  • true → Read successful
  • false → Read failed

Definition at line 1424 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ auxReadByte()

bool DevLab_ICM20948::auxReadByte ( uint8_t  slaveAddr,
uint8_t  reg,
uint8_t &  data 
)

auxReadByte

  • Read a single byte from a register of an auxiliary I2C slave via SLV4
  • Generates a combined write-then-read transaction (reg byte + repeated START)
  • Suitable for slaves that follow standard I2C register-read protocol

Note: slaves that need separate write/read transactions (e.g. command-response firmware) should use auxWriteCommand + auxReadResponse instead.

Parameters:

  • slaveAddr: 7-bit I2C address of the auxiliary slave
  • reg: register address to read from
  • data: output byte received from slave

Returns:

  • true → Read successful
  • false → Timeout or NACK

Definition at line 1312 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ auxReadResponse()

bool DevLab_ICM20948::auxReadResponse ( uint8_t  slaveAddr,
uint8_t &  data 
)

auxReadResponse

  • Read a single response byte from an auxiliary I2C slave via SLV4
  • Generates a pure read transaction: [START, addr+R, 1 byte, STOP]
  • No register byte is sent (REG_DIS); slave must already be ready to transmit
  • Use after auxWriteCommand to complete a command-response exchange with slaves that require separate write and read transactions (e.g. PY32F0 firmware slaves)

Parameters:

  • slaveAddr: 7-bit I2C address of the auxiliary slave
  • data: output byte received from slave

Returns:

  • true → Response received successfully
  • false → Timeout or NACK

Definition at line 1397 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ auxReadSensorData()

bool DevLab_ICM20948::auxReadSensorData ( uint8_t *  buf,
uint8_t  len 
)

auxReadSensorData

  • Read bytes from EXT_SLV_SENS_DATA registers (BANK 0)
  • Returns data collected by the ICM20948 master from SLV0–SLV3 on the last cycle
  • Must call auxConfigSlave first to set up the automatic read

Parameters:

  • buf: output buffer to store the received bytes
  • len: number of bytes to read (must match numBytes configured in auxConfigSlave)

Returns:

  • true → Read successful
  • false → Bus error

Definition at line 1391 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ auxWriteByte()

bool DevLab_ICM20948::auxWriteByte ( uint8_t  slaveAddr,
uint8_t  reg,
uint8_t  data 
)

auxWriteByte

  • Write a single byte to a register of an auxiliary I2C slave via SLV4
  • Uses one-shot SLV4 transaction: polls SLV4_DONE, checks for NACK
  • Suitable for configuration writes (not continuous streaming)

Parameters:

  • slaveAddr: 7-bit I2C address of the auxiliary slave
  • reg: target register address on the slave
  • data: byte to write

Returns:

  • true → Write acknowledged by slave
  • false → Timeout or NACK

Definition at line 1281 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ auxWriteCommand()

bool DevLab_ICM20948::auxWriteCommand ( uint8_t  slaveAddr,
uint8_t  cmd 
)

auxWriteCommand

  • Send a single command byte to an auxiliary I2C slave via SLV4
  • Uses REG_DIS: generates [START, addr+W, cmd_byte, STOP] with no register prefix
  • Designed for slaves that use a command-response protocol (no register addressing)

Parameters:

  • slaveAddr: 7-bit I2C address of the auxiliary slave
  • cmd: command byte to send

Returns:

  • true → Command acknowledged by slave
  • false → Timeout or NACK

Definition at line 1346 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ beginI2C()

bool DevLab_ICM20948::beginI2C ( uint8_t  address = 0x69,
TwoWire &  i2cPort = Wire,
uint32_t  i2cSpeed = 400000 
)

beginI2C

  • Initialize ICM20948 using I2C interface
  • Sets up communication layer (Interface + BusIO)
  • Verifies device identity (WHO_AM_I)
  • Configures basic power and clock settings

Returns:

  • true → Device initialized successfully
  • false → Communication or configuration failed

Definition at line 6 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ beginSPI()

bool DevLab_ICM20948::beginSPI ( uint8_t  csPin,
SPIClass &  spiPort = SPI,
uint32_t  spiSpeed = 1000000 
)

Definition at line 60 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ checkIntStatus()

bool DevLab_ICM20948::checkIntStatus ( ICM20948_IntStatus status)

checkIntStatus

  • Read and parse all four interrupt status registers in a single burst read
  • Covers INT_STATUS (0x19), INT_STATUS_1 (0x1A), INT_STATUS_2 (0x1B), INT_STATUS_3 (0x1C) from BANK 0
  • Reading clears the interrupt flags when clearMode = 0 in ICM20948_IntPinConfig
  • Typically called inside the INT pin ISR or polled in the main loop

Parameters:

Returns:

  • true → Status read successfully
  • false → Operation failed

Definition at line 1231 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ getAccelAveraging()

bool DevLab_ICM20948::getAccelAveraging ( uint8_t &  avg)

getAccelAveraging

  • Read accelerometer averaging / decimation setting (DEC3)

Flow:

  • Validate bus pointer
  • Select USER BANK 2
  • Read DEC3 bits [1:0]

Returns:

  • true → Read successful
  • false → Operation failed

Definition at line 988 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ getAccelDLPF()

bool DevLab_ICM20948::getAccelDLPF ( uint8_t &  dlpf,
bool &  bypass 
)

getAccelDLPF

  • Read accelerometer DLPF configuration
  • Returns filter setting and bypass state

Flow:

  • Validate bus pointer
  • Select USER BANK 2
  • Read ACCEL_CONFIG register
  • Extract bypass and DLPF bits

Returns:

  • true → Read successful
  • false → Operation failed

Definition at line 926 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ getAccelOffset()

bool DevLab_ICM20948::getAccelOffset ( int16_t &  offsetX,
int16_t &  offsetY,
int16_t &  offsetZ 
)

getAccelOffset

  • Read accelerometer offset values for X, Y, Z axes
  • Reads offset registers from USER BANK 1

Flow:

  • Validate bus pointer
  • Select USER BANK 1
  • Read offset registers
  • Convert to signed values

Returns:

  • true → Read successful
  • false → Operation failed

Definition at line 1151 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ getAccelSampleRate()

bool DevLab_ICM20948::getAccelSampleRate ( float &  sampleRate)

getAccelSampleRate

  • Get accelerometer output data rate (ODR)
  • Computes value from divider registers

Returns:

  • true → Read successful
  • false → Operation failed

Definition at line 796 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ getAccelScale()

bool DevLab_ICM20948::getAccelScale ( uint8_t &  fullScale)

getAccelScale

  • Get current accelerometer full-scale range (FS_SEL)

Returns:

  • true → Read successful
  • false → Operation failed

Definition at line 878 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ getClock()

bool DevLab_ICM20948::getClock ( uint8_t &  clock)

getClock

  • Read current clock source (CLKSEL [2:0])

Returns:

  • true → Read successful
  • false → Operation failed

Definition at line 534 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ getDLPF()

bool DevLab_ICM20948::getDLPF ( uint8_t &  dlpf,
bool &  bypass 
)

getDLPF

  • Read gyroscope DLPF configuration
  • Returns filter setting and bypass state

Returns:

  • true → Read successful
  • false → Operation failed

Definition at line 619 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ getGyroOffset()

bool DevLab_ICM20948::getGyroOffset ( int16_t &  offsetX,
int16_t &  offsetY,
int16_t &  offsetZ 
)

getGyroOffset

  • Read gyroscope offset values for X, Y, Z axes
  • Reads offset registers from USER BANK 2

Flow:

  • Validate bus pointer
  • Select USER BANK 2
  • Read offset registers
  • Convert to signed values

Returns:

  • true → Read successful
  • false → Operation failed

Definition at line 1099 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ getGyroSampleRate()

bool DevLab_ICM20948::getGyroSampleRate ( float &  sampleRate)

getGyroSampleRate

  • Get current gyroscope sample rate
  • Computes value from divider register

Returns:

  • true → Read successful
  • false → Operation failed

Definition at line 571 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ getGyroScale()

bool DevLab_ICM20948::getGyroScale ( uint8_t &  fullScale)

getGyroScale

  • Get current gyroscope full-scale range (FS_SEL

Returns:

  • true → Read successful
  • false → Operation failed

Definition at line 665 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ getLowPower()

bool DevLab_ICM20948::getLowPower ( bool &  enable)

getLowPower

  • Read low power mode status
  • Returns state of LP_EN bit

Returns:

  • true → Read successful
  • false → Operation failed

Definition at line 502 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ getSensors()

bool DevLab_ICM20948::getSensors ( bool &  accel_on,
bool &  gyro_on,
bool &  temp_on 
)

getSensors

  • Read accel, gyro, and temperature enable state

Flow:

  • Validate bus pointer
  • Select USER BANK 0
  • Read PWR_MGMT_2 register
  • Read TEMP_DIS bit
  • Decode enable states

Returns:

  • true → Read successful
  • false → Operation failed

Definition at line 1039 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ initMag()

bool DevLab_ICM20948::initMag ( )

initMag

  • Initialize AK09916 magnetometer using internal I2C master
  • Verifies WHO_AM_I and enables continuous mode
  • Configures SLV0 for automatic data read

Returns:

  • true → Initialization successful
  • false → Operation failed

Definition at line 334 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ intEnableConfig()

bool DevLab_ICM20948::intEnableConfig ( const ICM20948_IntEnableConfig cfg)

intEnableConfig

  • Enable or disable individual interrupt sources routed to the INT pin
  • Writes INT_ENABLE (0x10), INT_ENABLE_1 (0x11), INT_ENABLE_2 (0x12), and INT_ENABLE_3 (0x13) in BANK 0
  • Must call intInit() first to configure the pin electrical behavior

Parameters:

Returns:

  • true → All four registers written successfully
  • false → Operation failed

Definition at line 1200 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ intInit()

bool DevLab_ICM20948::intInit ( const ICM20948_IntPinConfig cfg)

intInit

  • Configure the physical behavior of the INT pin (INT_PIN_CFG register, BANK 0)
  • Sets active level, drive mode (push-pull / open-drain), latch vs pulse mode, clear condition, FSYNC level, FSYNC interrupt enable, and I2C bypass

Parameters:

Returns:

  • true → Configuration written successfully
  • false → Operation failed

Definition at line 1176 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ readAccel()

bool DevLab_ICM20948::readAccel ( float &  x,
float &  y,
float &  z 
)

readAccel

  • Read accelerometer data (X, Y, Z)
  • Convert raw values to g using LSB scale

Returns:

  • true → Read successful
  • false → Read failed

Definition at line 238 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ readGyro()

bool DevLab_ICM20948::readGyro ( float &  x,
float &  y,
float &  z 
)

readGyro

  • Read gyroscope data (X, Y, Z)
  • Convert raw values to dps using LSB scale

Returns:

  • true → Read successful
  • false → Read failed

Definition at line 258 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ readMag()

bool DevLab_ICM20948::readMag ( float &  x,
float &  y,
float &  z 
)

readMag

  • Read magnetometer data via internal I2C master
  • Data comes from EXT_SLV_SENS_DATA registers
  • Convert raw values to µT

Returns:

  • true → Read successful
  • false → Read failed

Definition at line 310 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ readTemperature()

bool DevLab_ICM20948::readTemperature ( float &  temperature)

readTemperature

  • Read temperature sensor
  • Convert raw values to °C

Returns:

  • true → Read successful
  • false → Read failed

Definition at line 278 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ readWhoAmI()

bool DevLab_ICM20948::readWhoAmI ( uint8_t &  whoAmI)

readWhoAmI

  • Read WHO_AM_I register (device ID)
  • Used during initialization to verify ICM20948
  • Expected value: 0xEA

Returns:

  • true → Read successful
  • false → Operation failed

Definition at line 118 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ selectBank()

bool DevLab_ICM20948::selectBank ( uint8_t  bank)

selectBank

  • Select USER BANK (0–3)
  • Used to access different register groups inside ICM20948

Returns:

  • true → Bank switch successful
  • false → Write failed

Definition at line 132 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ selfTestAccel()

bool DevLab_ICM20948::selfTestAccel ( bool  x,
bool  y,
bool  z 
)

selfTestAccel

  • Enable or disable accelerometer self-test per axis

Returns:

  • true → Operation successful
  • false → Operation failed

Definition at line 826 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ selfTestGyro()

bool DevLab_ICM20948::selfTestGyro ( bool  x,
bool  y,
bool  z 
)

selfTestGyro

  • Enable or disable gyroscope self-test per axis

Returns:

  • true → Operation successful
  • false → Operation failed

Definition at line 683 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ setAccelAveraging()

bool DevLab_ICM20948::setAccelAveraging ( ICM20948_Accel_Average  avg)

setAccelAveraging

  • Configure accelerometer averaging / decimation (DEC3)
  • Controls internal averaging of accel samples

Flow:

  • Validate bus pointer
  • Select USER BANK 2
  • Write DEC3 bits [1:0]

Returns:

  • true → Operation successful
  • false → Operation failed

Definition at line 952 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ setAccelDivRate()

bool DevLab_ICM20948::setAccelDivRate ( uint16_t  divisor)

Definition at line 748 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ setAccelDLPF()

bool DevLab_ICM20948::setAccelDLPF ( uint8_t  dlpf,
bool  bypass 
)

setAccelDLPF

  • Configure accelerometer digital low-pass filter (DLPF)
  • Option to bypass filter (full bandwidth)

Flow:

  • Validate bus pointer
  • Select USER BANK 2
  • Set or clear bypass bit
  • Configure DLPF bits if not bypassed

Returns:

  • true → Operation successful
  • false → Operation failed

Definition at line 897 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ setAccelOffset()

bool DevLab_ICM20948::setAccelOffset ( int16_t  offsetX,
int16_t  offsetY,
int16_t  offsetZ 
)

setAccelOffset

  • Set accelerometer offset values for X, Y, Z axes
  • Writes offset registers in USER BANK 1

Flow:

  • Validate bus pointer
  • Select USER BANK 1
  • Pack offsets into byte array
  • Write to offset registers

Returns:

  • true → Operation successful
  • false → Operation failed

Definition at line 1124 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ setAccelSampleRate()

bool DevLab_ICM20948::setAccelSampleRate ( uint16_t  sampleRate)

setAccelSampleRate

  • Set accelerometer output data rate (ODR)
  • Uses 1125 Hz base rate with 12-bit divider

Returns:

  • true → Operation successful
  • false → Operation failed

Definition at line 709 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ setAccelScale()

bool DevLab_ICM20948::setAccelScale ( ICM20948_Accel_FullScale  fullScale)

setAccelScale

  • Set accelerometer full-scale range (FS_SEL)
  • Controls measurement range (±2g, ±4g, ±8g, ±16g)

Returns:

  • true → Operation successful
  • false → Operation failed

Definition at line 857 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ setClock()

bool DevLab_ICM20948::setClock ( ICM20948_Clock_Source  clock)

setClock

  • Set clock source (CLKSEL [2:0])
  • Selects internal clock for sensor operation

Returns:

  • true → Operation successful
  • false → Operation failed

Definition at line 520 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ setDLPF()

bool DevLab_ICM20948::setDLPF ( ICM20948_Gyro_DLPF  dlpf,
bool  bypass 
)

setDLPF

  • Configure gyroscope digital low-pass filter (DLPF)
  • Option to bypass filter (full bandwidth)

Returns:

  • true → Operation successful
  • false → Operation failed

Definition at line 593 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ setGyroAveraging()

bool DevLab_ICM20948::setGyroAveraging ( ICM20948_Gyro_Average  avg)

Definition at line 970 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ setGyroDivRate()

bool DevLab_ICM20948::setGyroDivRate ( uint8_t  divisor)

Definition at line 780 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ setGyroOffset()

bool DevLab_ICM20948::setGyroOffset ( uint16_t  offsetX,
uint16_t  offsetY,
uint16_t  offsetZ 
)

setGyroOffset

  • Set gyroscope offset values for X, Y, Z axes
  • Writes offset registers in USER BANK 2

Flow:

  • Validate bus pointer
  • Select USER BANK 2
  • Pack offsets into byte array
  • Write to offset registers

Returns:

  • true → Operation successful
  • false → Operation failed

Definition at line 1072 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ setGyroSampleRate()

bool DevLab_ICM20948::setGyroSampleRate ( float  sampleRate)

setGyroSampleRate

  • Set gyroscope sample rate
  • Uses internal divider (SRD) based on 1100 Hz base rate

Returns:

  • true → Operation successful
  • false → Invalid input or write failed

Definition at line 550 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ setGyroScale()

bool DevLab_ICM20948::setGyroScale ( ICM20948_Gyro_FullScale  fullScale)

setGyroScale

  • Set gyroscope full-scale range (FS_SEL)
  • Controls sensitivity (dps range)

Flow:

  • Validate bus pointer
  • Select USER BANK 2
  • Write FS_SEL bits [2:1]

Returns:

  • true → Operation successful
  • false → Operation failed

Definition at line 644 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ setLowPower()

bool DevLab_ICM20948::setLowPower ( bool  enable)

setLowPower

  • Enable or disable low power mode
  • Controls LP_EN bit in PWR_MGMT_1

Returns:

  • true → Operation successful
  • false → Operation failed

Definition at line 488 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ setMagOpMode()

bool DevLab_ICM20948::setMagOpMode ( ICM20948_Op_Mode  opMode)

setMagOpMode

  • Set magnetometer operation mode

Returns:

  • true → Mode set successfully
  • false → Write failed

Definition at line 410 of file DevLab_ICM20948.cpp.

◆ setSensors()

bool DevLab_ICM20948::setSensors ( bool  accel_on,
bool  gyro_on,
bool  temp_on 
)

setSensors

  • Enable or disable accel, gyro, and temperature sensor
  • Controls power gating via PWR_MGMT_2 and TEMP_DIS

Flow:

  • Validate bus pointer
  • Select USER BANK 0
  • Build PWR_MGMT_2 mask
  • Configure temperature enable/disable

Returns:

  • true → Operation successful
  • false → Operation failed

Definition at line 1006 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:

◆ sleep()

bool DevLab_ICM20948::sleep ( bool  en)

sleep

  • Enable or disable sleep mode
  • Maintains clock source (CLKSEL = 1)

Flow:

  • Select USER BANK 0
  • Set or clear SLEEP bit

Returns:

  • true → Operation successful
  • false → Operation failed

Definition at line 164 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ softReset()

bool DevLab_ICM20948::softReset ( )

softReset

  • Perform software reset of ICM20948
  • Resets all internal registers to default state

Flow:

  • Select USER BANK 0
  • Set DEVICE_RESET bit
  • Wait for device to restart

Returns:

  • true → Reset successful
  • false → Operation failed

Definition at line 144 of file DevLab_ICM20948.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

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