https://github.com/water2891/esp_lcd_touch_cst816s
If espressif/esp_lcd_touch_cst816s(<=1.0.6) doesn't work on your cst816s, try my modified version.
https://github.com/water2891/esp_lcd_touch_cst816s
cst816s esp-idf esp32
Last synced: 20 days ago
JSON representation
If espressif/esp_lcd_touch_cst816s(<=1.0.6) doesn't work on your cst816s, try my modified version.
- Host: GitHub
- URL: https://github.com/water2891/esp_lcd_touch_cst816s
- Owner: water2891
- License: apache-2.0
- Created: 2025-04-25T09:12:12.000Z (25 days ago)
- Default Branch: main
- Last Pushed: 2025-04-25T10:05:36.000Z (25 days ago)
- Last Synced: 2025-04-30T04:57:08.402Z (20 days ago)
- Topics: cst816s, esp-idf, esp32
- Language: C
- Homepage:
- Size: 39.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# esp_lcd_touch_cst816s
[中文](README_CN.md)
If espressif/esp_lcd_touch_cst816s(<=1.0.6) doesn't work on your cst816s, try my modified version.
1. Comment these two lines in 'esp_lcd_touch_new_i2c_cst816s'
```c
/* Reset controller */
//ESP_GOTO_ON_ERROR(reset(cst816s), err, TAG, "Reset failed");
/* Read product id */
//ESP_GOTO_ON_ERROR(read_id(cst816s), err, TAG, "Read version failed");
*tp = cst816s;
```2. Change DATA_START_REG to 0x01
3. Add gesture in data_t struct
```c
typedef struct {
uint8_t gesture; //define gesture
uint8_t num;
uint8_t x_h : 4;
uint8_t : 4;
uint8_t x_l;
uint8_t y_h : 4;
uint8_t : 4;
uint8_t y_l;
} data_t;data_t point;
ESP_RETURN_ON_ERROR(i2c_read_bytes(tp, DATA_START_REG, (uint8_t *)&point, sizeof(data_t)), TAG, "I2C read failed");portENTER_CRITICAL(&tp->data.lock);
point.num = point.gesture > 0 ? 1 : point.num; //fix point.num by gesture data, because you'll get 0 when single click
point.num = (point.num > POINT_NUM_MAX ? POINT_NUM_MAX : point.num);
```