pub struct Lsm303c<I2C> { /* private fields */ }
Expand description
LSM303C driver
Implementations
sourceimpl<I2C, E> Lsm303c<I2C>where
I2C: WriteRead<Error = E> + Write<Error = E>,
impl<I2C, E> Lsm303c<I2C>where
I2C: WriteRead<Error = E> + Write<Error = E>,
sourcepub fn default(i2c: I2C) -> Result<Self, Error<E>>
pub fn default(i2c: I2C) -> Result<Self, Error<E>>
Creates a new Lsm303c
driver from a I2C peripheral with
default configuration.
sourcepub fn acc_who_am_i(&mut self) -> Result<u8, E>
pub fn acc_who_am_i(&mut self) -> Result<u8, E>
Reads the accelerometer WHO_AM_I register
sourcepub fn mag_who_am_i(&mut self) -> Result<u8, E>
pub fn mag_who_am_i(&mut self) -> Result<u8, E>
Reads the magnetometer WHO_AM_I register
sourcepub fn config(&mut self, config: &mut LsmConfig) -> Result<(), E>
pub fn config(&mut self, config: &mut LsmConfig) -> Result<(), E>
Configures device using provided [MpuConfig
].
sourcepub fn unscaled_accel(&mut self) -> Result<Vector3<i16>, E>
pub fn unscaled_accel(&mut self) -> Result<Vector3<i16>, E>
Reads and returns unscaled accelerometer measurements (LSB).
sourcepub fn accel(&mut self) -> Result<Vector3<f32>, E>
pub fn accel(&mut self) -> Result<Vector3<f32>, E>
Reads and returns accelerometer measurements converted to g.
sourcepub fn mag(&mut self) -> Result<Vector3<f32>, E>
pub fn mag(&mut self) -> Result<Vector3<f32>, E>
Reads and returns magnetometer measurements converted to mgauss.
sourcepub fn unscaled_mag(&mut self) -> Result<Vector3<i16>, E>
pub fn unscaled_mag(&mut self) -> Result<Vector3<i16>, E>
Reads and returns unscaled magnetometer measurements (LSB).
sourcepub fn temp(&mut self) -> Result<f32, E>
pub fn temp(&mut self) -> Result<f32, E>
Temperature sensor measurement in Celcius
- Range: [-40, +85] C
sourcepub fn raw_temp(&mut self) -> Result<i16, E>
pub fn raw_temp(&mut self) -> Result<i16, E>
Raw temperature sensor measurement
- Resolution: 12-bit
sourcepub fn unscaled_all(&mut self) -> Result<UnscaledMeasurements, E>
pub fn unscaled_all(&mut self) -> Result<UnscaledMeasurements, E>
Reads and returns raw unscaled Accelerometer + Magnetometer + Thermometer measurements (LSB).
sourcepub fn all(&mut self) -> Result<Measurements, E>
pub fn all(&mut self) -> Result<Measurements, E>
Reads and returns Accelerometer + Magnetometer + Thermometer measurements scaled and converted to respective units.
sourcepub fn accel_data_rate(&mut self, data_rate: AccelDataRate) -> Result<(), E>
pub fn accel_data_rate(&mut self, data_rate: AccelDataRate) -> Result<(), E>
Configures the accelerometer output data rate
sourcepub fn mag_data_rate(&mut self, data_rate: MagDataRate) -> Result<(), E>
pub fn mag_data_rate(&mut self, data_rate: MagDataRate) -> Result<(), E>
Configures the magnetometer output data rate (MagDataRate
).
sourcepub fn accel_scale(&mut self, accel_scale: AccelScale) -> Result<(), E>
pub fn accel_scale(&mut self, accel_scale: AccelScale) -> Result<(), E>
Configures accelerometer full reading scale (AccelScale
).
sourcepub fn accel_block_data_update(
&mut self,
bdu: AccelBlockDataUpdate
) -> Result<(), E>
pub fn accel_block_data_update(
&mut self,
bdu: AccelBlockDataUpdate
) -> Result<(), E>
Configures accelerometer block data update (AccelBlockDataUpdate
).
sourcepub fn accel_axes_control(
&mut self,
axes_control: AccelAxesControl
) -> Result<(), E>
pub fn accel_axes_control(
&mut self,
axes_control: AccelAxesControl
) -> Result<(), E>
Enables or disables accelerometer axes (AccelAxesControl
).
sourcepub fn temp_control(&mut self, control: TempControl) -> Result<(), E>
pub fn temp_control(&mut self, control: TempControl) -> Result<(), E>
Configures temperature control (TempControl
).
sourcepub fn mag_mode(&mut self, mode: MagMode) -> Result<(), E>
pub fn mag_mode(&mut self, mode: MagMode) -> Result<(), E>
Configures magnetometer mode (MagMode
).
sourcepub fn mag_xy_operative_mode(
&mut self,
operative_mode: MagXYOperativeMode
) -> Result<(), E>
pub fn mag_xy_operative_mode(
&mut self,
operative_mode: MagXYOperativeMode
) -> Result<(), E>
Configures magnetometer x and y axes operative mode
(MagXYOperativeMode
).
sourcepub fn mag_z_operative_mode(
&mut self,
operative_mode: MagZOperativeMode
) -> Result<(), E>
pub fn mag_z_operative_mode(
&mut self,
operative_mode: MagZOperativeMode
) -> Result<(), E>
Configures magnetometer z axis operative mode ([MagXOperativeMode
]).
sourcepub fn mag_scale(&mut self, mag_scale: MagScale) -> Result<(), E>
pub fn mag_scale(&mut self, mag_scale: MagScale) -> Result<(), E>
Configures magnetometer full reading scale (MagScale
).
sourcepub fn mag_block_data_update(&mut self, bdu: MagBlockDataUpdate) -> Result<(), E>
pub fn mag_block_data_update(&mut self, bdu: MagBlockDataUpdate) -> Result<(), E>
Configures magnetometer block data update (MagBlockDataUpdate
).
Auto Trait Implementations
impl<I2C> RefUnwindSafe for Lsm303c<I2C>where
I2C: RefUnwindSafe,
impl<I2C> Send for Lsm303c<I2C>where
I2C: Send,
impl<I2C> Sync for Lsm303c<I2C>where
I2C: Sync,
impl<I2C> Unpin for Lsm303c<I2C>where
I2C: Unpin,
impl<I2C> UnwindSafe for Lsm303c<I2C>where
I2C: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn 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 morefn 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).unsafe fn to_subset_unchecked(&self) -> SS
unsafe 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.