1 unstable release
Uses new Rust 2024
| 0.1.0 | Oct 16, 2025 |
|---|
#782 in Hardware support
170 downloads per month
49KB
1K
SLoC
MC3479
A Rust driver for the MEMSIC MC3479 16-bit 3-axis accelerometer.
lib.rs:
MC3479
A Rust driver for the MEMSIC MC3479 16-bit 3-axis accelerometer.
The device has two different operational states, standby and wake, and reconfiguring the device
is only allowed in the standby state. These two states are realized in the form of two
different Rust types, StandbyState and WakeState, with methods that allow for
transitioning from one state to the other.
Example
let mut standby = match mc3479::StandbyState::new(i2c, TargetAddr::Addr0) {
Ok(standby) => standby,
Err((err, _i2c)) => {
panic!("Failed to initialize MC3479 driver: {err}");
},
};
standby.set_sample_rate(SampleRate::_1000Hz).unwrap();
standby.set_range(Range::_8g).unwrap();
standby.set_fifo_enabled(true).unwrap();
let wake = match standby.wake() {
Ok(wake) => wake,
Err((err, _standby)) => panic!("Failed to transition to wake state: {err}"),
};
Dependencies
~56KB