[][src]Struct lis3dsh::Lis3dsh

pub struct Lis3dsh<IFACE> where
    IFACE: Interface
{ /* fields omitted */ }

Driver for the LIS3DSH accelerometer.

Implementations

impl<IFACE> Lis3dsh<IFACE> where
    IFACE: Interface
[src]

pub fn init<DELAY>(&mut self, delay: &mut DELAY) -> Result<(), IFACE::Error> where
    DELAY: DelayMs<u8>, 
[src]

Initializes the accelerometer with these steps:

  1. Soft reset
  2. Block for 5ms
  3. Enable X, Y, & Z channels at 100Hz
  4. Enable the DRDY signal

pub fn read_data(&mut self) -> Result<[i16; 3], IFACE::Error>[src]

Reads the accelerometer data

The returns array contains [x, y, z] in that order

pub fn read_temp_data(&mut self) -> Result<i8, IFACE::Error>[src]

Reads the tempurature data

pub fn is_data_ready(&mut self) -> Result<bool, IFACE::Error>[src]

Checks the STATUS register to see if data is ready

pub fn who_am_i(&mut self) -> Result<u8, IFACE::Error>[src]

Gets the value in the WHO_AM_I register. Should match EXPECTED_WHO_AM_I

pub fn status(&mut self) -> Result<Status, IFACE::Error>[src]

Gets the value in the STATUS register

impl<SPI, CSPIN> Lis3dsh<Spi<SPI, CSPIN>> where
    SPI: Transfer<u8>,
    CSPIN: OutputPin
[src]

pub fn new_spi(spi: SPI, cs: CSPIN) -> Self[src]

Creates a Lis3dsh using the SPI interface

The 4-wire variant is used, and a digital I/O pin is used as the chip select

pub fn into_inner(self) -> (SPI, CSPIN)[src]

Converts the Lis3dsh into the constituant SPI interface and chip select pin

Auto Trait Implementations

impl<IFACE> Send for Lis3dsh<IFACE> where
    IFACE: Send

impl<IFACE> Sync for Lis3dsh<IFACE> where
    IFACE: Sync

impl<IFACE> Unpin for Lis3dsh<IFACE> where
    IFACE: Unpin

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.