ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
dac7678_output.h
Go to the documentation of this file.
1#pragma once
2
7
8namespace esphome::dac7678 {
9
10class DAC7678Output;
11
12class DAC7678Channel : public output::FloatOutput, public Parented<DAC7678Output> {
13 public:
14 void set_channel(uint8_t channel) { channel_ = channel; }
15
16 protected:
17 friend class DAC7678Output;
18
19 const uint16_t full_scale_ = 0xFFF;
20
21 void write_state(float state) override;
22
23 uint8_t channel_;
24};
25
27class DAC7678Output : public Component, public i2c::I2CDevice {
28 public:
30
31 void register_channel(DAC7678Channel *channel);
32
33 void set_internal_reference(const bool value) { this->internal_reference_ = value; }
34
35 void setup() override;
36 void dump_config() override;
37 float get_setup_priority() const override { return setup_priority::HARDWARE; }
38
39 protected:
41
43
44 void set_channel_value_(uint8_t channel, uint16_t value);
45
46 uint8_t min_channel_{0xFF};
47 uint8_t max_channel_{0x00};
48 uint16_t dac_input_reg_[8] = {
49 0,
50 };
51};
52
53} // namespace esphome::dac7678
Helper class to easily give an object a parent of type T.
Definition helpers.h:1861
void set_channel(uint8_t channel)
void write_state(float state) override
DAC7678 float output component.
float get_setup_priority() const override
void set_internal_reference(const bool value)
void register_channel(DAC7678Channel *channel)
void set_channel_value_(uint8_t channel, uint16_t value)
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:132
Base class for all output components that can output a variable level, like PWM.
bool state
Definition fan.h:2
constexpr float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
Definition component.h:41