Set output low in SIO

This commit is contained in:
Scott Shawcroft 2021-07-28 09:00:36 -07:00
parent 4be904fd4a
commit 9e54606ba1
No known key found for this signature in database
GPG Key ID: 0DFD512649C052DA

View File

@ -85,6 +85,8 @@ void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t *self,
common_hal_pwmio_pwmout_raise_error(result);
// Disable gpio output before we set the duty cycle.
gpio_put(pin->number, false);
gpio_set_dir(pin->number, GPIO_OUT);
gpio_set_function(pin->number, GPIO_FUNC_SIO);
common_hal_pwmio_pwmout_set_duty_cycle(&self->carrier, duty_cycle);
@ -101,6 +103,7 @@ void common_hal_pulseio_pulseout_deinit(pulseio_pulseout_obj_t *self) {
if (common_hal_pulseio_pulseout_deinited(self)) {
return;
}
gpio_set_dir(self->pin, GPIO_IN);
common_hal_pwmio_pwmout_deinit(&self->carrier);
self->pin = NO_PIN;
}