Skyward boardcore
Loading...
Searching...
No Matches
Boardcore::MAX31856 Class Reference

MAX31855 thermocouple sensor driver. More...

#include <MAX31856.h>

Inheritance diagram for Boardcore::MAX31856:
Collaboration diagram for Boardcore::MAX31856:

Public Types

enum class  ThermocoupleType : uint8_t {
  B_TYPE = 0x0 , E_TYPE = 0x1 , J_TYPE = 0x2 , K_TYPE = 0x3 ,
  N_TYPE = 0x4 , R_TYPE = 0x5 , S_TYPE = 0x6 , T_TYPE = 0x7 ,
  GAIN_8 = 0x8 , GAIN_32 = 0x9
}
 
- Public Types inherited from Boardcore::Sensor< MAX31856Data >
using DataType
 

Public Member Functions

 MAX31856 (SPIBusInterface &bus, miosix::GpioPin cs, SPIBusConfig config=getDefaultSPIConfig(), ThermocoupleType type=ThermocoupleType::K_TYPE)
 
bool init ()
 Initialize the sensor.
 
bool selfTest ()
 Check if the sensor is working.
 
bool checkConnected ()
 Checks whether the thermocouple is connected or not.
 
void setThermocoupleType (ThermocoupleType type)
 
void setColdJunctionOffset (float offset)
 
- Public Member Functions inherited from Boardcore::Sensor< MAX31856Data >
 Sensor ()
 
 Sensor (Sensor &&other)
 
virtual ~Sensor ()
 
void sample () override
 Sample the sensor.
 
virtual MAX31856Data getLastSample ()
 
- Public Member Functions inherited from Boardcore::AbstractSensor
virtual ~AbstractSensor ()
 
SensorErrors getLastError ()
 Get last error for debugging purposes. Avoid silent fails.
 

Static Public Member Functions

static SPIBusConfig getDefaultSPIConfig ()
 

Protected Member Functions

MAX31856Data sampleImpl () override
 Read a data sample from the sensor. In case of errors, the method should return the last available correct sample.
 

Additional Inherited Members

- Protected Attributes inherited from Boardcore::Sensor< MAX31856Data >
DataType lastSample
 
miosix::FastMutex mutex
 
- Protected Attributes inherited from Boardcore::AbstractSensor
SensorErrors lastError = SensorErrors::NO_ERRORS
 

Detailed Description

MAX31855 thermocouple sensor driver.

The MAX31856 performs cold-junction compensation and digitizes the signal from any type of thermocouple. This converter resolves temperatures to 0.0078125°C, allows readings as high as +1800°C and as low as -210°C (depending on thermocouple type), and exhibits thermocouple voltage measurement accuracy of ±0.15%. The thermocouple inputs are protected against over voltage conditions up to ±45V. A lookup table (LUT) stores linearity correction data for several types of thermocouples (K, J, N, R, S, T, E, and B). Line frequency filtering of 50Hz and 60Hz is included, as is thermocouple fault detection

Definition at line 47 of file MAX31856.h.

Member Enumeration Documentation

◆ ThermocoupleType

enum class Boardcore::MAX31856::ThermocoupleType : uint8_t
strong
Enumerator
B_TYPE 
E_TYPE 
J_TYPE 
K_TYPE 
N_TYPE 
R_TYPE 
S_TYPE 
T_TYPE 
GAIN_8 
GAIN_32 

Definition at line 50 of file MAX31856.h.

Constructor & Destructor Documentation

◆ MAX31856()

Boardcore::MAX31856::MAX31856 ( SPIBusInterface & bus,
miosix::GpioPin cs,
SPIBusConfig config = getDefaultSPIConfig(),
ThermocoupleType type = ThermocoupleType::K_TYPE )

Definition at line 30 of file MAX31856.cpp.

Member Function Documentation

◆ checkConnected()

bool Boardcore::MAX31856::checkConnected ( )

Checks whether the thermocouple is connected or not.

Returns
True if the thermocouple is connected.

Definition at line 65 of file MAX31856.cpp.

◆ getDefaultSPIConfig()

SPIBusConfig Boardcore::MAX31856::getDefaultSPIConfig ( )
static

Definition at line 36 of file MAX31856.cpp.

◆ init()

bool Boardcore::MAX31856::init ( )
virtual

Initialize the sensor.

Returns
boolean value indicating whether the operation succeded or not

Implements Boardcore::AbstractSensor.

Definition at line 45 of file MAX31856.cpp.

◆ sampleImpl()

MAX31856Data Boardcore::MAX31856::sampleImpl ( )
overrideprotectedvirtual

Read a data sample from the sensor. In case of errors, the method should return the last available correct sample.

Returns
sensor data sample

Implements Boardcore::Sensor< MAX31856Data >.

Definition at line 98 of file MAX31856.cpp.

◆ selfTest()

bool Boardcore::MAX31856::selfTest ( )
virtual

Check if the sensor is working.

Returns
boolean indicating whether the sensor is correctly working or not

Implements Boardcore::AbstractSensor.

Definition at line 63 of file MAX31856.cpp.

◆ setColdJunctionOffset()

void Boardcore::MAX31856::setColdJunctionOffset ( float offset)

Definition at line 91 of file MAX31856.cpp.

◆ setThermocoupleType()

void Boardcore::MAX31856::setThermocoupleType ( ThermocoupleType type)

Definition at line 85 of file MAX31856.cpp.


The documentation for this class was generated from the following files: