Crates.io | mcp346x |
lib.rs | mcp346x |
version | 0.1.0 |
source | src |
created_at | 2023-02-03 17:06:28.637307 |
updated_at | 2023-02-03 17:06:28.637307 |
description | Platform-agnostic driver for MCP346x Sigma-Delta ADC |
homepage | |
repository | https://github.com/zandemax/mcp346x-rs |
max_upload_size | |
id | 775757 |
size | 13,690 |
This crate contains a platform-agnostic driver for the MCP346[1/2/4] Sigma-Delta ADC, using the embedded-hal
traits.
Currently, you can:
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()?;
Licensed under either of
at your option.
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.