fk-lis3dsh

Crates.iofk-lis3dsh
lib.rsfk-lis3dsh
version0.1.0
sourcesrc
created_at2020-10-19 17:10:41.874096
updated_at2020-10-19 17:10:41.874096
descriptionembedded-hal driver for LIS3D-SH Accelerometer
homepage
repositoryhttps://github.com/straend/fk-lis3dsh/
max_upload_size
id302982
size16,881
Tomas Strand (straend)

documentation

README

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,
    );
}
Commit count: 4

cargo fmt