ESPHome  2021.10.2
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:42
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:17
Library based on https://github.com/miguelbalboa/rfid and adapted to ESPHome by . ...
Definition: a4988.cpp:4
void write_state(bool state) override