Icm20948

Struct Icm20948 

Source
pub struct Icm20948<TRANSPORT, MAG> { /* private fields */ }
Expand description

An initialized IMU. Use the IcmBuilder to construct a new instance.

Implementations§

Source§

impl<TRANSPORT, MAG> Icm20948<TRANSPORT, MAG>
where TRANSPORT: Icm20948Transport,

Source

pub async fn device_reset( &mut self, delay: &mut impl DelayNs, ) -> Result<(), TRANSPORT::Error>

Reset accelerometer / gyroscope module

Source

pub async fn set_acc_range( &mut self, range: AccRange, ) -> Result<(), TRANSPORT::Error>

Configure acceleromter to measure with given range

Source

pub async fn set_gyr_range( &mut self, range: GyrRange, ) -> Result<(), TRANSPORT::Error>

Configure gyroscope to measure with given range

Source

pub fn set_acc_unit(&mut self, unit: AccUnit)

Set returned unit of accelerometer

Source

pub fn set_gyr_unit(&mut self, unit: GyrUnit)

Set returned unit of gyroscope

Source

pub async fn set_acc_dlp( &mut self, acc_dlp: AccDlp, ) -> Result<(), TRANSPORT::Error>

Set (or disable) accelerometer digital low-pass filter

Source

pub async fn set_gyr_dlp( &mut self, gyr_dlp: GyrDlp, ) -> Result<(), TRANSPORT::Error>

Set (or disable) gyroscope digital low-pass filter

Source

pub async fn set_acc_odr( &mut self, acc_odr: u16, ) -> Result<(), TRANSPORT::Error>

Set accelerometer output data rate. Value will be clamped above 4095.

Source

pub async fn set_gyr_odr(&mut self, gyr_odr: u8) -> Result<(), TRANSPORT::Error>

Set gyroscope output data rate.

Source§

impl<TRANSPORT> Icm20948<TRANSPORT, MagEnabled>
where TRANSPORT: Icm20948Transport,

Source

pub async fn read_mag(&mut self) -> Result<[f32; 3], TRANSPORT::Error>

Get vector of scaled magnetometer values

Source

pub async fn read_mag_unscaled(&mut self) -> Result<[i16; 3], TRANSPORT::Error>

Get array of unscaled accelerometer values

Source

pub async fn read_9dof(&mut self) -> Result<Data9Dof<f32>, TRANSPORT::Error>

Get scaled measurement for accelerometer, gyroscope and magnetometer, and temperature

Source

pub async fn read_9dof_unscaled( &mut self, ) -> Result<Data9Dof<i16>, TRANSPORT::Error>

Get unscaled measurements for accelerometer and gyroscope, and temperature

Source§

impl<TRANSPORT, MAG> Icm20948<TRANSPORT, MAG>
where TRANSPORT: Icm20948Transport,

Source

pub async fn read_acc_unscaled(&mut self) -> Result<[i16; 3], TRANSPORT::Error>

Get array of unscaled accelerometer values

Source

pub async fn read_acc(&mut self) -> Result<[f32; 3], TRANSPORT::Error>

Get array of scaled accelerometer values

Source

pub async fn read_gyr_unscaled(&mut self) -> Result<[i16; 3], TRANSPORT::Error>

Get array of unscaled gyroscope values

Source

pub async fn read_gyr(&mut self) -> Result<[f32; 3], TRANSPORT::Error>

Get array of scaled gyroscope values

Source

pub async fn read_6dof(&mut self) -> Result<Data6Dof<f32>, TRANSPORT::Error>

Get scaled measurements for accelerometer and gyroscope, and temperature

Source

pub async fn read_6dof_unscaled( &mut self, ) -> Result<Data6Dof<i16>, TRANSPORT::Error>

Get unscaled measurements for accelerometer and gyroscope, and temperature

Source

pub async fn set_gyr_offsets( &mut self, offsets: [i16; 3], ) -> Result<(), TRANSPORT::Error>

Set gyroscope calibration offsets by writing them to the IMU

Source

pub async fn set_acc_offsets( &mut self, offsets: [i16; 3], ) -> Result<(), TRANSPORT::Error>

Set accelerometer calibration offsets by writing them to the IMU

Source

pub async fn new_data_ready(&mut self) -> u8

Returns the number of new readings in FIFO buffer

Source

pub const fn acc_scalar(&self) -> f32

Returns the scalar corresponding to the unit and range configured

Source

pub const fn gyr_scalar(&self) -> f32

Returns the scalar corresponding to the unit and range configured

Auto Trait Implementations§

§

impl<TRANSPORT, MAG> Freeze for Icm20948<TRANSPORT, MAG>
where TRANSPORT: Freeze,

§

impl<TRANSPORT, MAG> RefUnwindSafe for Icm20948<TRANSPORT, MAG>
where TRANSPORT: RefUnwindSafe, MAG: RefUnwindSafe,

§

impl<TRANSPORT, MAG> Send for Icm20948<TRANSPORT, MAG>
where TRANSPORT: Send, MAG: Send,

§

impl<TRANSPORT, MAG> Sync for Icm20948<TRANSPORT, MAG>
where TRANSPORT: Sync, MAG: Sync,

§

impl<TRANSPORT, MAG> Unpin for Icm20948<TRANSPORT, MAG>
where TRANSPORT: Unpin, MAG: Unpin,

§

impl<TRANSPORT, MAG> UnwindSafe for Icm20948<TRANSPORT, MAG>
where TRANSPORT: UnwindSafe, MAG: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.