fix(legacy_touch): fixed the read stuck issue after deep sleep

This commit is contained in:
laokaiyao
2026-02-04 14:53:38 +08:00
parent 5de0c45dd6
commit 44049352f7
4 changed files with 14 additions and 13 deletions
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -11,14 +11,13 @@
void touch_hal_init(void)
{
touch_ll_stop_fsm();
touch_ll_intr_disable();
// Deinit to reset the registers in case of the registers are not reset when wakeup from deep sleep.
touch_hal_deinit();
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);
touch_ll_set_trigger_source(TOUCH_TRIGGER_SOURCE_DEFAULT);
touch_ll_clear_trigger_status_mask();
touch_ll_set_meas_time(TOUCH_PAD_MEASURE_CYCLE_DEFAULT);
touch_ll_set_sleep_time(TOUCH_PAD_SLEEP_CYCLE_DEFAULT);
touch_ll_set_fsm_mode(TOUCH_FSM_MODE_DEFAULT);
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -14,11 +14,10 @@ static int s_meas_times = -1;
void touch_hal_init(void)
{
// Deinit to reset the registers in case of the registers are not reset when wakeup from deep sleep.
touch_hal_deinit();
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);
touch_ll_set_sleep_time(TOUCH_PAD_SLEEP_CYCLE_DEFAULT);
/* Configure the touch-sensor power domain into self-bias since bandgap-bias
@@ -45,6 +44,7 @@ void touch_hal_deinit(void)
touch_ll_clear_channel_mask(TOUCH_PAD_BIT_MASK_ALL);
touch_ll_clear_trigger_status_mask();
touch_ll_intr_disable(TOUCH_PAD_INTR_MASK_ALL);
touch_ll_intr_clear(TOUCH_PAD_INTR_MASK_ALL);
touch_ll_timeout_disable();
touch_ll_waterproof_enable(false);
touch_ll_denoise_enable(false);
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -16,11 +16,9 @@ static int s_meas_times = -1;
void touch_hal_init(void)
{
// Deinit to reset the registers in case of the registers are not reset when wakeup from deep sleep.
touch_hal_deinit();
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);
touch_ll_set_sleep_time(TOUCH_PAD_SLEEP_CYCLE_DEFAULT);
/* Configure the touch-sensor power domain into self-bias since bandgap-bias
@@ -47,6 +45,7 @@ void touch_hal_deinit(void)
touch_ll_clear_channel_mask(TOUCH_PAD_BIT_MASK_ALL);
touch_ll_clear_trigger_status_mask();
touch_ll_intr_disable(TOUCH_PAD_INTR_MASK_ALL);
touch_ll_intr_clear(TOUCH_PAD_INTR_MASK_ALL);
touch_ll_timeout_disable();
touch_ll_waterproof_enable(false);
touch_ll_denoise_enable(false);