[−][src]Struct lis3dsh::Lis3dsh
Driver for the LIS3DSH accelerometer.
Implementations
impl<IFACE> Lis3dsh<IFACE> where
IFACE: Interface,
[src]
IFACE: Interface,
pub fn init<DELAY>(&mut self, delay: &mut DELAY) -> Result<(), IFACE::Error> where
DELAY: DelayMs<u8>,
[src]
DELAY: DelayMs<u8>,
Initializes the accelerometer with these steps:
- Soft reset
- Block for 5ms
- Enable X, Y, & Z channels at 100Hz
- 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]
SPI: Transfer<u8>,
CSPIN: OutputPin,
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,
IFACE: Send,
impl<IFACE> Sync for Lis3dsh<IFACE> where
IFACE: Sync,
IFACE: Sync,
impl<IFACE> Unpin for Lis3dsh<IFACE> where
IFACE: Unpin,
IFACE: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,