[][src]Struct lsm303agr::Lsm303agr

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

LSM303AGR device driver

Implementations

impl<DI, CommE, PinE> Lsm303agr<DI> 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>>[src]

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

Create new instance of the LSM303AGR device communicating through I2C.

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

Destroy driver instance, return I2C bus.

impl<SPI, CSXL, CSMAG> Lsm303agr<SpiInterface<SPI, CSXL, CSMAG>>[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.

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

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

impl<DI, CommE, PinE> Lsm303agr<DI> 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

Trait Implementations

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

Auto Trait Implementations

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

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

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

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

impl<DI> UnwindSafe for Lsm303agr<DI> where
    DI: 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.