7static const char *
const TAG =
"tmp1075";
17static uint16_t temp2regvalue(
float temp);
18static float regvalue2temp(uint16_t regvalue);
23 ESP_LOGE(TAG,
"'%s' - unable to read", this->
name_.
c_str());
34 ESP_LOGW(TAG,
"'%s' - unable to read temperature register", this->
name_.
c_str());
40 const float temp = regvalue2temp(regvalue);
45 LOG_SENSOR(
"",
"TMP1075 Sensor",
this);
47 ESP_LOGE(TAG,
" Communication with TMP1075 failed!");
62 ESP_LOGE(TAG,
"'%s' - fault_count too low: %d", this->
name_.
c_str(), faults);
66 ESP_LOGE(TAG,
"'%s' - fault_count too high: %d", this->
name_.
c_str(), faults);
91 ESP_LOGW(TAG,
"'%s' - unable to write configuration register", this->
name_.
c_str());
100 ESP_LOGW(TAG,
"'%s' - unable to write low limit register", this->
name_.
c_str());
109 ESP_LOGW(TAG,
"'%s' - unable to write high limit register", this->
name_.
c_str());
114static uint16_t temp2regvalue(
const float temp) {
115 const uint16_t regvalue = temp / 0.0625f;
116 return regvalue << 4;
119static float regvalue2temp(
const uint16_t regvalue) {
120 const int16_t signed_value = regvalue;
121 return (signed_value >> 4) * 0.0625f;
virtual void mark_failed()
Mark this component as failed.
void status_set_warning(const char *message="unspecified")
void status_clear_warning()
constexpr const char * c_str() const
bool write_byte(uint8_t a_register, uint8_t data, bool stop=true)
bool read_byte_16(uint8_t a_register, uint16_t *data)
bool read_byte(uint8_t a_register, uint8_t *data, bool stop=true)
bool write_byte_16(uint8_t a_register, uint16_t data)
void publish_state(float state)
Publish a new state to the front-end.
void send_alert_limit_high_()
void dump_config() override
void send_alert_limit_low_()
void set_fault_count(int faults)
constexpr uint16_t EXPECT_DIEID
constexpr uint8_t REG_LLIM
constexpr uint8_t REG_TEMP
constexpr uint8_t REG_DIEID
constexpr uint8_t REG_HLIM
constexpr uint8_t REG_CFGR
Providing packet encoding functions for exchanging data with a remote host.
struct esphome::tmp1075::TMP1075Config::@144::@146 fields