gpio: Fix interrupt lost issue

In previous gpio default isr, interrupt status bits get cleared at the exit of the isr.
However, for edge-triggered interrupt type, the interrupt status bit should be cleared before entering the per-pin handlers to avoid any potential interrupt lost.

Closes https://github.com/espressif/esp-idf/pull/6853
This commit is contained in:
Song Ruo Jing
2022-08-24 17:06:20 +08:00
parent 82f2ad9b6d
commit 61282cc5dd
5 changed files with 45 additions and 44 deletions
+19 -1
View File
@@ -29,6 +29,24 @@ extern "C" {
typedef intr_handle_t gpio_isr_handle_t;
/**
* @brief GPIO interrupt handler
*
* @param arg User registered data
*/
typedef void (*gpio_isr_t)(void *arg);
/**
* @brief Configuration parameters of GPIO pad for gpio_config function
*/
typedef struct {
uint64_t pin_bit_mask; /*!< GPIO pin: set with bit mask, each bit maps to a GPIO */
gpio_mode_t mode; /*!< GPIO mode: set input/output mode */
gpio_pullup_t pull_up_en; /*!< GPIO pull-up */
gpio_pulldown_t pull_down_en; /*!< GPIO pull-down */
gpio_int_type_t intr_type; /*!< GPIO interrupt type */
} gpio_config_t;
/**
* @brief GPIO common configuration
*
@@ -255,7 +273,7 @@ esp_err_t gpio_pulldown_en(gpio_num_t gpio_num);
esp_err_t gpio_pulldown_dis(gpio_num_t gpio_num);
/**
* @brief Install the driver's GPIO ISR handler service, which allows per-pin GPIO interrupt handlers.
* @brief Install the GPIO driver's ETS_GPIO_INTR_SOURCE ISR handler service, which allows per-pin GPIO interrupt handlers.
*
* This function is incompatible with gpio_isr_register() - if that function is used, a single global ISR is registered for all GPIO interrupts. If this function is used, the ISR service provides a global GPIO ISR and individual pin handlers are registered via the gpio_isr_handler_add() function.
*