Loading...
Searching...
No Matches
max31865.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2025 David Picard
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
9#pragma once
10
91
92/* Add header includes here */
93
94#ifdef __cplusplus
95extern "C" {
96#endif
97
98#include "periph/spi.h"
99
119
129typedef struct {
130 spi_t spi;
132 uint8_t cfg_byte;
135 const int32_t (*lut)[][MAX31865_LUTCOL_NUMOF];
136 const int lut_numlines;
138
142typedef struct {
144} max31865_t;
145
156
168
178void max31865_clear_fault(const max31865_t *dev, uint8_t *config);
179
196int max31865_read(const max31865_t *dev, int32_t *rtd_temperature_cdegc);
197
212int max31865_read_raw(const max31865_t *dev, uint16_t *raw_data);
213
226int max31865_raw_to_data(const max31865_t *dev, uint16_t raw_data, int32_t *rtd_temperature_cdegc);
227
249
260void max31865_switch_vbias(const max31865_t *dev, bool enable);
261
270
271#ifdef __cplusplus
272}
273#endif
274
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:149
max31865_lutcols_t
Lookup table column indexes.
Definition max31865.h:112
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:150
@ MAX31865_FAULT_CIRCUIT
Open or shorted circuit.
Definition max31865.h:153
@ MAX31865_FAULT_RTD_HIGH
The RTD value is too high.
Definition max31865.h:151
@ MAX31865_FAULT_RTD_LOW
The RTD value is too small.
Definition max31865.h:152
@ MAX31865_FAULT_VOLTAGE
Overvoltage or undervoltage on the FORCE or RTD pin.
Definition max31865.h:154
@ MAX31865_LUTCOL_A0
a0 coefficient column index
Definition max31865.h:115
@ MAX31865_LUTCOL_TEMP
Temperature column index (µ°C)
Definition max31865.h:114
@ MAX31865_LUTCOL_NUMOF
Number of columns in the lookup table.
Definition max31865.h:117
@ MAX31865_LUTCOL_A1
a1 coefficient column index
Definition max31865.h:116
@ MAX31865_LUTCOL_CODE
ADC code column index.
Definition max31865.h:113
gpio_t spi_cs_t
Chip select pin type overlaps with gpio_t so it can be casted to this.
Definition spi.h:135
Low-level SPI peripheral driver interface definition.
Device initialization parameters.
Definition max31865.h:129
spi_t spi
SPI device.
Definition max31865.h:130
int32_t temp_high_threshold
High threshold temperature (c°C)
Definition max31865.h:134
uint8_t cfg_byte
Initial value of the configuration register.
Definition max31865.h:132
const int32_t(* lut)[][MAX31865_LUTCOL_NUMOF]
Lookup table.
Definition max31865.h:135
spi_cs_t cs_pin
Chip select pin.
Definition max31865.h:131
int32_t temp_low_threshold
Low threshold temperature (c°C)
Definition max31865.h:133
const int lut_numlines
Number of lines in the lookup table.
Definition max31865.h:136
Device descriptor for the driver.
Definition max31865.h:142
const max31865_params_t * params
device configuration
Definition max31865.h:143