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