ESPHome 2025.5.0
Loading...
Searching...
No Matches
max31856.h
Go to the documentation of this file.
1#pragma once
2
6
7#include <cinttypes>
8
9namespace esphome {
10namespace max31856 {
11
13
50
55 MAX31856_TCTYPE_B = 0b0000, // 0x00
56 MAX31856_TCTYPE_E = 0b0001, // 0x01
57 MAX31856_TCTYPE_J = 0b0010, // 0x02
58 MAX31856_TCTYPE_K = 0b0011, // 0x03
59 MAX31856_TCTYPE_N = 0b0100, // 0x04
60 MAX31856_TCTYPE_R = 0b0101, // 0x05
61 MAX31856_TCTYPE_S = 0b0110, // 0x06
62 MAX31856_TCTYPE_T = 0b0111, // 0x07
63 MAX31856_VMODE_G8 = 0b1000, // 0x08
64 MAX31856_VMODE_G32 = 0b1100, // 0x12
65};
66
71
73 public PollingComponent,
74 public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
75 spi::CLOCK_PHASE_TRAILING, spi::DATA_RATE_4MHZ> {
76 public:
77 void setup() override;
78 void dump_config() override;
79 float get_setup_priority() const override;
80 void set_filter(MAX31856ConfigFilter filter) { this->filter_ = filter; }
82 this->thermocouple_type_ = thermocouple_type;
83 }
84 void update() override;
85
86 protected:
89
90 uint8_t read_register_(uint8_t reg);
91 uint32_t read_register24_(uint8_t reg);
92 void write_register_(uint8_t reg, uint8_t value);
93
95 bool has_fault_();
96 void clear_fault_();
99 void set_noise_filter_();
100};
101
102} // namespace max31856
103} // namespace esphome
This class simplifies creating components that periodically check a state.
Definition component.h:301
void write_register_(uint8_t reg, uint8_t value)
Definition max31856.cpp:164
float get_setup_priority() const override
Definition max31856.cpp:206
MAX31856ConfigFilter filter_
Definition max31856.h:87
MAX31856ThermocoupleType thermocouple_type_
Definition max31856.h:88
uint32_t read_register24_(uint8_t reg)
Definition max31856.cpp:189
uint8_t read_register_(uint8_t reg)
Definition max31856.cpp:177
void set_thermocouple_type(MAX31856ThermocoupleType thermocouple_type)
Definition max31856.h:81
void set_filter(MAX31856ConfigFilter filter)
Definition max31856.h:80
Base-class for all sensors.
Definition sensor.h:57
The SPIDevice is what components using the SPI will create.
Definition spi.h:421
MAX31856ThermocoupleType
Multiple types of thermocouples supported by the chip.
Definition max31856.h:54
@ MAX31856_CR0_1SHOT
Config 0 one shot convert flag.
Definition max31856.h:17
@ MAX31856_CR0_CJ
Config 0 cold junction disable flag.
Definition max31856.h:21
@ MAX31856_CR1_REG
Config 1 register.
Definition max31856.h:25
@ MAX31856_CR0_OCFAULT00
Config 0 open circuit fault 00 flag.
Definition max31856.h:18
@ MAX31856_CR0_OCFAULT10
Config 0 open circuit fault 10 flag.
Definition max31856.h:20
@ MAX31856_FAULT_TCLOW
Fault status Thermocouple Temperature Low Fault flag.
Definition max31856.h:46
@ MAX31856_CR0_FAULT
Config 0 fault mode flag.
Definition max31856.h:22
@ MAX31856_LTLFTH_REG
Linearized Temperature Low Fault Threshold Register, MSB.
Definition max31856.h:31
@ MAX31856_LTCBM_REG
Linearized TC Temperature, Byte 1.
Definition max31856.h:37
@ MAX31856_LTCBH_REG
Linearized TC Temperature, Byte 2.
Definition max31856.h:36
@ MAX31856_LTCBL_REG
Linearized TC Temperature, Byte 0.
Definition max31856.h:38
@ MAX31856_LTHFTH_REG
Linearized Temperature High Fault Threshold Register, MSB.
Definition max31856.h:29
@ MAX31856_CR0_AUTOCONVERT
Config 0 Auto convert flag.
Definition max31856.h:16
@ MAX31856_LTLFTL_REG
Linearized Temperature Low Fault Threshold Register, LSB.
Definition max31856.h:32
@ MAX31856_FAULT_TCRANGE
Fault status Thermocouple Out-of-Range flag.
Definition max31856.h:42
@ MAX31856_CJLF_REG
Cold junction Low temp fault register.
Definition max31856.h:28
@ MAX31856_CJHF_REG
Cold junction High temp fault register.
Definition max31856.h:27
@ MAX31856_CR0_REG
Config 0 register.
Definition max31856.h:15
@ MAX31856_CJTO_REG
Cold-Junction Temperature Offset Register.
Definition max31856.h:33
@ MAX31856_FAULT_OPEN
Fault status Thermocouple Open-Circuit Fault flag.
Definition max31856.h:48
@ MAX31856_FAULT_CJHIGH
Fault status Cold-Junction High Fault flag.
Definition max31856.h:43
@ MAX31856_CJTH_REG
Cold-Junction Temperature Register, MSB.
Definition max31856.h:34
@ MAX31856_LTHFTL_REG
Linearized Temperature High Fault Threshold Register, LSB.
Definition max31856.h:30
@ MAX31856_CJTL_REG
Cold-Junction Temperature Register, LSB.
Definition max31856.h:35
@ MAX31856_SR_REG
Fault Status Register.
Definition max31856.h:39
@ MAX31856_MASK_REG
Fault Mask register.
Definition max31856.h:26
@ MAX31856_FAULT_CJLOW
Fault status Cold-Junction Low Fault flag.
Definition max31856.h:44
@ MAX31856_FAULT_OVUV
Fault status Overvoltage or Undervoltage Input Fault flag.
Definition max31856.h:47
@ MAX31856_CR0_OCFAULT01
Config 0 open circuit fault 01 flag.
Definition max31856.h:19
@ MAX31856_FAULT_TCHIGH
Fault status Thermocouple Temperature High Fault flag.
Definition max31856.h:45
@ MAX31856_FAULT_CJRANGE
Fault status Cold Junction Out-of-Range flag.
Definition max31856.h:41
@ MAX31856_CR0_FAULTCLR
Config 0 fault clear flag.
Definition max31856.h:23
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7