Fix ESP32 GPIO when using INPUT PULLUP mode (#4213)

This commit is contained in:
Jesse Hills 2022-12-20 23:09:33 +13:00 committed by GitHub
parent 8b06135b41
commit 0d50caa179
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -95,7 +95,7 @@ void ESP32InternalGPIOPin::pin_mode(gpio::Flags flags) {
// can't call gpio_config here because that logs in esp-idf which may cause issues
gpio_set_direction(pin_, flags_to_mode(flags));
gpio_pull_mode_t pull_mode = GPIO_FLOATING;
if (flags & (gpio::FLAG_PULLUP | gpio::FLAG_PULLDOWN)) {
if ((flags & gpio::FLAG_PULLUP) && (flags & gpio::FLAG_PULLDOWN)) {
pull_mode = GPIO_PULLUP_PULLDOWN;
} else if (flags & gpio::FLAG_PULLUP) {
pull_mode = GPIO_PULLUP_ONLY;