1 unstable release
0.1.0 | Feb 3, 2023 |
---|
#1248 in Embedded development
14KB
278 lines
MCP346x Sigma-Delta ADC
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
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
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