[−][src]Struct lsm303c::Lsm303c
LSM303C driver
Methods
impl<I2C, E> Lsm303c<I2C> where
I2C: WriteRead<Error = E> + Write<Error = E>,
[src]
I2C: WriteRead<Error = E> + Write<Error = E>,
pub fn default(i2c: I2C) -> Result<Self, Error<E>>
[src]
Creates a new Lsm303c
driver from a I2C peripheral with
default configuration.
pub fn new(i2c: I2C, config: &mut LsmConfig) -> Result<Self, Error<E>>
[src]
pub fn acc_who_am_i(&mut self) -> Result<u8, E>
[src]
Reads the accelerometer WHO_AM_I register
pub fn mag_who_am_i(&mut self) -> Result<u8, E>
[src]
Reads the magnetometer WHO_AM_I register
pub fn config(&mut self, config: &mut LsmConfig) -> Result<(), E>
[src]
Configures device using provided [MpuConfig
].
pub fn unscaled_accel<T: From<[i16; 3]>>(&mut self) -> Result<T, E>
[src]
Reads and returns unscaled accelerometer measurements (LSB).
pub fn accel<T: From<[f32; 3]>>(&mut self) -> Result<T, E>
[src]
Reads and returns accelerometer measurements converted to g.
pub fn mag<T: From<[f32; 3]>>(&mut self) -> Result<T, E>
[src]
Reads and returns magnetometer measurements converted to mgauss.
pub fn unscaled_mag<T: From<[i16; 3]>>(&mut self) -> Result<T, E>
[src]
Reads and returns unscaled magnetometer measurements (LSB).
pub fn temp(&mut self) -> Result<f32, E>
[src]
Temperature sensor measurement in Celcius
- Range: [-40, +85] C
pub fn raw_temp(&mut self) -> Result<i16, E>
[src]
Raw temperature sensor measurement
- Resolution: 12-bit
pub fn unscaled_all<T: From<[i16; 3]>>(
&mut self
) -> Result<UnscaledMeasurements<T>, E>
[src]
&mut self
) -> Result<UnscaledMeasurements<T>, E>
Reads and returns raw unscaled Accelerometer + Magnetometer + Thermometer measurements (LSB).
pub fn all<T: From<[f32; 3]>>(&mut self) -> Result<Measurements<T>, E>
[src]
Reads and returns Accelerometer + Magnetometer + Thermometer measurements scaled and converted to respective units.
pub fn accel_data_rate(&mut self, data_rate: AccelDataRate) -> Result<(), E>
[src]
Configures the accelerometer output data rate
pub fn mag_data_rate(&mut self, data_rate: MagDataRate) -> Result<(), E>
[src]
Configures the magnetometer output data rate (MagDataRate
).
pub fn accel_scale(&mut self, accel_scale: AccelScale) -> Result<(), E>
[src]
Configures accelerometer full reading scale (AccelScale
).
pub fn accel_block_data_update(
&mut self,
bdu: AccelBlockDataUpdate
) -> Result<(), E>
[src]
&mut self,
bdu: AccelBlockDataUpdate
) -> Result<(), E>
Configures accelerometer block data update (AccelBlockDataUpdate
).
pub fn accel_axes_control(
&mut self,
axes_control: AccelAxesControl
) -> Result<(), E>
[src]
&mut self,
axes_control: AccelAxesControl
) -> Result<(), E>
Enables or disables accelerometer axes (AccelAxesControl
).
pub fn temp_control(&mut self, control: TempControl) -> Result<(), E>
[src]
Configures temperature control (TempControl
).
pub fn mag_mode(&mut self, mode: MagMode) -> Result<(), E>
[src]
Configures magnetometer mode (MagMode
).
pub fn mag_xy_operative_mode(
&mut self,
operative_mode: MagXYOperativeMode
) -> Result<(), E>
[src]
&mut self,
operative_mode: MagXYOperativeMode
) -> Result<(), E>
Configures magnetometer x and y axes operative mode
(MagXYOperativeMode
).
pub fn mag_z_operative_mode(
&mut self,
operative_mode: MagZOperativeMode
) -> Result<(), E>
[src]
&mut self,
operative_mode: MagZOperativeMode
) -> Result<(), E>
Configures magnetometer z axis operative mode ([MagXOperativeMode
]).
pub fn mag_scale(&mut self, mag_scale: MagScale) -> Result<(), E>
[src]
Configures magnetometer full reading scale (MagScale
).
pub fn mag_block_data_update(
&mut self,
bdu: MagBlockDataUpdate
) -> Result<(), E>
[src]
&mut self,
bdu: MagBlockDataUpdate
) -> Result<(), E>
Configures magnetometer block data update (MagBlockDataUpdate
).
Auto Trait Implementations
impl<I2C> Unpin for Lsm303c<I2C> where
I2C: Unpin,
I2C: Unpin,
impl<I2C> Sync for Lsm303c<I2C> where
I2C: Sync,
I2C: Sync,
impl<I2C> Send for Lsm303c<I2C> where
I2C: Send,
I2C: Send,
Blanket Implementations
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,