From cfe59031a55ebf6b8c1a79bf54e39468f4ad959b Mon Sep 17 00:00:00 2001 From: fuzhibo Date: Fri, 29 Jan 2021 21:01:38 +0800 Subject: [PATCH] fix: clear interrupt in touch sensor initialization --- components/esp_system/sleep_modes.c | 1 + components/hal/esp32/touch_sensor_hal.c | 2 ++ components/hal/esp32s2/touch_sensor_hal.c | 2 ++ components/hal/esp32s3/touch_sensor_hal.c | 2 ++ 4 files changed, 7 insertions(+) diff --git a/components/esp_system/sleep_modes.c b/components/esp_system/sleep_modes.c index 0658790d5a..3ead495f10 100644 --- a/components/esp_system/sleep_modes.c +++ b/components/esp_system/sleep_modes.c @@ -896,6 +896,7 @@ static void touch_wakeup_prepare(void) if ((touch_num > TOUCH_PAD_NUM0) && (touch_num < TOUCH_PAD_MAX) && touch_ll_get_fsm_state()) { touch_ll_stop_fsm(); touch_ll_clear_channel_mask(TOUCH_PAD_BIT_MASK_ALL); + touch_ll_intr_clear(TOUCH_PAD_INTR_MASK_ALL); // Clear state from previous wakeup touch_ll_set_channel_mask(BIT(touch_num)); touch_ll_start_fsm(); } diff --git a/components/hal/esp32/touch_sensor_hal.c b/components/hal/esp32/touch_sensor_hal.c index 5debd505e1..59a10e5150 100644 --- a/components/hal/esp32/touch_sensor_hal.c +++ b/components/hal/esp32/touch_sensor_hal.c @@ -19,7 +19,9 @@ void touch_hal_init(void) { + touch_ll_stop_fsm(); touch_ll_intr_disable(); + touch_ll_intr_clear(); touch_ll_clear_channel_mask(TOUCH_PAD_BIT_MASK_ALL); touch_ll_clear_group_mask(TOUCH_PAD_BIT_MASK_ALL, TOUCH_PAD_BIT_MASK_ALL); touch_ll_set_trigger_mode(TOUCH_TRIGGER_MODE_DEFAULT); diff --git a/components/hal/esp32s2/touch_sensor_hal.c b/components/hal/esp32s2/touch_sensor_hal.c index 6d11432e80..e07af73494 100644 --- a/components/hal/esp32s2/touch_sensor_hal.c +++ b/components/hal/esp32s2/touch_sensor_hal.c @@ -20,7 +20,9 @@ void touch_hal_init(void) { + touch_ll_stop_fsm(); touch_ll_intr_disable(TOUCH_PAD_INTR_MASK_ALL); + touch_ll_intr_clear(TOUCH_PAD_INTR_MASK_ALL); touch_ll_clear_channel_mask(TOUCH_PAD_BIT_MASK_ALL); touch_ll_clear_trigger_status_mask(); touch_ll_set_meas_times(TOUCH_PAD_MEASURE_CYCLE_DEFAULT); diff --git a/components/hal/esp32s3/touch_sensor_hal.c b/components/hal/esp32s3/touch_sensor_hal.c index 866a82f722..dac05f4958 100644 --- a/components/hal/esp32s3/touch_sensor_hal.c +++ b/components/hal/esp32s3/touch_sensor_hal.c @@ -20,7 +20,9 @@ void touch_hal_init(void) { + touch_ll_stop_fsm(); touch_ll_intr_disable(TOUCH_PAD_INTR_MASK_ALL); + touch_ll_intr_clear(TOUCH_PAD_INTR_MASK_ALL); touch_ll_clear_channel_mask(TOUCH_PAD_BIT_MASK_ALL); touch_ll_clear_trigger_status_mask(); touch_ll_set_meas_times(TOUCH_PAD_MEASURE_CYCLE_DEFAULT);