ESPHome 2026.5.1
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::cst226 {
10
11static const uint8_t CST226_REG_STATUS = 0x00;
12
14 public:
15 virtual void update_button(bool state) = 0;
16};
17
19 public:
20 void setup() override;
21 void update_touches() override;
22 void dump_config() override;
23
25 void set_reset_pin(GPIOPin *pin) { this->reset_pin_ = pin; }
26 bool can_proceed() override { return this->setup_complete_ || this->is_failed(); }
27 void register_button_listener(CST226ButtonListener *listener) { this->button_listeners_.push_back(listener); }
28
29 protected:
30 bool read16_(uint16_t addr, uint8_t *data, size_t len);
31 void continue_setup_();
32 void update_button_state_(bool state);
33
36 uint8_t chip_id_{};
38 std::vector<CST226ButtonListener *> button_listeners_;
40};
41
42} // namespace esphome::cst226
bool is_failed() const
Definition component.h:284
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:132
bool state
Definition fan.h:2
std::string size_t len