Skip to content

Commit

Permalink
Clear GPIO_PINn_INT_ENA on boot
Browse files Browse the repository at this point in the history
Soft reset does not clear thses fields, we have to do it ourselves, otherwise int can be triggered before handler is ready.

h/t @kzyapkov

Fixes #388

PUBLISHED_FROM=bf993c248f1ac992fc5b4df5d73819ca747657ce
  • Loading branch information
Deomid Ryabkov authored and cesantabot committed Dec 15, 2017
1 parent b7ac249 commit a9a5a14
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fw/platforms/esp32/src/esp32_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ void (*mgos_nsleep100)(uint32_t n);
uint32_t mgos_bitbang_n100_cal;

enum mgos_init_result mgos_gpio_hal_init() {
/* Soft reset does not clear GPIO_PINn_INT_ENA, we have to do it ourselves. */
for (int i = 0; i < MGOS_NUM_GPIO; i++) {
if (GPIO_IS_VALID_GPIO(i)) gpio_intr_disable(i);
}
esp_err_t r = gpio_isr_register(esp32_gpio_isr, NULL, 0, &s_int_handle);
if (r != ESP_OK) return MGOS_INIT_GPIO_INIT_FAILED;
r = esp_intr_enable(s_int_handle);
Expand Down

0 comments on commit a9a5a14

Please sign in to comment.