4 releases (breaking)
Uses new Rust 2024
| 0.4.0 | Jul 30, 2025 |
|---|---|
| 0.3.0 | Jul 28, 2025 |
| 0.2.0 | Jul 26, 2025 |
| 0.1.0 | Jul 26, 2025 |
#2672 in Embedded development
147 downloads per month
54KB
1K
SLoC
LIS2DH
Driver crate for the ST LIS2DH12 accelerometer. Compatible with embedded-hal and embedded-hal-async traits.
Example usage
let mut accelerometer = Lis2dh::new(i2c, Sa0Pad::High);
accelerometer.set_mode(Mode::Normal).await.unwrap();
accelerometer.set_output_data_rate(OutputDataRate::Hz100).await.unwrap();
accelerometer.configure_int1(&Int1Config::FifoWatermark).await.unwrap();
accelerometer.configure_fifo(FifoConfig::Stream { watermark: 9 }).await.unwrap();
let mut data = [AccelerationData::default(); 10];
loop {
// Wait until the accelerometer fills the FIFO
accelerometer_int1.wait_for_high().await;
accelerometer.read_data(&mut data).await.unwrap();
}
Resources
License
This work is licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Dependencies
~190KB