ESPHome  2024.3.2
dac7678_output.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "esphome/core/helpers.h"
7 
8 namespace esphome {
9 namespace dac7678 {
10 
11 class DAC7678Output;
12 
13 class 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 
28 class 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
void setup()
void set_channel(uint8_t channel)
void write_state(float state) override
Base class for all output components that can output a variable level, like PWM.
Definition: float_output.h:31
float get_setup_priority() const override
const float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
Definition: component.cpp:18
DAC7678 float output component.
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7
This Class provides the methods to read/write bytes from/to an i2c device.
Definition: i2c.h:133
Helper class to easily give an object a parent of type T.
Definition: helpers.h:515
bool state
Definition: fan.h:34
void set_internal_reference(const bool value)