7static const char *
const TAG =
"hdc2080";
10static constexpr uint8_t REG_TEMPERATURE_LOW = 0x00;
11static constexpr uint8_t REG_TEMPERATURE_HIGH = 0x01;
12static constexpr uint8_t REG_HUMIDITY_LOW = 0x02;
13static constexpr uint8_t REG_HUMIDITY_HIGH = 0x03;
14static constexpr uint8_t REG_RESET_DRDY_INT_CONF = 0x0E;
15static constexpr uint8_t REG_MEASUREMENT_CONFIGURATION = 0x0F;
18static constexpr uint8_t MEAS_TRIG = 0x01;
19static constexpr uint8_t MEAS_CONF_TEMP = 0x02;
20static constexpr uint8_t MEAS_CONF_HUM = 0x04;
23 const uint8_t data = 0x00;
31 ESP_LOGCONFIG(TAG,
"HDC2080:");
33 LOG_UPDATE_INTERVAL(
this);
37 ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
42 uint8_t data = MEAS_TRIG;
44 data = MEAS_TRIG | MEAS_CONF_TEMP;
46 data = MEAS_TRIG | MEAS_CONF_HUM;
61 float temp =
encode_uint16(raw_data[1], raw_data[0]) * (165.0f / 65536.0f) - 40.5f;
65 float humidity =
encode_uint16(raw_data[3], raw_data[2]) * (100.0f / 65536.0f);
void mark_failed()
Mark this component as failed.
void status_set_warning()
ESPDEPRECATED("Use const char* or uint32_t overload instead. Removed in 2026.7.0", "2026.1.0") void set_timeout(const std voi set_timeout)(const char *name, uint32_t timeout, std::function< void()> &&f)
Set a timeout function with a unique name.
void status_clear_warning()
void dump_config() override
sensor::Sensor * temperature_sensor_
void setup() override
Setup the sensor and check for connection.
sensor::Sensor * humidity_sensor_
ErrorCode write_register(uint8_t a_register, const uint8_t *data, size_t len) const
writes an array of bytes to a specific register in the I²C device
ErrorCode read_register(uint8_t a_register, uint8_t *data, size_t len)
reads an array of bytes from a specific register in the I²C device
void publish_state(float state)
Publish a new state to the front-end.
@ ERROR_OK
No error found during execution of method.
constexpr uint16_t encode_uint16(uint8_t msb, uint8_t lsb)
Encode a 16-bit value given the most and least significant byte.