Skip to content

Commit f15a60f

Browse files
committed
remove(touch_element): remove touch_element from idf
Touch Element Library is moved to managed component. (https://components.espressif.com/components/espressif/touch_element/versions/1.0.0/readme)
1 parent 012318d commit f15a60f

File tree

82 files changed

+98
-8241
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+98
-8241
lines changed

.gitlab/CODEOWNERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@
156156
/components/spi_flash/ @esp-idf-codeowners/peripherals
157157
/components/spiffs/ @esp-idf-codeowners/storage
158158
/components/tcp_transport/ @esp-idf-codeowners/network
159-
/components/touch_element/ @esp-idf-codeowners/peripherals
160159
/components/ulp/ @esp-idf-codeowners/system
161160
/components/unity/ @esp-idf-codeowners/peripherals @esp-idf-codeowners/system
162161
/components/usb/ @esp-idf-codeowners/peripherals/usb

components/driver/test_apps/.build-test-rules.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@ components/driver/test_apps/legacy_twai:
2323
depends_components:
2424
- esp_driver_gpio
2525

26+
components/driver/test_apps/touch_element:
27+
disable:
28+
- if: IDF_TARGET not in ["esp32s2", "esp32s3"]
29+
reason: only supports esp32s2 and esp32s3
30+
depends_filepatterns:
31+
- components/soc/**/touch_sensor_periph.h
32+
- components/soc/esp32s2/**/rtc_cntl_*
33+
- components/soc/esp32s3/**/rtc_cntl_*
34+
- components/soc/esp32s2/**/rtc_io_struct.h
35+
- components/soc/esp32s3/**/rtc_io_struct.h
36+
- components/soc/esp32s2/**/sens_struct.h
37+
- components/soc/esp32s3/**/sens_struct.h
38+
2639
components/driver/test_apps/touch_sensor_v1:
2740
disable:
2841
- if: SOC_TOUCH_SENSOR_VERSION != 1
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
idf_component_register(SRCS "test_app_main.c" "test_touch_element.c" "test_touch_button.c"
22
"test_touch_slider.c" "test_touch_matrix.c"
3-
PRIV_REQUIRES unity touch_element
3+
PRIV_REQUIRES unity touch_element esp_pm
44
WHOLE_ARCHIVE
55
)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dependencies:
2+
espressif/touch_element: ^1.0.0

components/touch_element/test_apps/main/test_app_main.c renamed to components/driver/test_apps/touch_element/main/test_app_main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "freertos/FreeRTOS.h"
1111
#include "freertos/task.h"
1212

13-
// Some resources are lazy allocated in gpio/dedicated_gpio/delta_sigma driver, the threshold is left for that case
1413
#define TEST_MEMORY_LEAK_THRESHOLD (-400)
1514

1615
static size_t before_free_8bit;

components/touch_element/test_apps/main/test_touch_button.c renamed to components/driver/test_apps/touch_element/main/test_touch_button.c

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Unlicense OR CC0-1.0
55
*/
@@ -14,7 +14,8 @@
1414
#include "unity.h"
1515
#include "esp_random.h"
1616

17-
#include "touch_element/touch_element_private.h"
17+
#include "esp_private/touch_element_private.h"
18+
#include "esp_private/touch_sensor_legacy_ll.h"
1819
#include "touch_element/touch_button.h"
1920

2021
static portMUX_TYPE test_button_spinlock = portMUX_INITIALIZER_UNLOCKED;
@@ -103,11 +104,14 @@ void test_button_event_simulator(touch_button_handle_t button_handle, touch_butt
103104
te_button_handle_t te_button = (te_button_handle_t) button_handle;
104105
touch_pad_t channel = te_button->device->channel;
105106
if (button_event == TOUCH_BUTTON_EVT_ON_PRESS) {
106-
touch_pad_set_cnt_mode(channel, TOUCH_PAD_SLOPE_3, TOUCH_PAD_TIE_OPT_DEFAULT);
107+
touch_ll_set_slope(channel, TOUCH_PAD_SLOPE_3);
108+
touch_ll_set_tie_option(channel, TOUCH_PAD_TIE_OPT_DEFAULT);
107109
} else if (button_event == TOUCH_BUTTON_EVT_ON_RELEASE) {
108-
touch_pad_set_cnt_mode(channel, TOUCH_PAD_SLOPE_7, TOUCH_PAD_TIE_OPT_DEFAULT);
110+
touch_ll_set_slope(channel, TOUCH_PAD_SLOPE_7);
111+
touch_ll_set_tie_option(channel, TOUCH_PAD_TIE_OPT_DEFAULT);
109112
} else {
110-
touch_pad_set_cnt_mode(channel, TOUCH_PAD_SLOPE_3, TOUCH_PAD_TIE_OPT_DEFAULT); //LongPress
113+
touch_ll_set_slope(channel, TOUCH_PAD_SLOPE_3);
114+
touch_ll_set_tie_option(channel, TOUCH_PAD_TIE_OPT_DEFAULT);
111115
}
112116
}
113117

@@ -129,7 +133,8 @@ static void test_button_callback_check(touch_button_handle_t current_handle, tou
129133
}
130134

131135
void test_button_event_trigger_and_check(touch_button_handle_t handle, touch_button_event_t button_event)
132-
{//TODO: refactor this with a constructor
136+
{
137+
//TODO: refactor this with a constructor
133138
touch_elem_message_t valid_message = {
134139
.handle = handle,
135140
.element_type = TOUCH_ELEM_TYPE_BUTTON,
@@ -189,8 +194,8 @@ static void test_button_disp_event(void)
189194
};
190195
TEST_ESP_OK(touch_button_create(&button_config, &button_handle[i]));
191196
TEST_ESP_OK(touch_button_subscribe_event(button_handle[i],
192-
TOUCH_ELEM_EVENT_ON_PRESS | TOUCH_ELEM_EVENT_ON_RELEASE | TOUCH_ELEM_EVENT_ON_LONGPRESS,
193-
(void *) button_channel_array[i]));
197+
TOUCH_ELEM_EVENT_ON_PRESS | TOUCH_ELEM_EVENT_ON_RELEASE | TOUCH_ELEM_EVENT_ON_LONGPRESS,
198+
(void *) button_channel_array[i]));
194199
TEST_ESP_OK(touch_button_set_longpress(button_handle[i], 300));
195200
TEST_ESP_OK(touch_button_set_dispatch_method(button_handle[i], TOUCH_ELEM_DISP_EVENT));
196201
}
@@ -233,8 +238,8 @@ static void test_button_disp_callback(void)
233238
};
234239
TEST_ESP_OK(touch_button_create(&button_config, &button_handle[i]));
235240
TEST_ESP_OK(touch_button_subscribe_event(button_handle[i],
236-
TOUCH_ELEM_EVENT_ON_PRESS | TOUCH_ELEM_EVENT_ON_RELEASE | TOUCH_ELEM_EVENT_ON_LONGPRESS,
237-
(void *) &monitor));
241+
TOUCH_ELEM_EVENT_ON_PRESS | TOUCH_ELEM_EVENT_ON_RELEASE | TOUCH_ELEM_EVENT_ON_LONGPRESS,
242+
(void *) &monitor));
238243
TEST_ESP_OK(touch_button_set_dispatch_method(button_handle[i], TOUCH_ELEM_DISP_CALLBACK));
239244
TEST_ESP_OK(touch_button_set_callback(button_handle[i], &test_button_handler));
240245
TEST_ESP_OK(touch_button_set_longpress(button_handle[i], 300));
@@ -295,7 +300,7 @@ static void test_button_event_change_lp(void)
295300
printf("Touch button event change longtime test start\n");
296301
for (int i = 0; i < 10; i++) {
297302
printf("Touch button event change longtime test... (%d/10)\n", i + 1);
298-
esp_err_t ret;
303+
esp_err_t ret = ESP_OK;
299304
uint8_t channel_index = random() % BUTTON_CHANNEL_NUM;
300305
touch_elem_message_t valid_message = {
301306
.handle = button_handle[channel_index],
@@ -412,7 +417,7 @@ static void test_button_event_concurrent(void)
412417
printf("Touch button event concurrent test start\n");
413418
for (int i = 0; i < 10; i++) {
414419
printf("Touch button event concurrent test... (%d/10)\n", i + 1);
415-
esp_err_t ret;
420+
esp_err_t ret = ESP_OK;
416421
uint32_t message_count = 0;
417422
touch_elem_message_t current_message;
418423

@@ -488,7 +493,6 @@ static void test_button_random_trigger_concurrent(void)
488493
TEST_ASSERT(os_ret == pdPASS);
489494
}
490495

491-
492496
uint32_t run_count = 0;
493497
while (1) {
494498
if (run_count++ % 1000 == 0) {

components/touch_element/test_apps/main/test_touch_element.c renamed to components/driver/test_apps/touch_element/main/test_touch_element.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Unlicense OR CC0-1.0
55
*/
@@ -34,6 +34,7 @@
3434
#include "touch_element/touch_button.h"
3535
#include "touch_element/touch_slider.h"
3636
#include "touch_element/touch_matrix.h"
37+
#include "esp_private/touch_sensor_legacy_ll.h"
3738

3839
typedef struct {
3940
QueueHandle_t valid_msg_handle;
@@ -110,7 +111,8 @@ static void test_system_waterproof_guard(void)
110111
printf("Touch Element waterproof guard sensor test start\n");
111112

112113
srandom((unsigned int)time(NULL));
113-
{//No use waterproof guard sensor
114+
{
115+
//No use waterproof guard sensor
114116
touch_elem_waterproof_config_t waterproof_config = {
115117
.guard_channel = TOUCH_WATERPROOF_GUARD_NOUSE,
116118
.guard_sensitivity = 0.0F
@@ -128,7 +130,8 @@ static void test_system_waterproof_guard(void)
128130
touch_element_waterproof_uninstall();
129131
}
130132

131-
{//Use waterproof guard sensor(Add all handles)
133+
{
134+
//Use waterproof guard sensor(Add all handles)
132135
touch_elem_waterproof_config_t waterproof_config = {
133136
.guard_channel = TOUCH_PAD_NUM13,
134137
.guard_sensitivity = 0.1F
@@ -158,7 +161,8 @@ static void test_system_waterproof_guard(void)
158161
touch_element_waterproof_uninstall();
159162
}
160163

161-
{//Put half button handles into guard ring
164+
{
165+
//Put half button handles into guard ring
162166
const uint8_t protect_handle_threshold = BUTTON_CHANNEL_NUM / 2;
163167
touch_elem_waterproof_config_t waterproof_config = {
164168
.guard_channel = TOUCH_PAD_NUM13,
@@ -196,9 +200,11 @@ static void test_system_waterproof_guard(void)
196200
static void test_waterproof_event_simulator(touch_pad_t guard_channel, touch_button_event_t guard_state)
197201
{
198202
if (guard_state == TOUCH_BUTTON_EVT_ON_PRESS) {
199-
touch_pad_set_cnt_mode(guard_channel, TOUCH_PAD_SLOPE_3, TOUCH_PAD_TIE_OPT_DEFAULT);
203+
touch_ll_set_slope(guard_channel, TOUCH_PAD_SLOPE_3);
204+
touch_ll_set_tie_option(guard_channel, TOUCH_PAD_TIE_OPT_DEFAULT);
200205
} else if (guard_state == TOUCH_BUTTON_EVT_ON_RELEASE) {
201-
touch_pad_set_cnt_mode(guard_channel, TOUCH_PAD_SLOPE_7, TOUCH_PAD_TIE_OPT_DEFAULT);
206+
touch_ll_set_slope(guard_channel, TOUCH_PAD_SLOPE_7);
207+
touch_ll_set_tie_option(guard_channel, TOUCH_PAD_TIE_OPT_DEFAULT);
202208
} else {
203209
printf("guard sensor simulator doesn't support this operation\n");
204210
}

components/touch_element/test_apps/main/test_touch_matrix.c renamed to components/driver/test_apps/touch_element/main/test_touch_matrix.c

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Unlicense OR CC0-1.0
55
*/
@@ -13,7 +13,8 @@
1313
#include "freertos/semphr.h"
1414
#include "unity.h"
1515

16-
#include "touch_element/touch_element_private.h"
16+
#include "esp_private/touch_element_private.h"
17+
#include "esp_private/touch_sensor_legacy_ll.h"
1718
#include "touch_element/touch_matrix.h"
1819

1920
static const touch_pad_t x_axis_channel[3] = {
@@ -95,23 +96,31 @@ void test_matrix_event_simulator(touch_matrix_handle_t matrix_handle, touch_matr
9596
touch_pad_t x_channel = te_matrix->device[pos_index / te_matrix->y_channel_num]->channel;
9697
touch_pad_t y_channel = te_matrix->device[te_matrix->x_channel_num + (pos_index % te_matrix->y_channel_num)]->channel;
9798
if (matrix_event == TOUCH_MATRIX_EVT_ON_PRESS) {
98-
touch_pad_set_cnt_mode(x_channel, TOUCH_PAD_SLOPE_3, TOUCH_PAD_TIE_OPT_DEFAULT);
99-
touch_pad_set_cnt_mode(y_channel, TOUCH_PAD_SLOPE_3, TOUCH_PAD_TIE_OPT_DEFAULT);
99+
touch_ll_set_slope(x_channel, TOUCH_PAD_SLOPE_3);
100+
touch_ll_set_tie_option(x_channel, TOUCH_PAD_TIE_OPT_DEFAULT);
101+
touch_ll_set_slope(y_channel, TOUCH_PAD_SLOPE_3);
102+
touch_ll_set_tie_option(y_channel, TOUCH_PAD_TIE_OPT_DEFAULT);
100103
} else if (matrix_event == TOUCH_MATRIX_EVT_ON_RELEASE) {
101-
touch_pad_set_cnt_mode(x_channel, TOUCH_PAD_SLOPE_7, TOUCH_PAD_TIE_OPT_DEFAULT);
102-
touch_pad_set_cnt_mode(y_channel, TOUCH_PAD_SLOPE_7, TOUCH_PAD_TIE_OPT_DEFAULT);
104+
touch_ll_set_slope(x_channel, TOUCH_PAD_SLOPE_7);
105+
touch_ll_set_tie_option(x_channel, TOUCH_PAD_TIE_OPT_DEFAULT);
106+
touch_ll_set_slope(y_channel, TOUCH_PAD_SLOPE_7);
107+
touch_ll_set_tie_option(y_channel, TOUCH_PAD_TIE_OPT_DEFAULT);
103108
} else {
104-
touch_pad_set_cnt_mode(x_channel, TOUCH_PAD_SLOPE_3, TOUCH_PAD_TIE_OPT_DEFAULT); // LongPress
105-
touch_pad_set_cnt_mode(y_channel, TOUCH_PAD_SLOPE_3, TOUCH_PAD_TIE_OPT_DEFAULT);
109+
touch_ll_set_slope(x_channel, TOUCH_PAD_SLOPE_3);
110+
touch_ll_set_tie_option(x_channel, TOUCH_PAD_TIE_OPT_DEFAULT);
111+
touch_ll_set_slope(y_channel, TOUCH_PAD_SLOPE_3);
112+
touch_ll_set_tie_option(y_channel, TOUCH_PAD_TIE_OPT_DEFAULT);
106113
}
107114
}
108115

109116
static void test_matrix_channel_simulator(touch_pad_t channel, touch_matrix_event_t matrix_event)
110117
{
111118
if (matrix_event == TOUCH_MATRIX_EVT_ON_PRESS) {
112-
touch_pad_set_cnt_mode(channel, TOUCH_PAD_SLOPE_3, TOUCH_PAD_TIE_OPT_DEFAULT);
119+
touch_ll_set_slope(channel, TOUCH_PAD_SLOPE_3);
120+
touch_ll_set_tie_option(channel, TOUCH_PAD_TIE_OPT_DEFAULT);
113121
} else if (matrix_event == TOUCH_MATRIX_EVT_ON_RELEASE) {
114-
touch_pad_set_cnt_mode(channel, TOUCH_PAD_SLOPE_7, TOUCH_PAD_TIE_OPT_DEFAULT);
122+
touch_ll_set_slope(channel, TOUCH_PAD_SLOPE_7);
123+
touch_ll_set_tie_option(channel, TOUCH_PAD_TIE_OPT_DEFAULT);
115124
}
116125
}
117126

@@ -218,7 +227,7 @@ static void test_matrix_disp_event(void)
218227
printf("Touch matrix event test start\n");
219228
for (int i = 0; i < 10; i++) {
220229
printf("Touch matrix event test... (%d/10)\n", i + 1);
221-
uint32_t button_num = random() % ( MATRIX_CHANNEL_NUM_X * MATRIX_CHANNEL_NUM_Y );
230+
uint32_t button_num = random() % (MATRIX_CHANNEL_NUM_X * MATRIX_CHANNEL_NUM_Y);
222231
test_matrix_event_trigger_and_check(matrix_handle, TOUCH_MATRIX_EVT_ON_PRESS, button_num);
223232
test_matrix_event_trigger_and_check(matrix_handle, TOUCH_MATRIX_EVT_ON_LONGPRESS, button_num);
224233
test_matrix_event_trigger_and_check(matrix_handle, TOUCH_MATRIX_EVT_ON_RELEASE, button_num);
@@ -377,7 +386,7 @@ static void test_matrix_event_change_lp(void)
377386
printf("Touch matrix event change longtime test start\n");
378387
for (int i = 0; i < 10; i++) {
379388
printf("Touch matrix event change longtime test... (%d/10)\n", i + 1);
380-
uint32_t button_num = random() % ( MATRIX_CHANNEL_NUM_X * MATRIX_CHANNEL_NUM_Y );
389+
uint32_t button_num = random() % (MATRIX_CHANNEL_NUM_X * MATRIX_CHANNEL_NUM_Y);
381390
TEST_ESP_OK(touch_matrix_set_longpress(matrix_handle, 200 + (i + 1) * 50));
382391
test_matrix_event_trigger_and_check(matrix_handle, TOUCH_MATRIX_EVT_ON_LONGPRESS, button_num);
383392
test_matrix_event_simulator(matrix_handle, TOUCH_MATRIX_EVT_ON_RELEASE, button_num); //Reset hardware

0 commit comments

Comments
 (0)