Skip to content

Commit 9e54606

Browse files
committed
Set output low in SIO
1 parent 4be904f commit 9e54606

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ports/raspberrypi/common-hal/pulseio/PulseOut.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t *self,
8585
common_hal_pwmio_pwmout_raise_error(result);
8686

8787
// Disable gpio output before we set the duty cycle.
88+
gpio_put(pin->number, false);
89+
gpio_set_dir(pin->number, GPIO_OUT);
8890
gpio_set_function(pin->number, GPIO_FUNC_SIO);
8991
common_hal_pwmio_pwmout_set_duty_cycle(&self->carrier, duty_cycle);
9092

@@ -101,6 +103,7 @@ void common_hal_pulseio_pulseout_deinit(pulseio_pulseout_obj_t *self) {
101103
if (common_hal_pulseio_pulseout_deinited(self)) {
102104
return;
103105
}
106+
gpio_set_dir(self->pin, GPIO_IN);
104107
common_hal_pwmio_pwmout_deinit(&self->carrier);
105108
self->pin = NO_PIN;
106109
}

0 commit comments

Comments
 (0)