pub struct Icm20948<BUS, MAG, INIT, DELAY, E> { /* private fields */ }
Implementations§
Source§impl<BUS, DELAY, E> Icm20948<IcmBusI2c<BUS>, MagDisabled, NotInit, DELAY, E>
impl<BUS, DELAY, E> Icm20948<IcmBusI2c<BUS>, MagDisabled, NotInit, DELAY, E>
Sourcepub fn new_i2c_from_cfg(
bus: BUS,
cfg: Icm20948Config,
delay: DELAY,
) -> Icm20948<IcmBusI2c<BUS>, MagDisabled, NotInit, DELAY, E>
pub fn new_i2c_from_cfg( bus: BUS, cfg: Icm20948Config, delay: DELAY, ) -> Icm20948<IcmBusI2c<BUS>, MagDisabled, NotInit, DELAY, E>
Creates an uninitialized IMU struct with the given config.
Source§impl<BUS, DELAY, E> Icm20948<IcmBusSpi<BUS>, MagDisabled, NotInit, DELAY, E>
impl<BUS, DELAY, E> Icm20948<IcmBusSpi<BUS>, MagDisabled, NotInit, DELAY, E>
Sourcepub fn new_spi_from_cfg(
bus: BUS,
cfg: Icm20948Config,
delay: DELAY,
) -> Icm20948<IcmBusSpi<BUS>, MagDisabled, NotInit, DELAY, E>
pub fn new_spi_from_cfg( bus: BUS, cfg: Icm20948Config, delay: DELAY, ) -> Icm20948<IcmBusSpi<BUS>, MagDisabled, NotInit, DELAY, E>
Creates an uninitialized IMU struct with the given config.
Source§impl<BUS, DELAY, E> Icm20948<IcmBusI2c<BUS>, MagDisabled, NotInit, DELAY, E>
impl<BUS, DELAY, E> Icm20948<IcmBusI2c<BUS>, MagDisabled, NotInit, DELAY, E>
Sourcepub fn set_address(
self,
address: impl Into<I2cAddress>,
) -> Icm20948<IcmBusI2c<BUS>, MagDisabled, NotInit, DELAY, E>
pub fn set_address( self, address: impl Into<I2cAddress>, ) -> Icm20948<IcmBusI2c<BUS>, MagDisabled, NotInit, DELAY, E>
Set I2C address of ICM module. See I2cAddress
for defaults, otherwise u8
implements Into<I2cAddress>
Source§impl<BUS, DELAY, E> Icm20948<BUS, MagDisabled, NotInit, DELAY, E>where
BUS: BusTransfer<E>,
DELAY: DelayNs,
impl<BUS, DELAY, E> Icm20948<BUS, MagDisabled, NotInit, DELAY, E>where
BUS: BusTransfer<E>,
DELAY: DelayNs,
Sourcepub fn acc_range(
self,
acc_range: AccRange,
) -> Icm20948<BUS, MagDisabled, NotInit, DELAY, E>
pub fn acc_range( self, acc_range: AccRange, ) -> Icm20948<BUS, MagDisabled, NotInit, DELAY, E>
Set accelerometer measuring range, choises are 2G, 4G, 8G or 16G
Sourcepub fn acc_dlp(
self,
acc_dlp: AccDlp,
) -> Icm20948<BUS, MagDisabled, NotInit, DELAY, E>
pub fn acc_dlp( self, acc_dlp: AccDlp, ) -> Icm20948<BUS, MagDisabled, NotInit, DELAY, E>
Set accelerometer digital lowpass filter frequency
Sourcepub fn acc_unit(
self,
acc_unit: AccUnit,
) -> Icm20948<BUS, MagDisabled, NotInit, DELAY, E>
pub fn acc_unit( self, acc_unit: AccUnit, ) -> Icm20948<BUS, MagDisabled, NotInit, DELAY, E>
Set returned unit of accelerometer measurement, choises are Gs or m/s^2
Sourcepub fn acc_odr(
self,
acc_odr: u16,
) -> Icm20948<BUS, MagDisabled, NotInit, DELAY, E>
pub fn acc_odr( self, acc_odr: u16, ) -> Icm20948<BUS, MagDisabled, NotInit, DELAY, E>
Set accelerometer output data rate
Sourcepub fn gyr_range(
self,
gyr_range: GyrRange,
) -> Icm20948<BUS, MagDisabled, NotInit, DELAY, E>
pub fn gyr_range( self, gyr_range: GyrRange, ) -> Icm20948<BUS, MagDisabled, NotInit, DELAY, E>
Set gyroscope measuring range, choises are 250Dps, 500Dps, 1000Dps and 2000Dps
Sourcepub fn gyr_dlp(
self,
gyr_dlp: GyrDlp,
) -> Icm20948<BUS, MagDisabled, NotInit, DELAY, E>
pub fn gyr_dlp( self, gyr_dlp: GyrDlp, ) -> Icm20948<BUS, MagDisabled, NotInit, DELAY, E>
Set gyroscope digital low pass filter frequency
Sourcepub fn gyr_unit(
self,
gyr_unit: GyrUnit,
) -> Icm20948<BUS, MagDisabled, NotInit, DELAY, E>
pub fn gyr_unit( self, gyr_unit: GyrUnit, ) -> Icm20948<BUS, MagDisabled, NotInit, DELAY, E>
Set returned unit of gyroscope measurement, choises are degrees/s or radians/s
Sourcepub fn gyr_odr(
self,
gyr_odr: u8,
) -> Icm20948<BUS, MagDisabled, NotInit, DELAY, E>
pub fn gyr_odr( self, gyr_odr: u8, ) -> Icm20948<BUS, MagDisabled, NotInit, DELAY, E>
Set gyroscope output data rate
Sourcepub async fn initialize_6dof(
self,
) -> Result<Icm20948<BUS, MagDisabled, Init, DELAY, E>, IcmError<E>>
pub async fn initialize_6dof( self, ) -> Result<Icm20948<BUS, MagDisabled, Init, DELAY, E>, IcmError<E>>
Initializes the IMU with accelerometer and gyroscope
Sourcepub async fn initialize_9dof(
self,
) -> Result<Icm20948<BUS, MagEnabled, Init, DELAY, E>, IcmError<E>>
pub async fn initialize_9dof( self, ) -> Result<Icm20948<BUS, MagEnabled, Init, DELAY, E>, IcmError<E>>
Initializes the IMU with accelerometer, gyroscope and magnetometer
Source§impl<BUS, E, MAG, INIT, DELAY> Icm20948<BUS, MAG, INIT, DELAY, E>where
BUS: BusTransfer<E>,
DELAY: DelayNs,
impl<BUS, E, MAG, INIT, DELAY> Icm20948<BUS, MAG, INIT, DELAY, E>where
BUS: BusTransfer<E>,
DELAY: DelayNs,
Sourcepub async fn device_reset(&mut self) -> Result<(), E>
pub async fn device_reset(&mut self) -> Result<(), E>
Reset accelerometer / gyroscope module
Sourcepub async fn set_acc_range(&mut self, range: AccRange) -> Result<(), E>
pub async fn set_acc_range(&mut self, range: AccRange) -> Result<(), E>
Configure acceleromter to measure with given range
Sourcepub async fn set_gyr_range(&mut self, range: GyrRange) -> Result<(), E>
pub async fn set_gyr_range(&mut self, range: GyrRange) -> Result<(), E>
Configure gyroscope to measure with given range
Sourcepub fn set_acc_unit(&mut self, unit: AccUnit)
pub fn set_acc_unit(&mut self, unit: AccUnit)
Set returned unit of accelerometer
Sourcepub fn set_gyr_unit(&mut self, unit: GyrUnit)
pub fn set_gyr_unit(&mut self, unit: GyrUnit)
Set returned unit of gyroscope
Sourcepub async fn set_acc_dlp(&mut self, acc_dlp: AccDlp) -> Result<(), E>
pub async fn set_acc_dlp(&mut self, acc_dlp: AccDlp) -> Result<(), E>
Set (or disable) accelerometer digital low-pass filter
Sourcepub async fn set_gyr_dlp(&mut self, gyr_dlp: GyrDlp) -> Result<(), E>
pub async fn set_gyr_dlp(&mut self, gyr_dlp: GyrDlp) -> Result<(), E>
Set (or disable) gyroscope digital low-pass filter
Sourcepub async fn set_acc_odr(&mut self, acc_odr: u16) -> Result<(), E>
pub async fn set_acc_odr(&mut self, acc_odr: u16) -> Result<(), E>
Set accelerometer output data rate. Value will be clamped above 4095.
Sourcepub async fn set_gyr_odr(&mut self, gyr_odr: u8) -> Result<(), E>
pub async fn set_gyr_odr(&mut self, gyr_odr: u8) -> Result<(), E>
Set gyroscope output data rate.
Source§impl<BUS, DELAY, E> Icm20948<BUS, MagEnabled, Init, DELAY, E>where
BUS: BusTransfer<E>,
DELAY: DelayNs,
impl<BUS, DELAY, E> Icm20948<BUS, MagEnabled, Init, DELAY, E>where
BUS: BusTransfer<E>,
DELAY: DelayNs,
Sourcepub fn set_mag_calibration(&mut self, offset: [f32; 3], scale: [f32; 3])
pub fn set_mag_calibration(&mut self, offset: [f32; 3], scale: [f32; 3])
Set magnetometer calibration data (offset,scale)
Sourcepub fn reset_mag_calibration(&mut self)
pub fn reset_mag_calibration(&mut self)
Resets (disables) magnetometer calibration data
Sourcepub async fn read_mag(&mut self) -> Result<Vector3<f32>, E>
pub async fn read_mag(&mut self) -> Result<Vector3<f32>, E>
Get vector of scaled magnetometer values
Sourcepub async fn read_mag_unscaled(&mut self) -> Result<[i16; 3], E>
pub async fn read_mag_unscaled(&mut self) -> Result<[i16; 3], E>
Get array of unscaled accelerometer values
Sourcepub async fn read_9dof(&mut self) -> Result<Data9Dof<f32>, E>
pub async fn read_9dof(&mut self) -> Result<Data9Dof<f32>, E>
Get scaled measurement for accelerometer, gyroscope and magnetometer, and temperature
Sourcepub async fn read_9dof_unscaled(&mut self) -> Result<Data9Dof<i16>, E>
pub async fn read_9dof_unscaled(&mut self) -> Result<Data9Dof<i16>, E>
Get unscaled measurements for accelerometer and gyroscope, and temperature
Source§impl<BUS, E, MAG, DELAY> Icm20948<BUS, MAG, Init, DELAY, E>
impl<BUS, E, MAG, DELAY> Icm20948<BUS, MAG, Init, DELAY, E>
Sourcepub async fn read_acc_unscaled(&mut self) -> Result<Vector3<i16>, E>
pub async fn read_acc_unscaled(&mut self) -> Result<Vector3<i16>, E>
Get array of unscaled accelerometer values
Sourcepub async fn read_acc(&mut self) -> Result<Vector3<f32>, E>
pub async fn read_acc(&mut self) -> Result<Vector3<f32>, E>
Get array of scaled accelerometer values
Sourcepub async fn read_gyr_unscaled(&mut self) -> Result<Vector3<i16>, E>
pub async fn read_gyr_unscaled(&mut self) -> Result<Vector3<i16>, E>
Get array of unscaled gyroscope values
Sourcepub async fn read_gyr(&mut self) -> Result<Vector3<f32>, E>
pub async fn read_gyr(&mut self) -> Result<Vector3<f32>, E>
Get array of scaled gyroscope values
Sourcepub async fn read_6dof(&mut self) -> Result<Data6Dof<f32>, E>
pub async fn read_6dof(&mut self) -> Result<Data6Dof<f32>, E>
Get scaled measurements for accelerometer and gyroscope, and temperature
Sourcepub async fn read_6dof_unscaled(&mut self) -> Result<Data6Dof<i16>, E>
pub async fn read_6dof_unscaled(&mut self) -> Result<Data6Dof<i16>, E>
Get unscaled measurements for accelerometer and gyroscope, and temperature
Sourcepub async fn gyr_calibrate(&mut self, num: usize) -> Result<(), E>
pub async fn gyr_calibrate(&mut self, num: usize) -> Result<(), E>
Collects and averages num
sampels for gyro calibration and saves them on-chip
Sourcepub async fn set_gyr_offsets(&mut self, offsets: Vector3<i16>) -> Result<(), E>
pub async fn set_gyr_offsets(&mut self, offsets: Vector3<i16>) -> Result<(), E>
Set gyroscope calibration offsets by writing them to the IMU
Sourcepub async fn set_acc_offsets(&mut self, offsets: Vector3<i16>) -> Result<(), E>
pub async fn set_acc_offsets(&mut self, offsets: Vector3<i16>) -> Result<(), E>
Set accelerometer calibration offsets by writing them to the IMU
Sourcepub async fn new_data_ready(&mut self) -> u8
pub async fn new_data_ready(&mut self) -> u8
Returns the number of new readings in FIFO buffer
Auto Trait Implementations§
impl<BUS, MAG, INIT, DELAY, E> Freeze for Icm20948<BUS, MAG, INIT, DELAY, E>
impl<BUS, MAG, INIT, DELAY, E> RefUnwindSafe for Icm20948<BUS, MAG, INIT, DELAY, E>where
BUS: RefUnwindSafe,
DELAY: RefUnwindSafe,
MAG: RefUnwindSafe,
INIT: RefUnwindSafe,
E: RefUnwindSafe,
impl<BUS, MAG, INIT, DELAY, E> Send for Icm20948<BUS, MAG, INIT, DELAY, E>
impl<BUS, MAG, INIT, DELAY, E> Sync for Icm20948<BUS, MAG, INIT, DELAY, E>
impl<BUS, MAG, INIT, DELAY, E> Unpin for Icm20948<BUS, MAG, INIT, DELAY, E>
impl<BUS, MAG, INIT, DELAY, E> UnwindSafe for Icm20948<BUS, MAG, INIT, DELAY, E>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.