ESPHome 2025.5.0
Loading...
Searching...
No Matches
cst816_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 cst816 {
11
12static const char *const TAG = "cst816.touchscreen";
13
14static const uint8_t REG_STATUS = 0x00;
15static const uint8_t REG_TOUCH_NUM = 0x02;
16static const uint8_t REG_XPOS_HIGH = 0x03;
17static const uint8_t REG_XPOS_LOW = 0x04;
18static const uint8_t REG_YPOS_HIGH = 0x05;
19static const uint8_t REG_YPOS_LOW = 0x06;
20static const uint8_t REG_DIS_AUTOSLEEP = 0xFE;
21static const uint8_t REG_CHIP_ID = 0xA7;
22static const uint8_t REG_FW_VERSION = 0xA9;
23static const uint8_t REG_SLEEP = 0xE5;
24static const uint8_t REG_IRQ_CTL = 0xFA;
25static const uint8_t IRQ_EN_MOTION = 0x70;
26
27static const uint8_t CST826_CHIP_ID = 0x11;
28static const uint8_t CST820_CHIP_ID = 0xB7;
29static const uint8_t CST816S_CHIP_ID = 0xB4;
30static const uint8_t CST816D_CHIP_ID = 0xB6;
31static const uint8_t CST816T_CHIP_ID = 0xB5;
32static const uint8_t CST716_CHIP_ID = 0x20;
33
35 public:
36 virtual void update_button(bool state) = 0;
37};
38
40 public:
41 void setup() override;
42 void update_touches() override;
43 void dump_config() override;
44
46 void set_reset_pin(GPIOPin *pin) { this->reset_pin_ = pin; }
47 void set_skip_probe(bool skip_probe) { this->skip_probe_ = skip_probe; }
48
49 protected:
50 void continue_setup_();
51
54 uint8_t chip_id_{};
55 bool skip_probe_{}; // if set, do not expect to be able to probe the controller on the i2c bus.
56};
57
58} // namespace cst816
59} // namespace esphome
virtual void update_button(bool state)=0
void set_interrupt_pin(InternalGPIOPin *pin)
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