update touch with review advice

This commit is contained in:
fuzhibo
2021-09-06 21:45:08 +08:00
committed by laokaiyao
parent 3ca9da0386
commit 589646a31e
30 changed files with 617 additions and 19 deletions

View File

@@ -0,0 +1,4 @@
| Version | Supported Targets |
| ------- | ----------------- |
| V1 | ESP32 |
| V2 | ESP32S2, ESP32S3 |

View File

@@ -16,8 +16,6 @@
#include "soc/rtc_periph.h"
#include "soc/sens_periph.h"
#if CONFIG_IDF_TARGET_ESP32
static const char *TAG = "Touch pad";
#define TOUCH_THRESH_NO_USE (0)
@@ -171,5 +169,3 @@ void app_main(void)
// Start a task to show what pads have been touched
xTaskCreate(&tp_example_read_task, "touch_pad_read_task", 2048, NULL, 5, NULL);
}
#endif // CONFIG_IDF_TARGET_ESP32

View File

@@ -12,8 +12,6 @@
#include "driver/touch_pad.h"
#include "esp_log.h"
#if CONFIG_IDF_TARGET_ESP32
#define TOUCH_PAD_NO_CHANGE (-1)
#define TOUCH_THRESH_NO_USE (0)
#define TOUCH_FILTER_MODE_EN (1)
@@ -72,5 +70,3 @@ void app_main(void)
// Start task to read values sensed by pads
xTaskCreate(&tp_example_read_task, "touch_pad_read_task", 2048, NULL, 5, NULL);
}
#endif // CONFIG_IDF_TARGET_ESP32

View File

@@ -64,7 +64,7 @@ void app_main(void)
}
#if TOUCH_CHANGE_CONFIG
/* If you want change the touch sensor default setting, please write here(after initialize). There are examples: */
touch_pad_set_meas_time(TOUCH_PAD_SLEEP_CYCLE_DEFAULT, TOUCH_PAD_SLEEP_CYCLE_DEFAULT);
touch_pad_set_meas_time(TOUCH_PAD_SLEEP_CYCLE_DEFAULT, TOUCH_PAD_MEASURE_CYCLE_DEFAULT);
touch_pad_set_voltage(TOUCH_PAD_HIGH_VOLTAGE_THRESHOLD, TOUCH_PAD_LOW_VOLTAGE_THRESHOLD, TOUCH_PAD_ATTEN_VOLTAGE_THRESHOLD);
touch_pad_set_idle_channel_connect(TOUCH_PAD_IDLE_CH_CONNECT_DEFAULT);
for (int i = 0; i < TOUCH_BUTTON_NUM; i++) {