ESPHome  2024.11.1
mcp4728_output.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../mcp4728.h"
7 
8 namespace esphome {
9 namespace mcp4728 {
10 
12  public:
14  MCP4728PwrDown pwrdown)
15  : parent_(parent), channel_(channel) {
16  // update VREF
17  parent->select_vref_(channel, vref);
18  // update PD
19  parent->select_power_down_(channel, pwrdown);
20  // update GAIN
21  parent->select_gain_(channel, gain);
22  }
23 
24  protected:
25  void write_state(float state) override;
26 
29 };
30 
31 } // namespace mcp4728
32 } // namespace esphome
void select_power_down_(MCP4728ChannelIdx channel, MCP4728PwrDown pd)
Definition: mcp4728.cpp:101
Base class for all output components that can output a variable level, like PWM.
Definition: float_output.h:31
MCP4728 float output component.
Definition: mcp4728.h:42
void select_vref_(MCP4728ChannelIdx channel, MCP4728Vref vref)
Definition: mcp4728.cpp:95
MCP4728Channel(MCP4728Component *parent, MCP4728ChannelIdx channel, MCP4728Vref vref, MCP4728Gain gain, MCP4728PwrDown pwrdown)
AlsGain501 gain
void select_gain_(MCP4728ChannelIdx channel, MCP4728Gain gain)
Definition: mcp4728.cpp:107
void write_state(float state) override
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
bool state
Definition: fan.h:34