LibDriver MAX31865
Loading...
Searching...
No Matches
driver_max31865.h
Go to the documentation of this file.
1
37
38#ifndef DRIVER_MAX31865_H
39#define DRIVER_MAX31865_H
40
41#include <math.h>
42#include <stdio.h>
43#include <stdint.h>
44#include <string.h>
45
46#ifdef __cplusplus
47extern "C"{
48#endif
49
55
60
64typedef enum
65{
69
73typedef enum
74{
79
88
97
108
119
132
136typedef struct max31865_handle_s
137{
138 uint8_t (*spi_init)(void);
139 uint8_t (*spi_deinit)(void);
140 uint8_t (*spi_read)(uint8_t reg, uint8_t *buf, uint16_t len);
141 uint8_t (*spi_write)(uint8_t reg, uint8_t *buf, uint16_t len);
142 void (*delay_ms)(uint32_t ms);
143 void (*debug_print)(const char *const fmt, ...);
144 uint8_t inited;
145 uint8_t resistor;
148
164
168
175
182#define DRIVER_MAX31865_LINK_INIT(HANDLE, STRUCTURE) memset(HANDLE, 0, sizeof(STRUCTURE))
183
190#define DRIVER_MAX31865_LINK_SPI_INIT(HANDLE, FUC) (HANDLE)->spi_init = FUC
191
198#define DRIVER_MAX31865_LINK_SPI_DEINIT(HANDLE, FUC) (HANDLE)->spi_deinit = FUC
199
206#define DRIVER_MAX31865_LINK_SPI_READ(HANDLE, FUC) (HANDLE)->spi_read = FUC
207
214#define DRIVER_MAX31865_LINK_SPI_WRITE(HANDLE, FUC) (HANDLE)->spi_write = FUC
215
222#define DRIVER_MAX31865_LINK_DELAY_MS(HANDLE, FUC) (HANDLE)->delay_ms = FUC
223
230#define DRIVER_MAX31865_LINK_DEBUG_PRINT(HANDLE, FUC) (HANDLE)->debug_print = FUC
231
235
242
251uint8_t max31865_info(max31865_info_t *info);
252
263uint8_t max31865_init(max31865_handle_t *handle);
264
276uint8_t max31865_deinit(max31865_handle_t *handle);
277
291uint8_t max31865_single_read(max31865_handle_t *handle, uint16_t *raw, float *temp);
292
304
316
330uint8_t max31865_continuous_read(max31865_handle_t *handle, uint16_t *raw, float *temp);
331
344
357
370
383
394uint8_t max31865_set_reference_resistor(max31865_handle_t *handle, float value);
395
406uint8_t max31865_get_reference_resistor(max31865_handle_t *handle, float *value);
407
419
431
444
457
469
481uint8_t max31865_get_fault_status(max31865_handle_t *handle, uint8_t *status);
482
494uint8_t max31865_set_high_fault_threshold(max31865_handle_t *handle, uint16_t threshold);
495
507uint8_t max31865_get_high_fault_threshold(max31865_handle_t *handle, uint16_t *threshold);
508
520uint8_t max31865_set_low_fault_threshold(max31865_handle_t *handle, uint16_t threshold);
521
533uint8_t max31865_get_low_fault_threshold(max31865_handle_t *handle, uint16_t *threshold);
534
547
560
564
571
584uint8_t max31865_set_reg(max31865_handle_t *handle, uint8_t reg, uint8_t value);
585
598uint8_t max31865_get_reg(max31865_handle_t *handle, uint8_t reg, uint8_t *value);
599
603
607
608#ifdef __cplusplus
609}
610#endif
611
612#endif
uint8_t max31865_set_low_fault_threshold(max31865_handle_t *handle, uint16_t threshold)
set the low fault threshold
uint8_t max31865_get_wire(max31865_handle_t *handle, max31865_wire_t *wire)
get the pt resistor wire
max31865_bool_t
max31865 bool enumeration definition
uint8_t max31865_set_vbias(max31865_handle_t *handle, max31865_bool_t enable)
set the chip vbias
uint8_t max31865_set_wire(max31865_handle_t *handle, max31865_wire_t wire)
set the pt resistor wire
uint8_t max31865_get_reference_resistor(max31865_handle_t *handle, float *value)
get the reference resistor
struct max31865_info_s max31865_info_t
max31865 information structure definition
uint8_t max31865_continuous_read(max31865_handle_t *handle, uint16_t *raw, float *temp)
read data continuously
max31865_resistor_t
max31865 resistor type enumeration definition
uint8_t max31865_single_read(max31865_handle_t *handle, uint16_t *raw, float *temp)
read data once
uint8_t max31865_init(max31865_handle_t *handle)
initialize the chip
uint8_t max31865_set_resistor(max31865_handle_t *handle, max31865_resistor_t resistor)
set the pt resistor
max31865_fault_detection_cycle_control_t
max31865 fault detection cycle control enumeration definition
max31865_wire_t
max31865 wire type enumeration definition
max31865_fault_status_t
max31865 fault status enumeration definition
uint8_t max31865_get_resistor(max31865_handle_t *handle, max31865_resistor_t *resistor)
get the pt resistor
uint8_t max31865_set_reference_resistor(max31865_handle_t *handle, float value)
set the reference resistor
uint8_t max31865_set_fault_detection_cycle_control(max31865_handle_t *handle, max31865_fault_detection_cycle_control_t control)
set the fault detection cycle control
uint8_t max31865_get_fault_status(max31865_handle_t *handle, uint8_t *status)
get the fault status
uint8_t max31865_set_filter_select(max31865_handle_t *handle, max31865_filter_select_t filter)
set the filter type
uint8_t max31865_get_filter_select(max31865_handle_t *handle, max31865_filter_select_t *filter)
get the filter type
max31865_fault_detection_cycle_control_status_t
max31865 fault detection cycle control status enumeration definition
uint8_t max31865_get_low_fault_threshold(max31865_handle_t *handle, uint16_t *threshold)
get the low fault threshold
uint8_t max31865_get_fault_detection_cycle_control(max31865_handle_t *handle, max31865_fault_detection_cycle_control_status_t *status)
get the fault detection cycle control
uint8_t max31865_clear_fault_status(max31865_handle_t *handle)
clear all fault status
uint8_t max31865_stop_continuous_read(max31865_handle_t *handle)
stop reading
uint8_t max31865_get_vbias(max31865_handle_t *handle, max31865_bool_t *enable)
get the chip vbias
struct max31865_handle_s max31865_handle_t
max31865 handle structure definition
uint8_t max31865_info(max31865_info_t *info)
get chip's information
uint8_t max31865_set_high_fault_threshold(max31865_handle_t *handle, uint16_t threshold)
set the high fault threshold
uint8_t max31865_get_high_fault_threshold(max31865_handle_t *handle, uint16_t *threshold)
get the high fault threshold
max31865_filter_select_t
max31865 filter select enumeration definition
uint8_t max31865_start_continuous_read(max31865_handle_t *handle)
start reading
uint8_t max31865_deinit(max31865_handle_t *handle)
close the chip
@ MAX31865_BOOL_TRUE
@ MAX31865_BOOL_FALSE
@ MAX31865_RESISTOR_1000PT
@ MAX31865_RESISTOR_100PT
@ MAX31865_FAULT_DETECTION_CYCLE_CONTROL_MANUAL_DELAY_CYCLE_1
@ MAX31865_FAULT_DETECTION_CYCLE_CONTROL_NO_ACTION
@ MAX31865_FAULT_DETECTION_CYCLE_CONTROL_MANUAL_DELAY_CYCLE_2
@ MAX31865_FAULT_DETECTION_CYCLE_CONTROL_AUTOMATIC_DELAY
@ MAX31865_WIRE_4
@ MAX31865_WIRE_3
@ MAX31865_WIRE_2
@ MAX31865_FAULT_STATUS_REFIN_LESS_THAN_0P85_VBIAS
@ MAX31865_FAULT_STATUS_OVER_UNDER_VOLTAGE
@ MAX31865_FAULT_STATUS_REFIN_MORE_THAN_0P85_VBIAS
@ MAX31865_FAULT_STATUS_RTDIN_LESS_THAN_0P85_VBIAS
@ MAX31865_FAULT_STATUS_RTD_LOW_THRESHOLD
@ MAX31865_FAULT_STATUS_RTD_HIGH_THRESHOLD
@ MAX31865_FAULT_DETECTION_CYCLE_CONTROL_STATUS_MANUAL_DELAY_CYCLE_1_RUNNING
@ MAX31865_FAULT_DETECTION_CYCLE_CONTROL_STATUS_FINISHED
@ MAX31865_FAULT_DETECTION_CYCLE_CONTROL_STATUS_AUTOMATIC_RUNNING
@ MAX31865_FAULT_DETECTION_CYCLE_CONTROL_STATUS_MANUAL_DELAY_CYCLE_2_RUNNING
@ MAX31865_FILTER_SELECT_60HZ
@ MAX31865_FILTER_SELECT_50HZ
uint8_t max31865_get_reg(max31865_handle_t *handle, uint8_t reg, uint8_t *value)
get the chip register
uint8_t max31865_set_reg(max31865_handle_t *handle, uint8_t reg, uint8_t value)
set the chip register
max31865 handle structure definition
uint8_t(* spi_init)(void)
void(* delay_ms)(uint32_t ms)
uint8_t(* spi_read)(uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* spi_write)(uint8_t reg, uint8_t *buf, uint16_t len)
void(* debug_print)(const char *const fmt,...)
uint8_t(* spi_deinit)(void)
max31865 information structure definition
char manufacturer_name[32]