ESPHome  2024.4.0
gpio_binary_output.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "esphome/core/hal.h"
6 
7 namespace esphome {
8 namespace gpio {
9 
11  public:
12  void set_pin(GPIOPin *pin) { pin_ = pin; }
13 
14  void setup() override {
15  this->turn_off();
16  this->pin_->setup();
17  this->turn_off();
18  }
19  void dump_config() override;
20  float get_setup_priority() const override { return setup_priority::HARDWARE; }
21 
22  protected:
23  void write_state(bool state) override { this->pin_->digital_write(state); }
24 
26 };
27 
28 } // namespace gpio
29 } // namespace esphome
virtual void digital_write(bool value)=0
virtual void turn_off()
Disable this binary output.
Definition: binary_output.h:51
virtual void setup()=0
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
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7
void write_state(bool state) override
bool state
Definition: fan.h:34