From 9e54606ba15b0323140ea24e4632582c5f31607d Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 28 Jul 2021 09:00:36 -0700 Subject: [PATCH] Set output low in SIO --- ports/raspberrypi/common-hal/pulseio/PulseOut.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/raspberrypi/common-hal/pulseio/PulseOut.c b/ports/raspberrypi/common-hal/pulseio/PulseOut.c index 576c5410f7..2b4ab7185c 100644 --- a/ports/raspberrypi/common-hal/pulseio/PulseOut.c +++ b/ports/raspberrypi/common-hal/pulseio/PulseOut.c @@ -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; }