Skip to content

sousandrei/ism330dhcx

Repository files navigation

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);

To configure the sensor, use the high-level methods:

sensor.set_accel_odr(&mut i2c, OdrXl::Hz52).unwrap();
sensor.set_boot(&mut 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.

sensor.set_accel_odr(&mut i2c, OdrXl::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.

About

Crate for driving the ism330dhcx sensor from ST

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages