Skip to content

Commit

Permalink
Fix MAX31856 typo
Browse files Browse the repository at this point in the history
Here we have a MAX318**65** not a MAX218**56**.
  • Loading branch information
AnHardt committed Sep 29, 2020
1 parent e87442c commit e484137
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 43 deletions.
50 changes: 25 additions & 25 deletions Adafruit_MAX31865.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ bool Adafruit_MAX31865::begin(max31865_numwires_t wires) {
clearFault();

// Serial.print("config: ");
// Serial.println(readRegister8(MAX31856_CONFIG_REG), HEX);
// Serial.println(readRegister8(MAX31865_CONFIG_REG), HEX);
return true;
}

Expand All @@ -75,7 +75,7 @@ bool Adafruit_MAX31865::begin(max31865_numwires_t wires) {
*/
/**************************************************************************/
uint8_t Adafruit_MAX31865::readFault(void) {
return readRegister8(MAX31856_FAULTSTAT_REG);
return readRegister8(MAX31865_FAULTSTAT_REG);
}

/**************************************************************************/
Expand All @@ -84,10 +84,10 @@ uint8_t Adafruit_MAX31865::readFault(void) {
*/
/**************************************************************************/
void Adafruit_MAX31865::clearFault(void) {
uint8_t t = readRegister8(MAX31856_CONFIG_REG);
uint8_t t = readRegister8(MAX31865_CONFIG_REG);
t &= ~0x2C;
t |= MAX31856_CONFIG_FAULTSTAT;
writeRegister8(MAX31856_CONFIG_REG, t);
t |= MAX31865_CONFIG_FAULTSTAT;
writeRegister8(MAX31865_CONFIG_REG, t);
}

/**************************************************************************/
Expand All @@ -97,13 +97,13 @@ void Adafruit_MAX31865::clearFault(void) {
*/
/**************************************************************************/
void Adafruit_MAX31865::enableBias(bool b) {
uint8_t t = readRegister8(MAX31856_CONFIG_REG);
uint8_t t = readRegister8(MAX31865_CONFIG_REG);
if (b) {
t |= MAX31856_CONFIG_BIAS; // enable bias
t |= MAX31865_CONFIG_BIAS; // enable bias
} else {
t &= ~MAX31856_CONFIG_BIAS; // disable bias
t &= ~MAX31865_CONFIG_BIAS; // disable bias
}
writeRegister8(MAX31856_CONFIG_REG, t);
writeRegister8(MAX31865_CONFIG_REG, t);
}

/**************************************************************************/
Expand All @@ -113,13 +113,13 @@ void Adafruit_MAX31865::enableBias(bool b) {
*/
/**************************************************************************/
void Adafruit_MAX31865::autoConvert(bool b) {
uint8_t t = readRegister8(MAX31856_CONFIG_REG);
uint8_t t = readRegister8(MAX31865_CONFIG_REG);
if (b) {
t |= MAX31856_CONFIG_MODEAUTO; // enable autoconvert
t |= MAX31865_CONFIG_MODEAUTO; // enable autoconvert
} else {
t &= ~MAX31856_CONFIG_MODEAUTO; // disable autoconvert
t &= ~MAX31865_CONFIG_MODEAUTO; // disable autoconvert
}
writeRegister8(MAX31856_CONFIG_REG, t);
writeRegister8(MAX31865_CONFIG_REG, t);
}

/**************************************************************************/
Expand All @@ -130,13 +130,13 @@ void Adafruit_MAX31865::autoConvert(bool b) {
/**************************************************************************/

void Adafruit_MAX31865::enable50Hz(bool b) {
uint8_t t = readRegister8(MAX31856_CONFIG_REG);
uint8_t t = readRegister8(MAX31865_CONFIG_REG);
if (b) {
t |= MAX31856_CONFIG_FILT50HZ;
t |= MAX31865_CONFIG_FILT50HZ;
} else {
t &= ~MAX31856_CONFIG_FILT50HZ;
t &= ~MAX31865_CONFIG_FILT50HZ;
}
writeRegister8(MAX31856_CONFIG_REG, t);
writeRegister8(MAX31865_CONFIG_REG, t);
}

/**************************************************************************/
Expand All @@ -147,14 +147,14 @@ void Adafruit_MAX31865::enable50Hz(bool b) {
*/
/**************************************************************************/
void Adafruit_MAX31865::setWires(max31865_numwires_t wires) {
uint8_t t = readRegister8(MAX31856_CONFIG_REG);
uint8_t t = readRegister8(MAX31865_CONFIG_REG);
if (wires == MAX31865_3WIRE) {
t |= MAX31856_CONFIG_3WIRE;
t |= MAX31865_CONFIG_3WIRE;
} else {
// 2 or 4 wire
t &= ~MAX31856_CONFIG_3WIRE;
t &= ~MAX31865_CONFIG_3WIRE;
}
writeRegister8(MAX31856_CONFIG_REG, t);
writeRegister8(MAX31865_CONFIG_REG, t);
}

/**************************************************************************/
Expand Down Expand Up @@ -220,12 +220,12 @@ uint16_t Adafruit_MAX31865::readRTD(void) {
clearFault();
enableBias(true);
delay(10);
uint8_t t = readRegister8(MAX31856_CONFIG_REG);
t |= MAX31856_CONFIG_1SHOT;
writeRegister8(MAX31856_CONFIG_REG, t);
uint8_t t = readRegister8(MAX31865_CONFIG_REG);
t |= MAX31865_CONFIG_1SHOT;
writeRegister8(MAX31865_CONFIG_REG, t);
delay(65);

uint16_t rtd = readRegister16(MAX31856_RTDMSB_REG);
uint16_t rtd = readRegister16(MAX31865_RTDMSB_REG);

// remove fault
rtd >>= 1;
Expand Down
36 changes: 18 additions & 18 deletions Adafruit_MAX31865.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,24 @@
#ifndef ADAFRUIT_MAX31865_H
#define ADAFRUIT_MAX31865_H

#define MAX31856_CONFIG_REG 0x00
#define MAX31856_CONFIG_BIAS 0x80
#define MAX31856_CONFIG_MODEAUTO 0x40
#define MAX31856_CONFIG_MODEOFF 0x00
#define MAX31856_CONFIG_1SHOT 0x20
#define MAX31856_CONFIG_3WIRE 0x10
#define MAX31856_CONFIG_24WIRE 0x00
#define MAX31856_CONFIG_FAULTSTAT 0x02
#define MAX31856_CONFIG_FILT50HZ 0x01
#define MAX31856_CONFIG_FILT60HZ 0x00

#define MAX31856_RTDMSB_REG 0x01
#define MAX31856_RTDLSB_REG 0x02
#define MAX31856_HFAULTMSB_REG 0x03
#define MAX31856_HFAULTLSB_REG 0x04
#define MAX31856_LFAULTMSB_REG 0x05
#define MAX31856_LFAULTLSB_REG 0x06
#define MAX31856_FAULTSTAT_REG 0x07
#define MAX31865_CONFIG_REG 0x00
#define MAX31865_CONFIG_BIAS 0x80
#define MAX31865_CONFIG_MODEAUTO 0x40
#define MAX31865_CONFIG_MODEOFF 0x00
#define MAX31865_CONFIG_1SHOT 0x20
#define MAX31865_CONFIG_3WIRE 0x10
#define MAX31865_CONFIG_24WIRE 0x00
#define MAX31865_CONFIG_FAULTSTAT 0x02
#define MAX31865_CONFIG_FILT50HZ 0x01
#define MAX31865_CONFIG_FILT60HZ 0x00

#define MAX31865_RTDMSB_REG 0x01
#define MAX31865_RTDLSB_REG 0x02
#define MAX31865_HFAULTMSB_REG 0x03
#define MAX31865_HFAULTLSB_REG 0x04
#define MAX31865_LFAULTMSB_REG 0x05
#define MAX31865_LFAULTLSB_REG 0x06
#define MAX31865_FAULTSTAT_REG 0x07

#define MAX31865_FAULT_HIGHTHRESH 0x80
#define MAX31865_FAULT_LOWTHRESH 0x40
Expand Down

0 comments on commit e484137

Please sign in to comment.