lis3dh-spi

build_workflow Crates.io Version Crates.io Downloads No Std

This crate is a no_std driver for the LIS3DH accelerometer using SPI.

Datasheet

https://www.st.com/resource/en/datasheet/lis3dh.pdf

About this driver

This driver is not consuming the SPI bus the communication is running on. Bus has to be passed as mutable reference when interacting with the LIS3DH.

Usage

Add this to your Cargo.toml:

toml [dependencies] lis3dh-spi = "0.0.3"

And this to your main.rs

```rust

let mut accelerometer = lis3dh_spi::Lis3dh::default();

accelerometer.setlpen(LPEn::HighResolutionNormalMode); accelerometer.setoutputdatarate(ODR::Hz400); accelerometer.writeallsettings(&mut chipselectpin, &mut spibus).ok(); let angleandgravityoffset = accelerometer.getangleandgravityoffset(&mut chipselectpin, &mut spi_bus).ok();

```