Procházet zdrojové kódy

Merge branch 'bugfix/clear_interrupt_in_touch_sensor_initialization' into 'master'

fix: clear interrupt in touch sensor initialization

See merge request espressif/esp-idf!12201
Michael (XIAO Xufeng) před 4 roky
rodič
revize
2e0e583ad1

+ 1 - 0
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();
     }

+ 2 - 0
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);

+ 2 - 0
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);

+ 2 - 0
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);