mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-30 01:38:27 +02:00
c6dc336c4a
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Co-authored-by: NP v/d Spek <github_mail@lumensoft.nl> Co-authored-by: Clyde Stubbs <2366188+clydebarrow@users.noreply.github.com> Co-authored-by: Gustavo Ambrozio <gustavo@gustavo.eng.br>
33 lines
848 B
C++
33 lines
848 B
C++
#pragma once
|
|
|
|
#include "esphome/components/i2c/i2c.h"
|
|
#include "esphome/components/touchscreen/touchscreen.h"
|
|
#include "esphome/core/component.h"
|
|
#include "esphome/core/hal.h"
|
|
|
|
namespace esphome {
|
|
namespace gt911 {
|
|
|
|
class GT911ButtonListener {
|
|
public:
|
|
virtual void update_button(uint8_t index, bool state) = 0;
|
|
};
|
|
|
|
class GT911Touchscreen : public touchscreen::Touchscreen, public i2c::I2CDevice {
|
|
public:
|
|
void setup() override;
|
|
void dump_config() override;
|
|
|
|
void set_interrupt_pin(InternalGPIOPin *pin) { this->interrupt_pin_ = pin; }
|
|
void register_button_listener(GT911ButtonListener *listener) { this->button_listeners_.push_back(listener); }
|
|
|
|
protected:
|
|
void update_touches() override;
|
|
|
|
InternalGPIOPin *interrupt_pin_{};
|
|
std::vector<GT911ButtonListener *> button_listeners_;
|
|
};
|
|
|
|
} // namespace gt911
|
|
} // namespace esphome
|