1
0
mirror of https://github.com/esphome/esphome.git synced 2025-03-26 04:28:17 +00:00
Clyde Stubbs d6bcc465a8
Add CST816 touchscreen driver (#5941)
* Add CST816 touchscreen
2024-03-11 16:34:46 +11:00

28 lines
796 B
C++

#pragma once
#include "esphome/components/binary_sensor/binary_sensor.h"
#include "esphome/components/cst816/touchscreen/cst816_touchscreen.h"
#include "esphome/core/component.h"
#include "esphome/core/helpers.h"
namespace esphome {
namespace cst816 {
class CST816Button : public binary_sensor::BinarySensor,
public Component,
public CST816ButtonListener,
public Parented<CST816Touchscreen> {
public:
void setup() override {
this->parent_->register_button_listener(this);
this->publish_initial_state(false);
}
void dump_config() override { LOG_BINARY_SENSOR("", "CST816 Button", this); }
void update_button(bool state) override { this->publish_state(state); }
};
} // namespace cst816
} // namespace esphome