Skip to content

Commit 40eb9f8

Browse files
committed
updated touch
1 parent 8c601bd commit 40eb9f8

File tree

2 files changed

+1296
-2
lines changed

2 files changed

+1296
-2
lines changed

_10_gpio/_10_10_Touch/main/main.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,22 @@
33
#include "freertos/task.h"
44
#include "driver/touch_pad.h"
55

6+
#define TOUCH_PAD_GPIO13_CHANNEL TOUCH_PAD_NUM4
7+
68
void app_main()
79
{
810
touch_pad_init();
911
touch_pad_set_voltage(TOUCH_HVOLT_2V7, TOUCH_LVOLT_0V5, TOUCH_HVOLT_ATTEN_1V);
1012
touch_pad_config(TOUCH_PAD_GPIO13_CHANNEL, -1);
11-
13+
touch_pad_filter_start(10);
14+
1215
uint16_t val;
1316
uint16_t touch_filter_value = 0;
1417
uint16_t touch_rawValue = 0;
1518

1619
while (true)
17-
{ touch_pad_read_raw_data(TOUCH_PAD_GPIO13_CHANNEL, &touch_rawValue);
20+
{
21+
touch_pad_read_raw_data(TOUCH_PAD_GPIO13_CHANNEL, &touch_rawValue);
1822
touch_pad_read_filtered(TOUCH_PAD_GPIO13_CHANNEL, &touch_filter_value);
1923
touch_pad_read(TOUCH_PAD_GPIO13_CHANNEL, &val);
2024
printf("val = %d raw = %d filtered = %d\n", val, touch_rawValue, touch_filter_value);

0 commit comments

Comments
 (0)