2 unstable releases
0.2.0 | Jul 2, 2024 |
---|---|
0.1.0 | Jun 27, 2024 |
#556 in Embedded development
58 downloads per month
55KB
966 lines
MCP3424
This crate provides an async Rust driver for the MCP342[2/3/4] ADC, based on the embedded-hal traits.
The MCP3422, MCP3423 and MCP3424 are low-noise, high accuracy delta-sigma A/D converter with differential inputs, on-board precision 2.048V reference voltage and up to 18 bits of resolution. The devices offer a two-wire I2C compatible serial interface.
Status
- One-Shot conversions.
- Continuous conversions.
- Configuration:
- Programmable gain amplifier (PGA)
- Resolution / Sample Rate
- Channel
- Async API
- Future based
- Stream based (optional)
- Defmt integration (optional)
- UOM integration (optional)
Appetizer
Trigger a one-shot conversion and awaits the result:
use mcp3424::{MCP3424, Configuration, OneShotMode};
let mut adc = MCP3424::new(i2c, 0x68, Delay, OneShotMode::new(&Configuration::default()));
match adc.measure().await {
Ok(value) => println!("Measured value: {:?}", value),
Err(_) => println!("Failed to measure"),
}
Documentation
License
Licensed using the Apache License Version 2.0.
Contributing
All contributions are welcome. Any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be licensed without any additional terms or conditions.
Dependencies
~77–630KB
~11K SLoC