Loading...
Searching...
No Matches
max31865.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025 David Picard
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
88
89/* Add header includes here */
90
91#ifdef __cplusplus
92extern "C" {
93#endif
94
95#include "periph/spi.h"
96
116
126typedef struct {
127 spi_t spi;
129 uint8_t cfg_byte;
132 const int32_t (*lut)[][MAX31865_LUTCOL_NUMOF];
133 const int lut_numlines;
135
139typedef struct {
141} max31865_t;
142
153
165
175void max31865_clear_fault(const max31865_t *dev, uint8_t *config);
176
193int max31865_read(const max31865_t *dev, int32_t *rtd_temperature_cdegc);
194
209int max31865_read_raw(const max31865_t *dev, uint16_t *raw_data);
210
223int max31865_raw_to_data(const max31865_t *dev, uint16_t raw_data, int32_t *rtd_temperature_cdegc);
224
246
257void max31865_switch_vbias(const max31865_t *dev, bool enable);
258
267
268#ifdef __cplusplus
269}
270#endif
271
int max31865_init(max31865_t *dev, const max31865_params_t *params)
Initialize the given device.
int max31865_detect_fault(const max31865_t *dev, max31865_fault_t *flt_code)
Run an automatic fault-detection cycle.
void max31865_oneshot(const max31865_t *dev)
Start a one-shot conversion.
void max31865_switch_vbias(const max31865_t *dev, bool enable)
Switch VBIAS on or off.
int max31865_raw_to_data(const max31865_t *dev, uint16_t raw_data, int32_t *rtd_temperature_cdegc)
Convert the raw data from the MAX31865 temperature.
int max31865_read_raw(const max31865_t *dev, uint16_t *raw_data)
Read raw data from the MAX31865.
void max31865_clear_fault(const max31865_t *dev, uint8_t *config)
Clear the fault flag.
max31865_fault_t
Fault status of the MAX31865.
Definition max31865.h:146
max31865_lutcols_t
Lookup table column indexes.
Definition max31865.h:109
int max31865_read(const max31865_t *dev, int32_t *rtd_temperature_cdegc)
Read data from the MAX31865.
@ MAX31865_FAULT_NO_FAULT
No fault.
Definition max31865.h:147
@ MAX31865_FAULT_CIRCUIT
Open or shorted circuit.
Definition max31865.h:150
@ MAX31865_FAULT_RTD_HIGH
The RTD value is too high.
Definition max31865.h:148
@ MAX31865_FAULT_RTD_LOW
The RTD value is too small.
Definition max31865.h:149
@ MAX31865_FAULT_VOLTAGE
Overvoltage or undervoltage on the FORCE or RTD pin.
Definition max31865.h:151
@ MAX31865_LUTCOL_A0
a0 coefficient column index
Definition max31865.h:112
@ MAX31865_LUTCOL_TEMP
Temperature column index (µ°C)
Definition max31865.h:111
@ MAX31865_LUTCOL_NUMOF
Number of columns in the lookup table.
Definition max31865.h:114
@ MAX31865_LUTCOL_A1
a1 coefficient column index
Definition max31865.h:113
@ MAX31865_LUTCOL_CODE
ADC code column index.
Definition max31865.h:110
gpio_t spi_cs_t
Chip select pin type overlaps with gpio_t so it can be casted to this.
Definition spi.h:157
Low-level SPI peripheral driver interface definition.
Device initialization parameters.
Definition max31865.h:126
spi_t spi
SPI device.
Definition max31865.h:127
int32_t temp_high_threshold
High threshold temperature (c°C)
Definition max31865.h:131
uint8_t cfg_byte
Initial value of the configuration register.
Definition max31865.h:129
const int32_t(* lut)[][MAX31865_LUTCOL_NUMOF]
Lookup table.
Definition max31865.h:132
spi_cs_t cs_pin
Chip select pin.
Definition max31865.h:128
int32_t temp_low_threshold
Low threshold temperature (c°C)
Definition max31865.h:130
const int lut_numlines
Number of lines in the lookup table.
Definition max31865.h:133
Device descriptor for the driver.
Definition max31865.h:139
const max31865_params_t * params
device configuration
Definition max31865.h:140