no-OS
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
max31865.h
Go to the documentation of this file.
1/***************************************************************************/
34
35#ifndef __MAX31865_H__
36#define __MAX31865_H__
37
38#include <stdint.h>
39#include <stdbool.h>
40#include "no_os_spi.h"
41#include "no_os_util.h"
42
43#define MAX31865_READ_MASK 0x7F
44#define MAX31865_WRITE_MASK 0x80
45
46#define MAX31865_CONFIG_BIAS 0x80
47#define MAX31865_CONFIG_MODEAUTO 0x40
48#define MAX31865_CONFIG_MODEOFF 0xBF
49#define MAX31865_CONFIG_1SHOT 0x20
50#define MAX31865_CONFIG_3WIRE 0x10
51#define MAX31865_CONFIG_2_4WIRE 0xEF
52#define MAX31865_CONFIG_CLRFAULT_MASK 0xD3
53#define MAX31865_CONFIG_FAULTSTAT 0x02
54#define MAX31865_CONFIG_FILT50HZ 0x01
55#define MAX31865_CONFIG_FILT60HZ 0xFE
56
57#define MAX31865_CONFIG_REG 0x00
58#define MAX31865_RTDMSB_REG 0x01
59#define MAX31865_RTDLSB_REG 0x02
60#define MAX31865_HFAULTMSB_REG 0x03
61#define MAX31865_HFAULTLSB_REG 0x04
62#define MAX31865_LFAULTMSB_REG 0x05
63#define MAX31865_LFAULTLSB_REG 0x06
64#define MAX31865_FAULTSTAT_REG 0x07
65
76
85
87int max31865_init(struct max31865_dev **, struct max31865_init_param *);
88
90int max31865_remove(struct max31865_dev *);
91
93int max31865_reg_update(struct max31865_dev *, uint8_t, uint8_t, bool);
94
96int max31865_read(struct max31865_dev *, uint8_t, uint8_t *);
97
99int max31865_write(struct max31865_dev *, uint8_t, uint8_t);
100
102int max31865_read_fault(struct max31865_dev *, uint8_t *);
103
106
108int max31865_enable_bias(struct max31865_dev *, bool);
109
111int max31865_auto_convert(struct max31865_dev *, bool);
112
114int max31865_enable_50Hz(struct max31865_dev *, bool);
115
117int max31865_set_threshold(struct max31865_dev *, uint16_t, uint16_t);
118
120int max31865_get_lower_threshold(struct max31865_dev*, uint16_t *);
121
123int max31865_get_upper_threshold(struct max31865_dev*, uint16_t *);
124
126int max31865_set_wires(struct max31865_dev *, bool);
127
129int max31865_read_rtd(struct max31865_dev *, uint16_t *);
130
131#endif // __MAX31865_H__
int max31865_init(struct max31865_dev **, struct max31865_init_param *)
Device and comm init function.
Definition max31865.c:53
int max31865_get_upper_threshold(struct max31865_dev *, uint16_t *)
Read the raw 16-bit upper threshold value.
Definition max31865.c:341
int max31865_read(struct max31865_dev *, uint8_t, uint8_t *)
Read raw register value.
Definition max31865.c:143
int max31865_set_threshold(struct max31865_dev *, uint16_t, uint16_t)
Update the contents of the HIGH and LOW FAULT registers of max31865.
Definition max31865.c:281
int max31865_get_lower_threshold(struct max31865_dev *, uint16_t *)
Read the raw 16-bit lower threshold value.
Definition max31865.c:315
int max31865_enable_bias(struct max31865_dev *, bool)
Enable the bias voltage on the RTD sensor.
Definition max31865.c:230
int max31865_set_wires(struct max31865_dev *, bool)
N-wire option for RTD measurement setup.
Definition max31865.c:367
int max31865_auto_convert(struct max31865_dev *, bool)
Option for continuous conversions between 50/60 Hz.
Definition max31865.c:246
int max31865_reg_update(struct max31865_dev *, uint8_t, uint8_t, bool)
update register contents
Definition max31865.c:118
int max31865_enable_50Hz(struct max31865_dev *, bool)
Option for 50Hz or 60Hz noise filters.
Definition max31865.c:262
int max31865_write(struct max31865_dev *, uint8_t, uint8_t)
Write raw register value.
Definition max31865.c:180
int max31865_remove(struct max31865_dev *)
Remove resources allocated by the init function.
Definition max31865.c:94
int max31865_clear_fault(struct max31865_dev *)
Clear all faults in FAULTSTAT.
Definition max31865.c:211
int max31865_read_rtd(struct max31865_dev *, uint16_t *)
Read the raw 16-bit value from the RTD_REG in one shot mode.
Definition max31865.c:385
int max31865_read_fault(struct max31865_dev *, uint8_t *)
Header file of SPI Interface.
Header file of utility functions.
Structure holding max31865 descriptor.
Definition max31865.h:70
bool is_filt_50
Definition max31865.h:72
bool is_odd_wire
Definition max31865.h:73
int t_rc_delay
Definition max31865.h:74
struct no_os_spi_desc * comm_desc
Definition max31865.h:71
Structure holding the parameters for max31865 initialization.
Definition max31865.h:81
struct no_os_spi_init_param spi_init
Definition max31865.h:82
float rtd_rc
Definition max31865.h:83
Structure holding SPI descriptor.
Definition no_os_spi.h:180
Structure holding the parameters for SPI initialization.
Definition no_os_spi.h:128