ESPHome 2025.5.0
Loading...
Searching...
No Matches
cst226_touchscreen.h
Go to the documentation of this file.
1#pragma once
2
6#include "esphome/core/hal.h"
7#include "esphome/core/log.h"
8
9namespace esphome {
10namespace cst226 {
11
12static const uint8_t CST226_REG_STATUS = 0x00;
13
15 public:
16 virtual void update_button(bool state) = 0;
17};
18
20 public:
21 void setup() override;
22 void update_touches() override;
23 void dump_config() override;
24
26 void set_reset_pin(GPIOPin *pin) { this->reset_pin_ = pin; }
27 bool can_proceed() override { return this->setup_complete_ || this->is_failed(); }
28 void register_button_listener(CST226ButtonListener *listener) { this->button_listeners_.push_back(listener); }
29
30 protected:
31 bool read16_(uint16_t addr, uint8_t *data, size_t len);
32 void continue_setup_();
33 void update_button_state_(bool state);
34
37 uint8_t chip_id_{};
39 std::vector<CST226ButtonListener *> button_listeners_;
41};
42
43} // namespace cst226
44} // namespace esphome
bool is_failed() const
virtual void update_button(bool state)=0
std::vector< CST226ButtonListener * > button_listeners_
bool read16_(uint16_t addr, uint8_t *data, size_t len)
void set_interrupt_pin(InternalGPIOPin *pin)
void register_button_listener(CST226ButtonListener *listener)
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:133
bool state
Definition fan.h:0
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
std::string size_t len
Definition helpers.h:301