From ddc961d9e2e645605d2a58c7e2bf90507a276f5c Mon Sep 17 00:00:00 2001 From: Rohit Jadhav <69809379+jadhavrohit924@users.noreply.github.com> Date: Fri, 19 Jan 2024 23:24:49 +0530 Subject: [PATCH] [ESP32] Fix lock app factory reseting in a loop on ESP32C3 (#31500) --- examples/lock-app/esp32/main/Button.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/lock-app/esp32/main/Button.cpp b/examples/lock-app/esp32/main/Button.cpp index b80e124523f893..2e3aafa4db2116 100644 --- a/examples/lock-app/esp32/main/Button.cpp +++ b/examples/lock-app/esp32/main/Button.cpp @@ -27,6 +27,14 @@ esp_err_t Button::Init(gpio_num_t gpioNum, uint16_t debouncePeriod) mState = false; mLastPolledState = false; + gpio_config_t io_conf = {}; + io_conf.intr_type = GPIO_INTR_NEGEDGE; + io_conf.pin_bit_mask = 1ULL << gpioNum; + io_conf.mode = GPIO_MODE_INPUT; + io_conf.pull_down_en = GPIO_PULLDOWN_ENABLE; + + gpio_config(&io_conf); + return gpio_set_direction(gpioNum, GPIO_MODE_INPUT); }