MAX6675_RK
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes
MAX6675_RK Class Reference

Class for reading a MAX6665 SPI thermocouple interface. More...

#include <MAX6675_RK.h>

Public Member Functions

 MAX6675_RK ()
 Construct an object using primary SPI (SPI) and default CS pin (SS)
 
 MAX6675_RK (pin_t csPin)
 Construct an object using primary SPI (SPI) and the specified CS pin.
 
 MAX6675_RK (SPIClass *spi, pin_t csPin)
 Construct an object using the specified SPI interface and the specified CS pin.
 
MAX6675_RKwithSPI (SPIClass *spi)
 Set the SPI interface if not setting it from the constructor.
 
MAX6675_RKwithCS (pin_t csPin)
 Set the CS pin it not setting it from the constructor.
 
MAX6675_RKwithOpenDetection (bool value)
 Sets whether open detection mode is enabled or not (default is true)
 
void setup ()
 Perform setup operations; call this from global application setup()
 
uint16_t readRaw ()
 Read the raw 16-bit value from the sensor.
 
float readValue ()
 Return a value in degrees Celsius.
 
float readValueF ()
 Return a value in degrees Fahrenheit.
 

Static Public Member Functions

static float convertCtoF (float value)
 Convert a value from degrees C to degrees F.
 

Protected Attributes

SPIClass * spi = &SPI
 SPI interface to use.
 
pin_t csPin = SS
 Pin to use for CS.
 
bool openDetection = true
 Whether to detect open or missinbg sensor.
 
SPISettings spiSettings = SPISettings(4 * MHZ, MSBFIRST, SPI_MODE3)
 SPI settings, You won't generally have to change these settings; they're based on what the MAX6675 requires.
 

Detailed Description

Class for reading a MAX6665 SPI thermocouple interface.

Constructor & Destructor Documentation

◆ MAX6675_RK() [1/2]

MAX6675_RK::MAX6675_RK ( pin_t csPin)
inline

Construct an object using primary SPI (SPI) and the specified CS pin.

Parameters
csPinA pin, such as D2.

◆ MAX6675_RK() [2/2]

MAX6675_RK::MAX6675_RK ( SPIClass * spi,
pin_t csPin )
inline

Construct an object using the specified SPI interface and the specified CS pin.

Parameters
spiA SPI interface such as &SPI or &SPI1.
csPinA pin, such as D2.

Member Function Documentation

◆ convertCtoF()

static float MAX6675_RK::convertCtoF ( float value)
inlinestatic

Convert a value from degrees C to degrees F.

Parameters
value
Returns
float

◆ readRaw()

uint16_t MAX6675_RK::readRaw ( )

Read the raw 16-bit value from the sensor.

Returns
uint16_t

◆ readValue()

float MAX6675_RK::readValue ( )

Return a value in degrees Celsius.

Returns
float A value in degrees C. It will be in the range 0 <= value <= 1023.75.

Returns NaN if the sensor (T+ or T-) is not connected. See withOpenDetection().

Will typically return 0.0 if the chip is not connected via SPI.

◆ readValueF()

float MAX6675_RK::readValueF ( )
inline

Return a value in degrees Fahrenheit.

Returns
float A value in degrees F. It will be in the range of 32.0 <= value <= 1874.75.

Returns NaN if the sensor (T+ or T-) is not connected. See withOpenDetection().

Will typically return 32.0 if the chip is not connected via SPI.

◆ setup()

void MAX6675_RK::setup ( )

Perform setup operations; call this from global application setup()

This must be done after with withXXX() methods. It basically calls spi->begin() with the specified csPin. This sets the pinMode of the SPI pins and csPin, and also sets the csPin to HIGH.

◆ withCS()

MAX6675_RK & MAX6675_RK::withCS ( pin_t csPin)
inline

Set the CS pin it not setting it from the constructor.

Parameters
csPinA pin, such as D2.
Returns
MAX6675_RK&

Must be called before setup().

◆ withOpenDetection()

MAX6675_RK & MAX6675_RK::withOpenDetection ( bool value)
inline

Sets whether open detection mode is enabled or not (default is true)

Parameters
valuetrue is enable open detection, false to disable
Returns
MAX6675_RK&

The MAX6675 can detect sensor open (or missing), but only if T- and GND are connected. This feature is enabled by default because the suggested design connects the two. If for some reason you've isolated T- and GND, then be sure to use withOpenDetection(false).

◆ withSPI()

MAX6675_RK & MAX6675_RK::withSPI ( SPIClass * spi)
inline

Set the SPI interface if not setting it from the constructor.

Parameters
spiA SPI interface such as &SPI or &SPI1.
Returns
MAX6675_RK&

Must be called before setup().


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