1 unstable release

0.1.0 Jan 8, 2020

#1413 in Hardware support

Download history 44/week @ 2024-07-27 86/week @ 2024-08-03 7/week @ 2024-08-10 7/week @ 2024-08-17 26/week @ 2024-08-24 28/week @ 2024-08-31 39/week @ 2024-09-07 49/week @ 2024-09-14 58/week @ 2024-09-21 20/week @ 2024-09-28 4/week @ 2024-10-05 44/week @ 2024-10-12 5/week @ 2024-10-19 15/week @ 2024-10-26 72/week @ 2024-11-02 61/week @ 2024-11-09

175 downloads per month

MIT/Apache

14KB
166 lines

max31855

Driver for MAX31855 thermocouple converter using traits from embedded-hal.

Crate Documentation

Features

  • Read thermocouple temperature
  • Read internal reference junction temperature
  • Read fault data (missing thermocouple, short to ground or short to vcc)
  • Supports 16-bit (thermocouple + fault only) or 32-bit (thermocouple, internal and full fault details)
  • Supports Celsius, Fahrenheit or Kelvin units
  • Supports returning raw (ADC count) readings

Example:

    let freq: Hertz = 4.mhz().into();
    let mode = Mode {
        polarity: Polarity::IdleLow,
        phase: Phase::CaptureOnFirstTransition
    };

    let mut spi = Spi::spi2(
        device.SPI2,
        (sck_pin, miso_pin, mosi_pin)
        mode,
        freq,
        clocks,
        &mut rcc.apb1
    );

    // Full 32-bit read, result contains both thermocouple and internal temperatures
    match spi.read_all(&mut cs_pin, Unit::Celsius) {
        Ok(v) => info!("Ok: {:?}", v),
        Err(e) => info!("Err: {:?}", e),
    }

    // Just thermocouple 16-bit read
    match spi.read_thermocouple(&mut cs_pin, Unit::Celsius) {
        Ok(v) => info!("Ok: {:?}", v),
        Err(e) => info!("Err: {:?}", e),
    }

Free and open source software distributed under the terms of both the MIT License and the Apache License 2.0.

Dependencies

~100KB