Skip to content

Commit

Permalink
Add Selftest
Browse files Browse the repository at this point in the history
Using code from adafruit#5
  • Loading branch information
AnHardt committed Mar 12, 2020
1 parent dd3157f commit 8b011b8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Adafruit_MAX31865.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,25 @@ uint8_t Adafruit_MAX31865::readFault(void) {
return readRegister8(MAX31856_FAULTSTAT_REG);
}

/**************************************************************************/
/*!
@brief Read the raw 8-bit FAULTSTAT register
@param b If true perform a automatic fault-detection cycle
@return The raw unsigned 8-bit FAULT status register
*/
/**************************************************************************/
uint8_t Adafruit_MAX31865::readFault(boolean b) {
uint8_t t = readRegister8(MAX31856_CONFIG_REG);
if (b) {
t |= MAX31856_CONFIG_FAULTDETCYCLE; // trigger automatic fault-detection cycle
writeRegister8(MAX31856_CONFIG_REG, t);
delay(5); // wait for 5ms
}

return readRegister8(MAX31856_FAULTSTAT_REG);
}


/**************************************************************************/
/*!
@brief Clear all faults in FAULTSTAT
Expand Down
2 changes: 2 additions & 0 deletions Adafruit_MAX31865.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#define MAX31856_CONFIG_1SHOT 0x20
#define MAX31856_CONFIG_3WIRE 0x10
#define MAX31856_CONFIG_24WIRE 0x00
#define MAX31865_CONFIG_FAULTDETCYCLE 0x84
#define MAX31856_CONFIG_FAULTSTAT 0x02
#define MAX31856_CONFIG_FILT50HZ 0x01
#define MAX31856_CONFIG_FILT60HZ 0x00
Expand Down Expand Up @@ -68,6 +69,7 @@ class Adafruit_MAX31865 {
bool begin(max31865_numwires_t x = MAX31865_2WIRE);

uint8_t readFault(void);
uint8_t readFault(boolean b);
void clearFault(void);
uint16_t readRTD();

Expand Down

0 comments on commit 8b011b8

Please sign in to comment.