9 static const char *
const TAG =
"tc74";
11 static const uint8_t TC74_REGISTER_TEMPERATURE = 0x00;
12 static const uint8_t TC74_REGISTER_CONFIGURATION = 0x01;
13 static const uint8_t TC74_DATA_READY_MASK = 0x40;
18 ESP_LOGCONFIG(TAG,
"Setting up TC74...");
24 this->
data_ready_ = config_reg & TC74_DATA_READY_MASK;
30 LOG_SENSOR(
"",
"TC74",
this);
33 ESP_LOGE(TAG,
"Connection with TC74 failed!");
35 LOG_UPDATE_INTERVAL(
this);
46 if (config_reg & TC74_DATA_READY_MASK) {
49 ESP_LOGD(TAG,
"TC74 not ready");
54 uint8_t temperature_reg;
60 ESP_LOGD(TAG,
"Got Temperature=%d °C", temperature_reg);
void read_temperature_()
Internal method to read the temperature from the component after it has been scheduled.
const float DATA
For components that import data from directly connected sensors like DHT.
ErrorCode read_register(uint8_t a_register, uint8_t *data, size_t len, bool stop=true)
reads an array of bytes from a specific register in the I²C device
void status_set_warning(const char *message="unspecified")
No error found during execution of method.
void status_clear_warning()
void setup() override
Setup the sensor and check connection.
void publish_state(float state)
Publish a new state to the front-end.
float get_setup_priority() const override
virtual void mark_failed()
Mark this component as failed.
void dump_config() override
Implementation of SPI Controller mode.
void update() override
Update the sensor value (temperature).