pcf8591-hal 0.1.0

Embedded-HAL driver for interfacing with the PCF8591 8-bit A/D and D/A converter
Documentation
  • Coverage
  • 54.55%
    6 out of 11 items documented0 out of 5 items with examples
  • Size
  • Source code size: 21.05 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 250 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • hamaluik/pcf8591
    1 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • hamaluik

Rust Embedded-HAL PCF8591 Driver

For interfacing with the PCF8591 8-bit A/D and D/A converter. Currently only handles reading a single single-ended ADC at a time.

Example

With the PCF8591 connected to a raspberry pi:

use linux_embedded_hal::I2cdev;
use pcf8591::*;

pub fn main() {
    let i2c = I2cdev::new("/dev/i2c-1").expect("can open i2c device");
    let mut adc = PCF8591::new(i2c, PCF8591_DEFAULT_ADDRESS);

    loop {
        let a0 = adc.read(PCFADCNum::A0).expect("can read ADC0");
        println!("a0: {}", a0);
        std::thread::sleep(std::time::Duration::from_secs(1));
    }
}