Class daisy::Icm20948¶
Device support for ICM20948 IMU sensor. More...
#include <icm20948.h>
Classes¶
Type | Name |
---|---|
struct | Config |
struct | Icm20948Vect |
Public Types¶
Type | Name |
---|---|
enum | Result |
enum | ak09916_data_rate_t |
enum | icm20948_accel_range_t |
enum | icm20948_gyro_range_t |
Public Functions¶
Detailed Description¶
Author:
beserge
Date:
December 2021
Public Types Documentation¶
enum Result¶
enum ak09916_data_rate_t¶
enum daisy::Icm20948::ak09916_data_rate_t {
AK09916_MAG_DATARATE_SHUTDOWN = 0x0,
AK09916_MAG_DATARATE_SINGLE = 0x1,
AK09916_MAG_DATARATE_10_HZ = 0x2,
AK09916_MAG_DATARATE_20_HZ = 0x4,
AK09916_MAG_DATARATE_50_HZ = 0x6,
AK09916_MAG_DATARATE_100_HZ = 0x8
};
Data rates/modes for the embedded AsahiKASEI AK09916 3-axis magnetometer
enum icm20948_accel_range_t¶
enum daisy::Icm20948::icm20948_accel_range_t {
ICM20948_ACCEL_RANGE_2_G,
ICM20948_ACCEL_RANGE_4_G,
ICM20948_ACCEL_RANGE_8_G,
ICM20948_ACCEL_RANGE_16_G
};
The accelerometer data range
enum icm20948_gyro_range_t¶
enum daisy::Icm20948::icm20948_gyro_range_t {
ICM20948_GYRO_RANGE_250_DPS,
ICM20948_GYRO_RANGE_500_DPS,
ICM20948_GYRO_RANGE_1000_DPS,
ICM20948_GYRO_RANGE_2000_DPS
};
The gyro data range
Public Functions Documentation¶
function AuxI2CBusSetupFailed¶
function AuxillaryRegisterTransaction¶
inline uint8_t daisy::Icm20948::AuxillaryRegisterTransaction (
bool read,
uint8_t slv_addr,
uint8_t reg_addr,
uint8_t value
)
Read / Write a single byte to a given register address for an I2C slave device on the auxiliary I2C bus
Parameters:
slv_addr
the 7-bit I2C address of the slave devicereg_addr
the register address to write tovalue
the value to write
Returns:
Read value ( if it's a read operation ), else true or false
function ConfigureI2CMaster¶
Set the I2C clock rate for the auxillary I2C bus to 345.60kHz and disable repeated start
Returns:
true: success false: failure
function EnableI2CMaster¶
Enable or disable the I2C mastercontroller
Parameters:
enable_i2c_master
true: enable false: disable
Returns:
true: success false: error
function GetAccelRange¶
Get the accelerometer's measurement range.
Returns:
The accelerometer's measurement range (icm20948_accel_range_t
).
function GetAccelVect¶
function GetGyroRange¶
Get the gyro's measurement range.
Returns:
The gyro's measurement range (icm20948_gyro_range_t
).
function GetGyroVect¶
function GetMagDataRate¶
Get the current magnetometer measurement rate
Returns:
ak09916_data_rate_t the current rate
function GetMagId¶
function GetMagVect¶
function GetTemp¶
function GetTransportError¶
Get and reset the transport error flag
Returns:
Whether the transport has errored since the last check
function Icm20948¶
function Init¶
Initialize the Icm20948 device
Parameters:
config
Configuration settings
function Process¶
Updates the measurement data for all sensors simultaneously
function Read8¶
Reads an 8 bit value
Parameters:
reg
the register address to read from
Returns:
the data uint8_t read from the device
function ReadAccelRange¶
Get the accelerometer's measurement range.
Returns:
The accelerometer's measurement range (icm20x_accel_range_t
).
function ReadBits¶
function ReadExternalRegister¶
Read a single byte from a given register address for an I2C slave device on the auxiliary I2C bus
Parameters:
slv_addr
the 7-bit I2C address of the slave devicereg_addr
the register address to read from
Returns:
the requested register value
function ReadGyroRange¶
Get the gyro's measurement range.
Returns:
The gyro's measurement range (icm20x_gyro_range_t
).
function ReadMagRegister¶
Parameters:
slv_addr
mag_reg_addr
num_finished_checks
Returns:
uint8_t
function ReadReg¶
Read from a reg address a defined number of bytes
function Reset¶
Reset the internal registers and restores the default settings
function ResetI2CMaster¶
Reset the I2C master
function ScaleValues¶
function SetAccelRange¶
Sets the accelerometer's measurement range.
Parameters:
new_accel_range
Measurement range to be set. Must be anicm20948_accel_range_t
.
function SetAccelRateDivisor¶
Sets the accelerometer's data rate divisor.
Parameters:
new_accel_divisor
The accelerometer's data rate divisor (uint16_t
). This 12-bit value must be <= 4095
function SetBank¶
Sets register bank.
Parameters:
bank_number
The bank to set to active
function SetGyroRange¶
Sets the gyro's measurement range.
Parameters:
new_gyro_range
Measurement range to be set. Must be anicm20948_gyro_range_t
.
function SetGyroRateDivisor¶
Sets the gyro's data rate divisor.
Parameters:
new_gyro_divisor
The gyro's data rate divisor (uint8_t
).
function SetI2CBypass¶
Sets the bypass status of the I2C master bus support.
Parameters:
bypass_i2c
Set to true to bypass the internal I2C master circuitry, connecting the external I2C bus to the main I2C bus. Set to false to re-connect
function SetMagDataRate¶
Set the magnetometer measurement rate
Parameters:
rate
The rate to set.
Returns:
true: success false: failure
function SetupMag¶
function Write16¶
Writes a 16 bit value MSB first
Parameters:
reg
the register address to write tovalue
the value to write to the register
function Write8¶
Writes an 8 bit value
Parameters:
reg
the register address to write tovalue
the value to write to the register
function WriteAccelRange¶
Sets the accelerometer's measurement range.
Parameters:
new_accel_range
Measurement range to be set. Must be anicm20x_accel_range_t
.
function WriteBits¶
function WriteExternalRegister¶
inline bool daisy::Icm20948::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
Parameters:
slv_addr
the 7-bit I2C address of the slave devicereg_addr
the register address to write tovalue
the value to write
Returns:
true
Returns:
false
function WriteGyroRange¶
Sets the gyro's measurement range.
Parameters:
new_gyro_range
Measurement range to be set. Must be anicm20x_gyro_range_t
.
function WriteMagRegister¶
function ~Icm20948¶
The documentation for this class was generated from the following file external-docs/libDaisy/src/dev/icm20948.h