bootloader: Add selectable level for factory reset pin

Closes https://github.com/espressif/esp-idf/pull/7089
This commit is contained in:
chegewara
2021-05-31 12:57:08 +02:00
committed by bot
parent acc1e543b0
commit fb7234a13d
4 changed files with 14 additions and 5 deletions

View File

@@ -39,7 +39,7 @@
static const char* TAG = "boot_comm";
esp_comm_gpio_hold_t bootloader_common_check_long_hold_gpio(uint32_t num_pin, uint32_t delay_sec)
esp_comm_gpio_hold_t bootloader_common_check_long_hold_gpio(uint32_t num_pin, uint32_t delay_sec, int level)
{
esp_rom_gpio_pad_select_gpio(num_pin);
if (GPIO_PIN_MUX_REG[num_pin]) {
@@ -47,11 +47,11 @@ esp_comm_gpio_hold_t bootloader_common_check_long_hold_gpio(uint32_t num_pin, ui
}
esp_rom_gpio_pad_pullup_only(num_pin);
uint32_t tm_start = esp_log_early_timestamp();
if (gpio_ll_get_level(&GPIO, num_pin) == 1) {
if (gpio_ll_get_level(&GPIO, num_pin) != level) {
return GPIO_NOT_HOLD;
}
do {
if (gpio_ll_get_level(&GPIO, num_pin) != 0) {
if (gpio_ll_get_level(&GPIO, num_pin) != level) {
return GPIO_SHORT_HOLD;
}
} while (delay_sec > ((esp_log_early_timestamp() - tm_start) / 1000L));