Files
esphome-dev/esphome/components/gpio/output/gpio_binary_output.h
T
Otto Winter 8e75980ebd Cleanup dashboard JS (#491)
* Cleanup dashboard JS

* Add vscode

* Save start_mark/end_mark

* Updates

* Updates

* Remove need for cv.nameable

It's a bit hacky but removes so much bloat from integrations

* Add enum helper

* Document APIs, and Improvements

* Fixes

* Fixes

* Update PULL_REQUEST_TEMPLATE.md

* Updates

* Updates

* Updates
2019-04-22 21:56:30 +02:00

30 lines
672 B
C++

#pragma once
#include "esphome/core/component.h"
#include "esphome/core/esphal.h"
#include "esphome/components/output/binary_output.h"
namespace esphome {
namespace gpio {
class GPIOBinaryOutput : public output::BinaryOutput, public Component {
public:
void set_pin(GPIOPin *pin) { pin_ = pin; }
void setup() override {
this->turn_off();
this->pin_->setup();
this->turn_off();
}
void dump_config() override;
float get_setup_priority() const override { return setup_priority::HARDWARE; }
protected:
void write_state(bool state) override { this->pin_->digital_write(state); }
GPIOPin *pin_;
};
} // namespace gpio
} // namespace esphome