Crate max31855

Source
Expand description

§max31855

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

§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),
    }

Structs§

FullResult
Represents the data contained in a full 32-bit read from the MAX31855 as degrees in the included Unit
FullResultRaw
Represents the data contained in a full 32-bit read from the MAX31855 as raw ADC counts

Enums§

Error
Possible errors returned by this crate
Reading
Possible MAX31855 readings
Unit
The temperature unit to use

Traits§

Max31855
Trait enabling using the MAX31855