Skip to content

Commit 19e5a33

Browse files
authored
Avoid error message when calling reset on an input only pin.
The `gpio_reset_pin` function attempted to enable internal pullup on pins which does not have one. This change adds a guard to `gpio_reset_pin` for calling `gpio_pullup_en` - the same guard that makes `gpio_pullup_en` print the error.
1 parent 346870a commit 19e5a33

File tree

1 file changed

+4
-2
lines changed
  • components/esp_driver_gpio/src

1 file changed

+4
-2
lines changed

components/esp_driver_gpio/src/gpio.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,10 @@ esp_err_t gpio_reset_pin(gpio_num_t gpio_num)
457457
{
458458
GPIO_CHECK(GPIO_IS_VALID_GPIO(gpio_num), "GPIO number error", ESP_ERR_INVALID_ARG);
459459
gpio_intr_disable(gpio_num);
460-
// for powersave reasons, the GPIO should not be floating, select pullup
461-
gpio_pullup_en(gpio_num);
460+
if(GPIO_IS_VALID_OUTPUT_GPIO(gpio_num)) {
461+
// for powersave reasons, the GPIO should not be floating, select pullup
462+
gpio_pullup_en(gpio_num);
463+
}
462464
gpio_pulldown_dis(gpio_num);
463465
gpio_input_disable(gpio_num);
464466
gpio_output_disable(gpio_num);

0 commit comments

Comments
 (0)