[][src]Struct lis2dh12::Lis2dh12

pub struct Lis2dh12<I2C> { /* fields omitted */ }

LIS2DH12 driver

Methods

impl<I2C, E> Lis2dh12<I2C> where
    I2C: WriteRead<Error = E> + Write<Error = E>,
    E: Debug
[src]

pub fn new(i2c: I2C, addr: SlaveAddr) -> Result<Self, Error<E>>[src]

Create a new LIS2DH12 driver from the given I2C peripheral

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

Destroy driver instance, return I2C bus instance

pub fn get_device_id(&mut self) -> Result<u8, Error<E>>[src]

WHO_AM_I register

pub fn set_mode(&mut self, mode: Mode) -> Result<(), Error<E>>[src]

Operating mode selection, CTRL_REG1: LPen bit, CTRL_REG4: HR bit

pub fn set_odr(&mut self, odr: Odr) -> Result<(), Error<E>>[src]

Data rate selection, CTRL_REG1: ODR

pub fn enable_axis(
    &mut self,
    (x, y, z): (bool, bool, bool)
) -> Result<(), Error<E>>
[src]

X,Y,Z-axis enable, CTRL_REG1: Xen, Yen, Zen

pub fn set_bdu(&mut self, bdu: bool) -> Result<(), Error<E>>[src]

Block data update, CTRL_REG4: BDU

pub fn set_fs(&mut self, fs: FullScale) -> Result<(), Error<E>>[src]

Full-scale selection, CTRL_REG4: FS

pub fn enable_fifo(&mut self, enable: bool) -> Result<(), Error<E>>[src]

FIFO enable, CTRL_REG5: FIFO_EN

pub fn get_status(&mut self) -> Result<DataStatus, Error<E>>[src]

Data status, STATUS_REG: as DataStatus {zyxor: ZYXOR, xyzor: (XOR, YOR, ZOR), zyxda: ZYXDA, xyzda: (XDA, YDA, ZDA)}

pub fn set_fm(&mut self, fm: FifoMode) -> Result<(), Error<E>>[src]

FIFO mode selection, FIFO_CTRL_REG: FM

pub fn set_fth(&mut self, fth: u8) -> Result<(), Error<E>>[src]

FIFO threshold, FIFO_CTRL_REG: FTH

pub fn enable_temp(&mut self, enable: bool) -> Result<(), Error<E>>[src]

Temperature sensor enable, TEMP_CFG_REG: TEMP_EN, the BDU bit in CTRL_REG4 is also set

pub fn get_temp_status(&mut self) -> Result<(bool, bool), Error<E>>[src]

Temperature data status, STATUS_REG_AUX: TOR - Temperature data overrun, TDA - Temperature new data available

pub fn get_temp_out(&mut self) -> Result<(i8, u8), Error<E>>[src]

Temperature sensor data, OUT_TEMP_H, OUT_TEMP_L

pub fn get_ref(&mut self) -> Result<u8, Error<E>>[src]

REFERENCE register

Trait Implementations

impl<I2C, E> Accelerometer<I16x3> for Lis2dh12<I2C> where
    I2C: WriteRead<Error = E> + Write<Error = E>,
    E: Debug
[src]

type Error = Error<E>

Error type

fn acceleration(&mut self) -> Result<I16x3, Error<E>>[src]

Get acceleration reading from the accelerometer

Auto Trait Implementations

impl<I2C> Unpin for Lis2dh12<I2C> where
    I2C: Unpin

impl<I2C> Send for Lis2dh12<I2C> where
    I2C: Send

impl<I2C> Sync for Lis2dh12<I2C> where
    I2C: Sync

Blanket Implementations

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> Into<U> for T where
    U: From<T>, 
[src]

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

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.

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self