Struct icm20948_async::Icm20948
source · pub struct Icm20948<BUS, MAG, INIT, DELAY, E> { /* private fields */ }Implementations§
source§impl<BUS, DELAY, E> Icm20948<IcmBusI2c<BUS, E>, MagDisabled, NotInit, DELAY, E>where
BUS: I2c<Error = E>,
E: Into<IcmError<E>>,
DELAY: DelayUs,
impl<BUS, DELAY, E> Icm20948<IcmBusI2c<BUS, E>, MagDisabled, NotInit, DELAY, E>where BUS: I2c<Error = E>, E: Into<IcmError<E>>, DELAY: DelayUs,
sourcepub fn new_i2c_from_cfg(
bus: BUS,
delay: DELAY,
cfg: Icm20948Config
) -> Icm20948<IcmBusI2c<BUS, E>, MagDisabled, NotInit, DELAY, E>
pub fn new_i2c_from_cfg( bus: BUS, delay: DELAY, cfg: Icm20948Config ) -> Icm20948<IcmBusI2c<BUS, E>, MagDisabled, NotInit, DELAY, E>
Creates an uninitialized IMU struct with the given config.
source§impl<BUS, DELAY, E> Icm20948<IcmBusSpi<BUS, E>, MagDisabled, NotInit, DELAY, E>where
BUS: SpiBus<Error = E>,
E: Into<IcmError<E>>,
DELAY: DelayUs,
impl<BUS, DELAY, E> Icm20948<IcmBusSpi<BUS, E>, MagDisabled, NotInit, DELAY, E>where BUS: SpiBus<Error = E>, E: Into<IcmError<E>>, DELAY: DelayUs,
sourcepub fn new_spi_from_cfg(
bus: BUS,
delay: DELAY,
cfg: Icm20948Config
) -> Icm20948<IcmBusSpi<BUS, E>, MagDisabled, NotInit, DELAY, E>
pub fn new_spi_from_cfg( bus: BUS, delay: DELAY, cfg: Icm20948Config ) -> Icm20948<IcmBusSpi<BUS, E>, MagDisabled, NotInit, DELAY, E>
Creates an uninitialized IMU struct with the given config.
source§impl<BUS, MAG, DELAY, E> Icm20948<IcmBusI2c<BUS, E>, MAG, Init, DELAY, E>where
BUS: I2c<Error = E>,
E: Into<IcmError<E>>,
DELAY: DelayUs,
impl<BUS, MAG, DELAY, E> Icm20948<IcmBusI2c<BUS, E>, MAG, Init, DELAY, E>where BUS: I2c<Error = E>, E: Into<IcmError<E>>, DELAY: DelayUs,
source§impl<BUS, MAG, DELAY, E> Icm20948<IcmBusSpi<BUS, E>, MAG, Init, DELAY, E>where
BUS: SpiBus<Error = E>,
E: Into<IcmError<E>>,
DELAY: DelayUs,
impl<BUS, MAG, DELAY, E> Icm20948<IcmBusSpi<BUS, E>, MAG, Init, DELAY, E>where BUS: SpiBus<Error = E>, E: Into<IcmError<E>>, DELAY: DelayUs,
source§impl<BUS, DELAY, E> Icm20948<IcmBusI2c<BUS, E>, MagDisabled, NotInit, DELAY, E>where
BUS: I2c<Error = E>,
E: Into<IcmError<E>>,
DELAY: DelayUs,
impl<BUS, DELAY, E> Icm20948<IcmBusI2c<BUS, E>, MagDisabled, NotInit, DELAY, E>where BUS: I2c<Error = E>, E: Into<IcmError<E>>, DELAY: DelayUs,
sourcepub fn set_address(
self,
address: impl Into<I2cAddress>
) -> Icm20948<IcmBusI2c<BUS, E>, MagDisabled, NotInit, DELAY, E>
pub fn set_address( self, address: impl Into<I2cAddress> ) -> Icm20948<IcmBusI2c<BUS, E>, 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: DelayUs,
impl<BUS, DELAY, E> Icm20948<BUS, MagDisabled, NotInit, DELAY, E>where BUS: BusTransfer<E>, DELAY: DelayUs,
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: DelayUs,
impl<BUS, E, MAG, INIT, DELAY> Icm20948<BUS, MAG, INIT, DELAY, E>where BUS: BusTransfer<E>, DELAY: DelayUs,
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: DelayUs,
impl<BUS, DELAY, E> Icm20948<BUS, MagEnabled, Init, DELAY, E>where BUS: BusTransfer<E>, DELAY: DelayUs,
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
source§impl<BUS, E, MAG, DELAY> Icm20948<BUS, MAG, Init, DELAY, E>where
BUS: BusTransfer<E>,
E: Into<IcmError<E>>,
DELAY: DelayUs,
impl<BUS, E, MAG, DELAY> Icm20948<BUS, MAG, Init, DELAY, E>where BUS: BusTransfer<E>, E: Into<IcmError<E>>, DELAY: DelayUs,
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, E>
pub async fn read_6dof(&mut self) -> Result<Data6Dof, E>
Get scaled 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> RefUnwindSafe for Icm20948<BUS, MAG, INIT, DELAY, E>where BUS: RefUnwindSafe, DELAY: RefUnwindSafe, E: RefUnwindSafe, INIT: RefUnwindSafe, MAG: RefUnwindSafe,
impl<BUS, MAG, INIT, DELAY, E> Send for Icm20948<BUS, MAG, INIT, DELAY, E>where BUS: Send, DELAY: Send, E: Send, INIT: Send, MAG: Send,
impl<BUS, MAG, INIT, DELAY, E> Sync for Icm20948<BUS, MAG, INIT, DELAY, E>where BUS: Sync, DELAY: Sync, E: Sync, INIT: Sync, MAG: Sync,
impl<BUS, MAG, INIT, DELAY, E> Unpin for Icm20948<BUS, MAG, INIT, DELAY, E>where BUS: Unpin, DELAY: Unpin, E: Unpin, INIT: Unpin, MAG: Unpin,
impl<BUS, MAG, INIT, DELAY, E> UnwindSafe for Icm20948<BUS, MAG, INIT, DELAY, E>where BUS: UnwindSafe, DELAY: UnwindSafe, E: UnwindSafe, INIT: UnwindSafe, MAG: UnwindSafe,
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
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.