Merge pull request #6354 from dhalbert/espressif-dio-fixes

espressif: check properly for pull values
This commit is contained in:
Dan Halbert 2022-05-05 22:44:29 -04:00 committed by GitHub
commit 30904a8638
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -142,9 +142,9 @@ void common_hal_digitalio_digitalinout_set_pull(
digitalio_pull_t common_hal_digitalio_digitalinout_get_pull(
digitalio_digitalinout_obj_t *self) {
gpio_num_t gpio_num = self->pin->number;
if (REG_GET_BIT(GPIO_PIN_MUX_REG[gpio_num], FUN_PU) == 1) {
if (REG_GET_BIT(GPIO_PIN_MUX_REG[gpio_num], FUN_PU)) {
return PULL_UP;
} else if (REG_GET_BIT(GPIO_PIN_MUX_REG[gpio_num], FUN_PD) == 1) {
} else if (REG_GET_BIT(GPIO_PIN_MUX_REG[gpio_num], FUN_PD)) {
return PULL_DOWN;
}
return PULL_NONE;