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

MAX31855 thermocouple sensor driver. More...

#include <MAX31855.h>

Inheritance diagram for Boardcore::MAX31855:
Collaboration diagram for Boardcore::MAX31855:

Public Member Functions

 MAX31855 (SPIBusInterface &bus, miosix::GpioPin cs, SPIBusConfig config=getDefaultSPIConfig())
 
bool init ()
 Initialize the sensor.
 
bool selfTest ()
 Check if the sensor is working.
 
bool checkConnected ()
 Checks whether the thermocouple is connected or not.
 
TemperatureData readInternalTemperature ()
 Read the device internal temperature (cold junction).
 
- Public Member Functions inherited from Boardcore::Sensor< TemperatureData >
 Sensor ()
 
 Sensor (Sensor &&other)
 
virtual ~Sensor ()
 
void sample () override
 Sample the sensor.
 
virtual TemperatureData 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

TemperatureData 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

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

Detailed Description

MAX31855 thermocouple sensor driver.

The MAX31855 performs cold-junction compensation and digitizes the signal from a K, J, N, T, S, R, or E type thermocouple depending on the selected product variant. The data is output in a signed 14-bit, SPI-compatible, read-only format. This converter resolves temperatures to 0.25°C, allows readings as high as +1800°C and as low as -270°C, and exhibits thermocouple accuracy of ±2°C for temperatures ranging from -200°C to +700°C for K-type thermocouples.

Definition at line 43 of file MAX31855.h.

Constructor & Destructor Documentation

◆ MAX31855()

Boardcore::MAX31855::MAX31855 ( SPIBusInterface & bus,
miosix::GpioPin cs,
SPIBusConfig config = getDefaultSPIConfig() )

Definition at line 30 of file MAX31855.cpp.

Member Function Documentation

◆ checkConnected()

bool Boardcore::MAX31855::checkConnected ( )

Checks whether the thermocouple is connected or not.

Returns
True if the thermocouple is connected.

Definition at line 48 of file MAX31855.cpp.

◆ getDefaultSPIConfig()

SPIBusConfig Boardcore::MAX31855::getDefaultSPIConfig ( )
static

Definition at line 36 of file MAX31855.cpp.

◆ init()

bool Boardcore::MAX31855::init ( )
virtual

Initialize the sensor.

Returns
boolean value indicating whether the operation succeded or not

Implements Boardcore::AbstractSensor.

Definition at line 44 of file MAX31855.cpp.

◆ readInternalTemperature()

TemperatureData Boardcore::MAX31855::readInternalTemperature ( )

Read the device internal temperature (cold junction).

Definition at line 88 of file MAX31855.cpp.

◆ sampleImpl()

TemperatureData Boardcore::MAX31855::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< TemperatureData >.

Definition at line 69 of file MAX31855.cpp.

◆ selfTest()

bool Boardcore::MAX31855::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 46 of file MAX31855.cpp.


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