Driver for the SPI Thermocouple-to-Digital Converter MAX31855.
More...
Driver for the SPI Thermocouple-to-Digital Converter MAX31855.
The MAX31855 performs cold-junction compensation and digitizes
the signal from a K-, J-, N-, T-, S-, R-, or E-type
thermocouple. The data is output in a signed 14-bit,
SPI-compatible, read-only format. This converter resolves
temperatures to 0.25°C, allows readings as high as +1800°C and
as low as -270°C, and exhibits thermocouple accuracy of ±2°C
for temperatures ranging from -200°C to +700°C for K-type
thermocouples.
- Note
- See the datasheet for more information: https://www.analog.com/media/en/technical-documentation/data-sheets/MAX31855.pdf
-
This driver doesn't require a MOSI line, as the MAX31855 is a read-only.
◆ max31855_fault_t
Fault status of the MAX31855.
Enumerator |
---|
MAX31855_FAULT_VCC_SHORT | VCC short-circuit.
|
MAX31855_FAULT_GND_SHORT | GND short-circuit.
|
MAX31855_FAULT_OPEN_CIRCUIT | Open circuit.
|
MAX31855_FAULT_NO_FAULT | No fault.
|
Definition at line 66 of file max31855.h.
◆ max31855_init()
Initialize the given device.
- Parameters
-
[in,out] | dev | Device descriptor of the driver |
[in] | params | Initialization parameters |
- Return values
-
0 | on success |
-ENXIO | invalid SPI device |
-EINVAL | invalid SPI CS pin/line |
◆ max31855_raw_to_data()
Parse the raw data from the MAX31855 to the data structure.
- Parameters
-
[in] | raw_data | Raw data from the MAX31855 |
[out] | data | Pointer to the data structure. |
- Precondition
data
must not be NULL
◆ max31855_read()
Read data from the MAX31855.
This is a shortcut to read raw data and parse it to the data structure.
- Parameters
-
[in] | dev | Device descriptor of the driver |
[out] | data | Pointer to the data structure. |
- Precondition
dev
and data
must not be NULL
- Return values
-
0 | on success |
-EIO | if there is an error detected by the MAX31855. For a detailed error description, check the fault field of the data structure. On this case, temperature fields are not valid. |
◆ max31855_read_raw()
void max31855_read_raw |
( |
max31855_t * |
dev, |
|
|
uint32_t * |
data |
|
) |
| |
Read raw data from the MAX31855.
- Parameters
-
[in] | dev | Device descriptor of the driver |
[out] | data | Pointer where to store the raw data. |
- Precondition
dev
and data
must not be NULL