ESPHome  2022.6.2
esp32_dac.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "esphome/core/hal.h"
7 
8 #ifdef USE_ESP32
9 
10 namespace esphome {
11 namespace esp32_dac {
12 
13 class ESP32DAC : public output::FloatOutput, public Component {
14  public:
15  void set_pin(InternalGPIOPin *pin) { pin_ = pin; }
16 
18  void setup() override;
19  void dump_config() override;
21  float get_setup_priority() const override { return setup_priority::HARDWARE; }
22 
23  protected:
24  void write_state(float state) override;
25 
27 };
28 
29 } // namespace esp32_dac
30 } // namespace esphome
31 
32 #endif
void setup() override
Initialize pin.
Definition: esp32_dac.cpp:19
void set_pin(InternalGPIOPin *pin)
Definition: esp32_dac.h:15
InternalGPIOPin * pin_
Definition: esp32_dac.h:26
Base class for all output components that can output a variable level, like PWM.
Definition: float_output.h:31
const float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
Definition: component.cpp:17
float get_setup_priority() const override
HARDWARE setup_priority.
Definition: esp32_dac.h:21
Definition: a4988.cpp:4
void write_state(float state) override
Definition: esp32_dac.cpp:36
void dump_config() override
Definition: esp32_dac.cpp:30
bool state
Definition: fan.h:34