| Crates.io | max31855 |
| lib.rs | max31855 |
| version | 0.1.0 |
| created_at | 2020-01-08 22:29:08.824512+00 |
| updated_at | 2020-01-08 22:29:08.824512+00 |
| description | Driver for MAX31855 SPI thermocouple converter |
| homepage | https://github.com/cs2dsb/max31855.rs |
| repository | https://github.com/cs2dsb/max31855.rs |
| max_upload_size | |
| id | 196720 |
| size | 25,471 |
Driver for MAX31855 thermocouple converter using traits from embedded-hal.
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.