ESPHome 2026.3.0-dev
Loading...
Searching...
No Matches
gt911_touchscreen.h
Go to the documentation of this file.
1#pragma once
2
6#include "esphome/core/hal.h"
7
8namespace esphome {
9namespace gt911 {
10
12 public:
13 virtual void update_button(uint8_t index, bool state) = 0;
14};
15
17 public:
29 void setup() override;
30 void dump_config() override;
31 bool can_proceed() override { return this->setup_done_; }
32
34 void set_interrupt_pin(GPIOPin *pin) { this->interrupt_pin_ = pin; }
35
36 void set_reset_pin(GPIOPin *pin) { this->reset_pin_ = pin; }
37 void register_button_listener(GT911ButtonListener *listener) { this->button_listeners_.push_back(listener); }
38
39 protected:
40 void update_touches() override;
41
50 void setup_internal_();
52 bool setup_done_{false};
53
56 std::vector<GT911ButtonListener *> button_listeners_;
57 uint8_t button_state_{0xFF}; // last button state. Initial FF guarantees first update.
58};
59
60} // namespace gt911
61} // namespace esphome
virtual void update_button(uint8_t index, bool state)=0
void register_button_listener(GT911ButtonListener *listener)
void setup_internal_()
Perform the internal setup routine for the GT911 touchscreen.
void set_interrupt_pin(GPIOPin *pin)
Set a interrupt pin (supports hardware interrupts or expander connected).
void setup() override
Initialize the GT911 touchscreen.
std::vector< GT911ButtonListener * > button_listeners_
bool setup_done_
True if the touchscreen setup has completed successfully.
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:132
bool state
Definition fan.h:2
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7