ESPHome 2026.12.0-dev
Loading...
Searching...
No Matches
cst328_touchscreen.h
Go to the documentation of this file.
1#pragma once
2
6#include "esphome/core/hal.h"
7#ifdef CST328_BUTTON_COUNT
10#endif
11
12namespace esphome::cst328 {
13
14static constexpr uint8_t CST328_TOUCH_MAX_POINTS = 5;
15static constexpr uint8_t CST328_TOUCH_DATA_SIZE = cstxxx::report_size(CST328_TOUCH_MAX_POINTS);
16
17static constexpr uint16_t CST_REG_TOUCH_INFORMATION = cstxxx::REG_TOUCH_DATA;
18static constexpr uint16_t CST_REG_FINGER_COUNT_IDX = cstxxx::FINGER_COUNT_IDX;
19static constexpr uint16_t CST_REG_X_Y_RESOLUTION = cstxxx::REG_RESOLUTION;
20static constexpr uint16_t CST_REG_FW_CRC_AND_BOOT_TIME = cstxxx::REG_FW_CHECK_CODE;
21
23 public:
24 void setup() override;
25#ifdef CST328_BUTTON_COUNT
26 void add_button_binary_sensor(binary_sensor::BinarySensor *sensor) { this->buttons_.push_back(sensor); }
27#endif
28 void dump_config() override;
29
30 protected:
31 void update_touches() override;
32 void reset_device_();
33 void continue_setup_();
34 void update_button_state_(bool state);
35
36#ifdef CST328_BUTTON_COUNT
38#endif
39 uint8_t fw_ver_major_{};
40 uint8_t fw_ver_minor_{};
41 uint16_t chip_id_{};
42 uint16_t project_id_{};
43 uint16_t fw_build_{};
44#ifdef CST328_BUTTON_COUNT
46#endif
47};
48
49} // namespace esphome::cst328
Minimal static vector - saves memory by avoiding std::vector overhead.
Definition helpers.h:335
Base class for all binary_sensor-type classes.
void add_button_binary_sensor(binary_sensor::BinarySensor *sensor)
StaticVector< binary_sensor::BinarySensor *, CST328_BUTTON_COUNT > buttons_
bool state
Definition fan.h:2
constexpr size_t report_size(uint8_t points)
Bytes of a touch report holding points records; two status bytes follow the first record.
Definition cstxxx.h:30