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); }