17 #ifndef ADAFRUIT_MAX31865_H 18 #define ADAFRUIT_MAX31865_H 20 #define MAX31865_CONFIG_REG 0x00 21 #define MAX31865_CONFIG_BIAS 0x80 22 #define MAX31865_CONFIG_MODEAUTO 0x40 23 #define MAX31865_CONFIG_MODEOFF 0x00 24 #define MAX31865_CONFIG_1SHOT 0x20 25 #define MAX31865_CONFIG_3WIRE 0x10 26 #define MAX31865_CONFIG_24WIRE 0x00 27 #define MAX31865_CONFIG_FAULTSTAT 0x02 28 #define MAX31865_CONFIG_FILT50HZ 0x01 29 #define MAX31865_CONFIG_FILT60HZ 0x00 31 #define MAX31865_RTDMSB_REG 0x01 32 #define MAX31865_RTDLSB_REG 0x02 33 #define MAX31865_HFAULTMSB_REG 0x03 34 #define MAX31865_HFAULTLSB_REG 0x04 35 #define MAX31865_LFAULTMSB_REG 0x05 36 #define MAX31865_LFAULTLSB_REG 0x06 37 #define MAX31865_FAULTSTAT_REG 0x07 39 #define MAX31865_FAULT_HIGHTHRESH 0x80 40 #define MAX31865_FAULT_LOWTHRESH 0x40 41 #define MAX31865_FAULT_REFINLOW 0x20 42 #define MAX31865_FAULT_REFINHIGH 0x10 43 #define MAX31865_FAULT_RTDINLOW 0x08 44 #define MAX31865_FAULT_OVUV 0x04 46 #define RTD_A 3.9083e-3 47 #define RTD_B -5.775e-7 55 #include <Adafruit_SPIDevice.h> 57 typedef enum max31865_numwires {
61 } max31865_numwires_t;
64 MAX31865_FAULT_NONE = 0,
66 MAX31865_FAULT_MANUAL_RUN,
67 MAX31865_FAULT_MANUAL_FINISH
68 } max31865_fault_cycle_t;
77 bool begin(max31865_numwires_t x = MAX31865_2WIRE);
79 uint8_t
readFault(max31865_fault_cycle_t fault_cycle = MAX31865_FAULT_AUTO);
87 void setWires(max31865_numwires_t wires);
92 float temperature(
float RTDnominal,
float refResistor);
97 Adafruit_SPIDevice spi_dev;
99 void readRegisterN(uint8_t addr, uint8_t buffer[], uint8_t n);
101 uint8_t readRegister8(uint8_t addr);
102 uint16_t readRegister16(uint8_t addr);
104 void writeRegister8(uint8_t addr, uint8_t reg);
bool begin(max31865_numwires_t x=MAX31865_2WIRE)
Initialize the SPI interface and set the number of RTD wires used.
Definition: Adafruit_MAX31865.cpp:59
Definition: Adafruit_MAX31865.h:71
void autoConvert(bool b)
Whether we want to have continuous conversions (50/60 Hz)
Definition: Adafruit_MAX31865.cpp:139
uint16_t getUpperThreshold(void)
Read the raw 16-bit lower threshold value.
Definition: Adafruit_MAX31865.cpp:197
float temperature(float RTDnominal, float refResistor)
Read the temperature in C from the RTD through calculation of the resistance. Uses http://www...
Definition: Adafruit_MAX31865.cpp:232
uint16_t readRTD()
Read the raw 16-bit value from the RTD_REG in one shot mode.
Definition: Adafruit_MAX31865.cpp:296
uint8_t readFault(max31865_fault_cycle_t fault_cycle=MAX31865_FAULT_AUTO)
Read the raw 8-bit FAULTSTAT register.
Definition: Adafruit_MAX31865.cpp:82
void enable50Hz(bool b)
Whether we want filter out 50Hz noise or 60Hz noise.
Definition: Adafruit_MAX31865.cpp:156
void clearFault(void)
Clear all faults in FAULTSTAT.
Definition: Adafruit_MAX31865.cpp:110
uint16_t getLowerThreshold(void)
Read the raw 16-bit lower threshold value.
Definition: Adafruit_MAX31865.cpp:187
float calculateTemperature(uint16_t RTDraw, float RTDnominal, float refResistor)
Calculate the temperature in C from the RTD through calculation of the resistance. Uses http://www.analog.com/media/en/technical-documentation/application-notes/AN709_0.pdf technique.
Definition: Adafruit_MAX31865.cpp:249
Adafruit_MAX31865(int8_t spi_cs, int8_t spi_mosi, int8_t spi_miso, int8_t spi_clk)
Create the interface object using software (bitbang) SPI.
Definition: Adafruit_MAX31865.cpp:36
void enableBias(bool b)
Enable the bias voltage on the RTD sensor.
Definition: Adafruit_MAX31865.cpp:123
void setThresholds(uint16_t lower, uint16_t upper)
Write the lower and upper values into the threshold fault register to values as returned by readRTD()...
Definition: Adafruit_MAX31865.cpp:174
void setWires(max31865_numwires_t wires)
How many wires we have in our RTD setup, can be MAX31865_2WIRE, MAX31865_3WIRE, or MAX31865_4WIRE...
Definition: Adafruit_MAX31865.cpp:208