ESPHome  2024.4.1
max31856.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 #include <cinttypes>
8 
9 namespace esphome {
10 namespace max31856 {
11 
13 
21  MAX31856_CR0_CJ = 0x08,
24 
39  MAX31856_SR_REG = 0x0F,
40 
49 };
50 
56  MAX31856_TCTYPE_B = 0b0000, // 0x00
57  MAX31856_TCTYPE_E = 0b0001, // 0x01
58  MAX31856_TCTYPE_J = 0b0010, // 0x02
59  MAX31856_TCTYPE_K = 0b0011, // 0x03
60  MAX31856_TCTYPE_N = 0b0100, // 0x04
61  MAX31856_TCTYPE_R = 0b0101, // 0x05
62  MAX31856_TCTYPE_S = 0b0110, // 0x06
63  MAX31856_TCTYPE_T = 0b0111, // 0x07
64  MAX31856_VMODE_G8 = 0b1000, // 0x08
65  MAX31856_VMODE_G32 = 0b1100, // 0x12
66 };
67 
71 };
72 
74  public PollingComponent,
75  public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
76  spi::CLOCK_PHASE_TRAILING, spi::DATA_RATE_4MHZ> {
77  public:
78  void setup() override;
79  void dump_config() override;
80  float get_setup_priority() const override;
81  void set_filter(MAX31856ConfigFilter filter) { filter_ = filter; }
82  void update() override;
83 
84  protected:
86 
87  uint8_t read_register_(uint8_t reg);
88  uint32_t read_register24_(uint8_t reg);
89  void write_register_(uint8_t reg, uint8_t value);
90 
91  void one_shot_temperature_();
92  bool has_fault_();
93  void clear_fault_();
96  void set_noise_filter_();
97 };
98 
99 } // namespace max31856
100 } // namespace esphome
Linearized TC Temperature, Byte 2.
Definition: max31856.h:36
MAX31856ConfigFilter filter_
Definition: max31856.h:85
Linearized TC Temperature, Byte 0.
Definition: max31856.h:38
Config 0 fault mode flag.
Definition: max31856.h:22
Config 0 one shot convert flag.
Definition: max31856.h:17
Fault status Cold Junction Out-of-Range flag.
Definition: max31856.h:41
Config 0 open circuit fault 01 flag.
Definition: max31856.h:19
Cold junction Low temp fault register.
Definition: max31856.h:28
Cold-Junction Temperature Register, LSB.
Definition: max31856.h:35
Fault status Overvoltage or Undervoltage Input Fault flag.
Definition: max31856.h:47
uint32_t read_register24_(uint8_t reg)
Definition: max31856.cpp:178
This class simplifies creating components that periodically check a state.
Definition: component.h:283
Config 0 cold junction disable flag.
Definition: max31856.h:21
Config 0 open circuit fault 00 flag.
Definition: max31856.h:18
Linearized Temperature Low Fault Threshold Register, LSB.
Definition: max31856.h:32
Config 0 open circuit fault 10 flag.
Definition: max31856.h:20
Fault status Thermocouple Temperature Low Fault flag.
Definition: max31856.h:46
The SPIDevice is what components using the SPI will create.
Definition: spi.h:408
void write_register_(uint8_t reg, uint8_t value)
Definition: max31856.cpp:153
Fault status Thermocouple Temperature High Fault flag.
Definition: max31856.h:45
Fault status Cold-Junction Low Fault flag.
Definition: max31856.h:44
MAX31856ThermocoupleType
Multiple types of thermocouples supported by the chip.
Definition: max31856.h:55
Fault Mask register.
Definition: max31856.h:26
Fault status Cold-Junction High Fault flag.
Definition: max31856.h:43
uint8_t read_register_(uint8_t reg)
Definition: max31856.cpp:166
Fault status Thermocouple Open-Circuit Fault flag.
Definition: max31856.h:48
Linearized TC Temperature, Byte 1.
Definition: max31856.h:37
Linearized Temperature High Fault Threshold Register, LSB.
Definition: max31856.h:30
Linearized Temperature Low Fault Threshold Register, MSB.
Definition: max31856.h:31
void set_filter(MAX31856ConfigFilter filter)
Definition: max31856.h:81
Config 0 Auto convert flag.
Definition: max31856.h:16
Fault Status Register.
Definition: max31856.h:39
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7
Config 0 fault clear flag.
Definition: max31856.h:23
Base-class for all sensors.
Definition: sensor.h:57
Cold-Junction Temperature Register, MSB.
Definition: max31856.h:34
Linearized Temperature High Fault Threshold Register, MSB.
Definition: max31856.h:29
Cold junction High temp fault register.
Definition: max31856.h:27
float get_setup_priority() const override
Definition: max31856.cpp:195
Fault status Thermocouple Out-of-Range flag.
Definition: max31856.h:42
Cold-Junction Temperature Offset Register.
Definition: max31856.h:33