9 unstable releases

0.5.2 Dec 17, 2023
0.5.1 Apr 9, 2023
0.4.1 Sep 17, 2022
0.4.0 Jan 9, 2022
0.1.2 Feb 15, 2021

#3 in #datasheet

Download history 3/week @ 2023-11-03 9/week @ 2023-11-10 2/week @ 2023-11-17 9/week @ 2023-11-24 27/week @ 2023-12-01 1/week @ 2023-12-08 38/week @ 2023-12-15 22/week @ 2023-12-22 1/week @ 2023-12-29 11/week @ 2024-01-05 1/week @ 2024-01-12 6/week @ 2024-01-19 10/week @ 2024-01-26 9/week @ 2024-02-02 14/week @ 2024-02-09 120/week @ 2024-02-16

153 downloads per month

MIT license

47KB
1K SLoC

Build Status Docs.rs Crates.io

Table of Contents

About the Project 📃

This is a simple driver for ST's ism330dhcx sensor.

Documentation for that sensor can be found at ST's website

Usage 👀

Check out the examples folder for simple implementation

To declare a sensor is pretty simple:

let sensor = Ism330Dhcx::new(&mut i2c).unwrap()

If you want to use another address for the chip, you can do:

let sensor = Ism330Dhcx::new_with_address(&mut i2c, 0x6au8).unwrap()

Or alter it after the fact

sensor.set_address(0x6au8);

All registers have the bits addressed by their function, for example here se set the BOOT register in the CTRL_3C register to 1

sensor.ctrl3c.set_boot(i2c, true).unwrap();

For bits that operate together, they have their custom type abstracted. For example, to set the accelerometer data rate you have to operate 4 bits. But here you just have to specify your desired data rate and the driver takes care of it.

// Sets the following bits
// ODR_XL3 to 0
// ODR_XL2 to 0
// ODR_XL1 to 1
// ODR_XL0 to 1

sensor
    .ctrl1xl
    .set_accelerometer_data_rate(i2c, ctrl1xl::Odr_Xl::Hz52)
    .unwrap();

Help wanted 🤝

All contributions are welcome!

If you are using or plan to use this create don't hesitate to open an issue or a PR.

Multiple registers are yet to be referenced!

License

See LICENSE for more details.

Dependencies

~0.6–1.1MB
~24K SLoC