This is a simple driver for ST's iis2mdc sensor.
Documentation for that sensor can be found at ST's website
Check out the examples folder for simple implementation
To declare a sensor is pretty simple:
let mut sensor = Iis2mdc::new(&mut i2c).unwrap();To configure the sensor, use the high-level methods:
use iis2mdc::{CfgRegAConfig, Odr};
sensor.set_odr(&mut i2c, Odr::Hz50).unwrap();
sensor.set_comp_temp_en(&mut i2c, true).unwrap();To read measurements:
use iis2mdc::Magnetometer;
let mag = sensor.get_magnetometer(&mut i2c).unwrap();
println!("Mag: {:?}", mag.as_ut());All contributions are welcome!
If you are using or plan to use this create don't hesitate to open an issue or a PR.
See LICENSE for more details.