1 unstable release

0.1.0 Oct 19, 2020

#46 in #accelerometer

MIT license

16KB
379 lines

embedded-hal driver for LIS3DSH

Usage

Include the library in Your Cargo.toml

[dependencies.fk-lis3dsh]

Use embedded-hal to create spi and cs and create accelerometer:

Create accelerometer with default configuration, only SPIBus implemented for now.

let mut acc =
            LIS3DSH::new_with_interface(lis3dsh::commbus::SPIBus::new(spi, cs), &mut delay).unwrap();

Access accelerometer data

if acc.has_data().unwrap() {
    let accel = acc.accel_raw().unwrap();
    rprintln!("{}\t{}\t{}",
                accel.x,
                accel.y,
                accel.z,
    );
}

Dependencies

~2MB
~48K SLoC