mcp3424

Crates.iomcp3424
lib.rsmcp3424
version0.2.0
sourcesrc
created_at2024-06-27 21:01:06.322297
updated_at2024-07-02 20:38:55.250172
descriptionAsync Rust driver for the MCP3422/3/4 ADC.
homepage
repositoryhttps://github.com/kKdH/mcp3424-rs
max_upload_size
id1286168
size66,506
Elmar Schug (kKdH)

documentation

https://docs.rs/mcp3424

README

github docs.rs crates.io

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.

Commit count: 9

cargo fmt