fix: clear interrupt in touch sensor initialization

This commit is contained in:
fuzhibo
2021-03-24 16:09:52 +08:00
parent 74649219f4
commit a866f0d8f6
3 changed files with 8 additions and 0 deletions

View File

@ -37,6 +37,9 @@
#include "hal/wdt_hal.h"
#include "hal/clk_gate_ll.h"
#include "driver/rtc_io.h"
#include "hal/touch_sensor_hal.h"
#include "driver/touch_sensor.h"
#include "driver/touch_sensor_common.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "sdkconfig.h"
@ -458,6 +461,7 @@ static void touch_wakeup_prepare(void)
touch_pad_sleep_channel_t slp_config;
touch_pad_fsm_stop();
touch_pad_clear_channel_mask(SOC_TOUCH_SENSOR_BIT_MASK_MAX);
touch_ll_intr_clear(TOUCH_PAD_INTR_MASK_ALL); // Clear state from previous wakeup
touch_pad_sleep_channel_get_info(&slp_config);
touch_pad_set_channel_mask(BIT(slp_config.touch_num));
touch_pad_fsm_start();

View File

@ -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(SOC_TOUCH_SENSOR_BIT_MASK_MAX);
touch_ll_clear_group_mask(SOC_TOUCH_SENSOR_BIT_MASK_MAX, SOC_TOUCH_SENSOR_BIT_MASK_MAX);
touch_ll_set_trigger_mode(TOUCH_TRIGGER_MODE_DEFAULT);

View File

@ -19,7 +19,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(SOC_TOUCH_SENSOR_BIT_MASK_MAX);
touch_ll_clear_trigger_status_mask();
touch_ll_set_meas_times(TOUCH_PAD_MEASURE_CYCLE_DEFAULT);