ESPHome 2026.11.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::gt911 {
9
11 public:
12 virtual void update_button(uint8_t index, bool state) = 0;
13};
14
16 public:
19 void setup() override;
20 void dump_config() override;
21 bool can_proceed() override { return this->setup_done_; }
22
24 void set_interrupt_pin(GPIOPin *pin) { this->interrupt_pin_ = pin; }
25
26 void set_reset_pin(GPIOPin *pin) { this->reset_pin_ = pin; }
27 void register_button_listener(GT911ButtonListener *listener) { this->button_listeners_.push_back(listener); }
28
29 protected:
30 void update_touches() override;
31
40 void setup_internal_();
42 bool setup_done_{false};
43
46 std::vector<GT911ButtonListener *> button_listeners_;
47 uint8_t button_state_{0xFF}; // last button state. Initial FF guarantees first update.
48};
49
50} // namespace esphome::gt911
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
With a reset pin the chip is reset with the interrupt pin held low, which selects address 0x5D,...
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:144
bool state
Definition fan.h:2