mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-20 04:53:28 +02:00
8e75980ebd
* 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
30 lines
672 B
C++
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
|