Crates.io | mcp3424 |
lib.rs | mcp3424 |
version | 0.2.0 |
source | src |
created_at | 2024-06-27 21:01:06.322297 |
updated_at | 2024-07-02 20:38:55.250172 |
description | Async Rust driver for the MCP3422/3/4 ADC. |
homepage | |
repository | https://github.com/kKdH/mcp3424-rs |
max_upload_size | |
id | 1286168 |
size | 66,506 |
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.
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"),
}
Licensed using the Apache License Version 2.0.
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.