Struct lsm303agr::Lsm303agr[][src]

pub struct Lsm303agr<DI, MODE> { /* fields omitted */ }

LSM303AGR device driver

Implementations

impl<DI, CommE, PinE, MODE> Lsm303agr<DI, MODE> where
    DI: ReadData<Error = Error<CommE, PinE>> + WriteData<Error = Error<CommE, PinE>>, 
[src]

pub fn set_accel_odr(
    &mut self,
    odr: AccelOutputDataRate
) -> Result<(), Error<CommE, PinE>>
[src]

Set accelerometer output data rate.

This changes the power mode if the current one is not appropriate. When changing from a low-power-only output data rate setting into a high-resolution or normal power mode, it changes into normal mode.

pub fn set_accel_mode(
    &mut self,
    mode: AccelMode
) -> Result<(), Error<CommE, PinE>>
[src]

Set accelerometer power/resolution mode

Returns Error::InvalidInputData if the mode is incompatible with the current accelerometer output data rate.

impl<I2C> Lsm303agr<I2cInterface<I2C>, MagOneShot>[src]

pub fn new_with_i2c(i2c: I2C) -> Self[src]

Create new instance of the LSM303AGR device communicating through I2C.

impl<I2C, MODE> Lsm303agr<I2cInterface<I2C>, MODE>[src]

pub fn destroy(self) -> I2C[src]

Destroy driver instance, return I2C bus.

impl<SPI, CSXL, CSMAG> Lsm303agr<SpiInterface<SPI, CSXL, CSMAG>, MagOneShot>[src]

pub fn new_with_spi(
    spi: SPI,
    chip_select_accel: CSXL,
    chip_select_mag: CSMAG
) -> Self
[src]

Create new instance of the LSM303AGR device communicating through SPI.

impl<SPI, CSXL, CSMAG, MODE> Lsm303agr<SpiInterface<SPI, CSXL, CSMAG>, MODE>[src]

pub fn destroy(self) -> (SPI, CSXL, CSMAG)[src]

Destroy driver instance, return SPI bus instance and chip select pin.

impl<DI, CommE, PinE, MODE> Lsm303agr<DI, MODE> where
    DI: ReadData<Error = Error<CommE, PinE>> + WriteData<Error = Error<CommE, PinE>>, 
[src]

pub fn init(&mut self) -> Result<(), Error<CommE, PinE>>[src]

Initialize registers

pub fn accel_status(&mut self) -> Result<Status, Error<CommE, PinE>>[src]

Accelerometer status

pub fn accel_data(&mut self) -> Result<UnscaledMeasurement, Error<CommE, PinE>>[src]

Accelerometer data

pub fn mag_status(&mut self) -> Result<Status, Error<CommE, PinE>>[src]

Magnetometer status

pub fn accelerometer_id(&mut self) -> Result<u8, Error<CommE, PinE>>[src]

Get accelerometer device ID

pub fn magnetometer_id(&mut self) -> Result<u8, Error<CommE, PinE>>[src]

Get magnetometer device ID

impl<DI, CommE, PinE> Lsm303agr<DI, MagOneShot> where
    DI: ReadData<Error = Error<CommE, PinE>> + WriteData<Error = Error<CommE, PinE>>, 
[src]

pub fn into_mag_continuous(
    self
) -> Result<Lsm303agr<DI, MagContinuous>, ModeChangeError<CommE, PinE, Self>>
[src]

Change the magnetometer to continuous measurement mode

impl<DI, CommE, PinE> Lsm303agr<DI, MagContinuous> where
    DI: ReadData<Error = Error<CommE, PinE>> + WriteData<Error = Error<CommE, PinE>>, 
[src]

pub fn into_mag_one_shot(
    self
) -> Result<Lsm303agr<DI, MagOneShot>, ModeChangeError<CommE, PinE, Self>>
[src]

Change the magnetometer to one-shot mode

After this the magnetometer is in idle mode until a one-shot measurement is started.

impl<DI, CommE, PinE, MODE> Lsm303agr<DI, MODE> where
    DI: ReadData<Error = Error<CommE, PinE>> + WriteData<Error = Error<CommE, PinE>>, 
[src]

pub fn set_mag_odr(
    &mut self,
    odr: MagOutputDataRate
) -> Result<(), Error<CommE, PinE>>
[src]

Set magnetometer output data rate

impl<DI, CommE, PinE> Lsm303agr<DI, MagContinuous> where
    DI: ReadData<Error = Error<CommE, PinE>> + WriteData<Error = Error<CommE, PinE>>, 
[src]

pub fn mag_data(&mut self) -> Result<UnscaledMeasurement, Error<CommE, PinE>>[src]

Magnetometer data

impl<DI, CommE, PinE> Lsm303agr<DI, MagOneShot> where
    DI: ReadData<Error = Error<CommE, PinE>> + WriteData<Error = Error<CommE, PinE>>, 
[src]

pub fn mag_data(&mut self) -> Result<UnscaledMeasurement, Error<CommE, PinE>>[src]

Magnetometer data

Trait Implementations

impl<DI: Debug, MODE: Debug> Debug for Lsm303agr<DI, MODE>[src]

Auto Trait Implementations

impl<DI, MODE> RefUnwindSafe for Lsm303agr<DI, MODE> where
    DI: RefUnwindSafe,
    MODE: RefUnwindSafe

impl<DI, MODE> Send for Lsm303agr<DI, MODE> where
    DI: Send,
    MODE: Send

impl<DI, MODE> Sync for Lsm303agr<DI, MODE> where
    DI: Sync,
    MODE: Sync

impl<DI, MODE> Unpin for Lsm303agr<DI, MODE> where
    DI: Unpin,
    MODE: Unpin

impl<DI, MODE> UnwindSafe for Lsm303agr<DI, MODE> where
    DI: UnwindSafe,
    MODE: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.