#embedded-hal-driver #accelerometer #magnetometer #sensor #no-alloc #no-std

no-std lsm6dsox

Platform-agnostic embedded-hal driver for the ST LSM6DSOX iNEMO inertial module

1 stable release

1.0.1 Feb 16, 2024

#814 in Embedded development

OLFL-1.3

56KB
868 lines

lsm6dsox

Platform-agnostic embedded-hal driver for the STMicroelectronics LSM6DSOX iNEMO inertial module.

Provided functionality is inspired by the C implementation from ST, but tries to provide a higher level interface where possible.

To provide measurements the [accelerometer] traits and [measurements] crate are utilized.

Resources

Datasheet

LSM6DSOX at st.com

For application hints please also refer to the application note provided by ST.

Features

  • Accelerometer trait implementation
  • embedded-hal I²C support
  • Gyroscope
  • Tap recognition
  • Interrupts
  • Further features may be added in the future

Examples

use accelerometer::Accelerometer;
use lsm6dsox::*;

let mut lsm = lsm6dsox::Lsm6dsox::new(i2c, SlaveAddress::Low, delay);

lsm.setup()?;
lsm.set_accel_sample_rate(DataRate::Freq52Hz)?;
lsm.set_accel_scale(AccelerometerScale::Accel16g)?;
if let Ok(reading) = lsm.accel_norm() {
    println!("Acceleration: {:?}", reading);
}

License

Open Logistics Foundation License
Version 1.3, January 2023

See the LICENSE file in the top-level directory.

Contact

Fraunhofer IML Embedded Rust Group - embedded-rust@iml.fraunhofer.de

Dependencies

~1.5–2MB
~45K SLoC