6static const char *
const TAG =
"tmp1075";
16static uint16_t temp2regvalue(
float temp);
17static float regvalue2temp(uint16_t regvalue);
22 ESP_LOGE(TAG,
"'%s' - unable to read", this->
name_.
c_str());
33 ESP_LOGW(TAG,
"'%s' - unable to read temperature register", this->
name_.
c_str());
39 const float temp = regvalue2temp(regvalue);
44 LOG_SENSOR(
"",
"TMP1075 Sensor",
this);
46 ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
50 " limit low : %.4f °C\n"
51 " limit high : %.4f °C\n"
64 ESP_LOGE(TAG,
"'%s' - fault_count too low: %d", this->
name_.
c_str(), faults);
68 ESP_LOGE(TAG,
"'%s' - fault_count too high: %d", this->
name_.
c_str(), faults);
96 ESP_LOGW(TAG,
"'%s' - unable to write configuration register", this->
name_.
c_str());
105 ESP_LOGW(TAG,
"'%s' - unable to write low limit register", this->
name_.
c_str());
114 ESP_LOGW(TAG,
"'%s' - unable to write high limit register", this->
name_.
c_str());
119static uint16_t temp2regvalue(
const float temp) {
120 const int16_t regvalue =
static_cast<int16_t
>(temp / 0.0625f);
121 return static_cast<uint16_t
>(regvalue << 4);
124static float regvalue2temp(
const uint16_t regvalue) {
125 const int16_t signed_value = regvalue;
126 return (signed_value >> 4) * 0.0625f;
void mark_failed()
Mark this component as failed.
void status_set_warning()
void status_clear_warning()
constexpr const char * c_str() const
bool write_byte(uint8_t a_register, uint8_t data) const
bool read_byte(uint8_t a_register, uint8_t *data)
bool read_byte_16(uint8_t a_register, uint16_t *data)
bool write_byte_16(uint8_t a_register, uint16_t data) const
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
struct esphome::tmp1075::TMP1075Config::@169::@171 fields