ESPHome 2025.5.0
Loading...
Searching...
No Matches
dac7678_output.h
Go to the documentation of this file.
1#pragma once
2
7
8namespace esphome {
9namespace dac7678 {
10
11class DAC7678Output;
12
13class DAC7678Channel : public output::FloatOutput, public Parented<DAC7678Output> {
14 public:
15 void set_channel(uint8_t channel) { channel_ = channel; }
16
17 protected:
18 friend class DAC7678Output;
19
20 const uint16_t full_scale_ = 0xFFF;
21
22 void write_state(float state) override;
23
24 uint8_t channel_;
25};
26
28class DAC7678Output : public Component, public i2c::I2CDevice {
29 public:
31
32 void register_channel(DAC7678Channel *channel);
33
34 void set_internal_reference(const bool value) { this->internal_reference_ = value; }
35
36 void setup() override;
37 void dump_config() override;
38 float get_setup_priority() const override { return setup_priority::HARDWARE; }
39
40 protected:
42
44
45 void set_channel_value_(uint8_t channel, uint16_t value);
46
47 uint8_t min_channel_{0xFF};
48 uint8_t max_channel_{0x00};
49 uint16_t dac_input_reg_[8] = {
50 0,
51 };
52};
53
54} // namespace dac7678
55} // namespace esphome
Helper class to easily give an object a parent of type T.
Definition helpers.h:538
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:133
Base class for all output components that can output a variable level, like PWM.
bool state
Definition fan.h:0
const float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
Definition component.cpp:18
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7