#adc #microchip #driver #embedded-hal-driver #mcp3461

no-std mcp346x

Platform-agnostic driver for MCP346x Sigma-Delta ADC

1 unstable release

0.1.0 Feb 3, 2023

#1002 in Embedded development

21 downloads per month

MIT/Apache

14KB
278 lines

MCP346x Sigma-Delta ADC

crates.io docs.rs

This crate contains a platform-agnostic driver for the MCP346[1/2/4] Sigma-Delta ADC, using the embedded-hal traits.

Currently, you can:

  • Initialize the device
  • Configure Input MUX and IRQ Pullup
  • Set the conversion or power down mode
  • Obtain measurements

Documentation

Usage

Single Measurement

use mcp346x::*;

let spi_pins = (sck, miso, mosi);
let spi = Spi::new(p.SPI0, spi_pins, Frequency::K500, MODE_0);

let address = 0b01; // This is the default address for most chips
let mut adc = MCP346x::new(spi, address).into_continuous_mode()?;

adc.set_clock_source(mcp346x::ClockSource::Internal)?;
adc.set_irq_internal_pullup(true)?;

let voltage = adc.measure()?;

Status

  • Initialization
  • Powerdown/wakeup/conversion
  • Take Measurements
  • Input MUX configuration
  • SCAN mode
  • Expose other Configurations
  • Communication CRC checksums

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~790KB
~17K SLoC