Skip to content

Commit 0cf27b1

Browse files
committed
feat(multi-touch): Add track ID API to esp_lcd_touch
1 parent c0e8ffa commit 0cf27b1

File tree

3 files changed

+42
-3
lines changed

3 files changed

+42
-3
lines changed

components/lcd_touch/esp_lcd_touch/esp_lcd_touch.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -106,6 +106,20 @@ bool esp_lcd_touch_get_coordinates(esp_lcd_touch_handle_t tp, uint16_t *x, uint1
106106
return touched;
107107
}
108108

109+
esp_err_t esp_lcd_touch_get_track_id(esp_lcd_touch_handle_t tp, uint8_t *track_id, uint8_t point_num)
110+
{
111+
assert(tp != NULL);
112+
assert(track_id != NULL);
113+
assert(point_num > 0);
114+
assert(tp->get_track_id != NULL);
115+
116+
if (tp->get_track_id) {
117+
return tp->get_track_id(tp, track_id, point_num);
118+
} else {
119+
return ESP_ERR_NOT_SUPPORTED;
120+
}
121+
}
122+
109123
#if (CONFIG_ESP_LCD_TOUCH_MAX_BUTTONS > 0)
110124
esp_err_t esp_lcd_touch_get_button_state(esp_lcd_touch_handle_t tp, uint8_t n, uint8_t *state)
111125
{

components/lcd_touch/esp_lcd_touch/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "1.1.2"
1+
version: "1.1.3"
22
description: ESP LCD Touch - main component for using touch screen controllers
33
url: https://github.com/espressif/esp-bsp/tree/master/components/lcd_touch/esp_lcd_touch
44
dependencies:

components/lcd_touch/esp_lcd_touch/include/esp_lcd_touch.h

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -72,6 +72,7 @@ typedef struct {
7272
uint8_t points; /*!< Count of touch points saved */
7373

7474
struct {
75+
uint8_t track_id;
7576
uint16_t x; /*!< X coordinate */
7677
uint16_t y; /*!< Y coordinate */
7778
uint16_t strength; /*!< Strength */
@@ -145,6 +146,18 @@ struct esp_lcd_touch_s {
145146
*/
146147
bool (*get_xy)(esp_lcd_touch_handle_t tp, uint16_t *x, uint16_t *y, uint16_t *strength, uint8_t *point_num, uint8_t max_point_num);
147148

149+
/**
150+
* @brief Get track ids of touch points
151+
*
152+
* @param tp: Touch handler
153+
* @param track_id: Array of track ids
154+
* @param point_num: Count of touched points to return
155+
*
156+
* @return
157+
* - ESP_OK on success, otherwise returns ESP_ERR_xxx
158+
*/
159+
esp_err_t (*get_track_id)(esp_lcd_touch_handle_t tp, uint8_t *track_id, uint8_t point_num);
160+
148161

149162
#if (CONFIG_ESP_LCD_TOUCH_MAX_BUTTONS > 0)
150163
/**
@@ -287,6 +300,18 @@ esp_err_t esp_lcd_touch_read_data(esp_lcd_touch_handle_t tp);
287300
bool esp_lcd_touch_get_coordinates(esp_lcd_touch_handle_t tp, uint16_t *x, uint16_t *y, uint16_t *strength, uint8_t *point_num, uint8_t max_point_num);
288301

289302

303+
/**
304+
* @brief Get track ids of touch points
305+
*
306+
* @param tp: Touch handler
307+
* @param track_id: Array of track ids
308+
* @param point_num: Count of touched points to return
309+
*
310+
* @return
311+
* - ESP_OK on success, otherwise returns ESP_ERR_xxx
312+
*/
313+
esp_err_t esp_lcd_touch_get_track_id(esp_lcd_touch_handle_t tp, uint8_t *track_id, uint8_t point_num);
314+
290315
#if (CONFIG_ESP_LCD_TOUCH_MAX_BUTTONS > 0)
291316
/**
292317
* @brief Get button state

0 commit comments

Comments
 (0)