10static const uint8_t DAC7678_REG_INPUT_N = 0x00;
11static const uint8_t DAC7678_REG_SELECT_UPDATE_N = 0x10;
12static const uint8_t DAC7678_REG_WRITE_N_UPDATE_ALL = 0x20;
13static const uint8_t DAC7678_REG_WRITE_N_UPDATE_N = 0x30;
14static const uint8_t DAC7678_REG_POWER = 0x40;
15static const uint8_t DAC7678_REG_CLEAR_CODE = 0x50;
16static const uint8_t DAC7678_REG_LDAC = 0x60;
17static const uint8_t DAC7678_REG_SOFTWARE_RESET = 0x70;
18static const uint8_t DAC7678_REG_INTERNAL_REF_0 = 0x80;
19static const uint8_t DAC7678_REG_INTERNAL_REF_1 = 0x90;
22 ESP_LOGV(TAG,
"Resetting device");
25 if (!this->
write_byte_16(DAC7678_REG_SOFTWARE_RESET, 0x0000)) {
29 ESP_LOGV(TAG,
"Reset succeeded");
36 if (!this->
write_byte_16(DAC7678_REG_INTERNAL_REF_0, 1 << 4)) {
37 this->
mark_failed(LOG_STR(
"Set internal reference failed"));
40 ESP_LOGV(TAG,
"Internal reference enabled");
47 ESP_LOGCONFIG(TAG,
"DAC7678 initialised");
56 ESP_LOGV(TAG,
"Registered channel: %01u", channel->
channel_);
63 ESP_LOGV(TAG,
"Channel %01u: input_reg=%04u ", channel, value);
65 if (!this->
write_byte_16(DAC7678_REG_WRITE_N_UPDATE_N | channel, value << 4)) {
76 auto input =
static_cast<uint16_t
>(input_rounded);
void mark_failed()
Mark this component as failed.
void status_set_warning()
void status_clear_warning()
void set_parent(T *parent)
Set the parent of this object.
const uint16_t full_scale_
void write_state(float state) override
void dump_config() override
void register_channel(DAC7678Channel *channel)
uint16_t dac_input_reg_[8]
void set_channel_value_(uint8_t channel, uint16_t value)
bool write_byte_16(uint8_t a_register, uint16_t data) const
ESPHOME_LOG_TAG(TAG, "dac7678")
void IRAM_ATTR HOT delayMicroseconds(uint32_t us)