must set pull after setting direction with gpio_set_pin routines

This commit is contained in:
Dan Halbert 2018-07-09 17:18:06 -04:00
parent fba2d9fa6c
commit 8bb363f7c4
1 changed files with 4 additions and 3 deletions

View File

@ -40,8 +40,9 @@ digitalinout_result_t common_hal_digitalio_digitalinout_construct(
claim_pin(pin);
self->pin = pin;
gpio_set_pin_pull_mode(pin->pin, GPIO_PULL_OFF);
// Must set pull after setting direction.
gpio_set_pin_direction(pin->pin, GPIO_DIRECTION_IN);
gpio_set_pin_pull_mode(pin->pin, GPIO_PULL_OFF);
return DIGITALINOUT_OK;
}
@ -154,9 +155,9 @@ void common_hal_digitalio_digitalinout_set_pull(
default:
break;
}
// Set pull first to avoid glitches.
gpio_set_pin_pull_mode(self->pin->pin, asf_pull);
// Must set pull after setting direction.
gpio_set_pin_direction(self->pin->pin, GPIO_DIRECTION_IN);
gpio_set_pin_pull_mode(self->pin->pin, asf_pull);
}
digitalio_pull_t common_hal_digitalio_digitalinout_get_pull(