Skip to content

Commit

Permalink
[ESP32] Fix lock app factory reseting in a loop on ESP32C3 (project-c…
Browse files Browse the repository at this point in the history
  • Loading branch information
jadhavrohit924 authored Jan 19, 2024
1 parent 6bc686b commit ddc961d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions examples/lock-app/esp32/main/Button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit ddc961d

Please sign in to comment.