From 251c0f5507ee49c5f257fa70e4c7b5f2f26ed1aa Mon Sep 17 00:00:00 2001 From: jepler Date: Wed, 11 Sep 2019 20:09:38 -0500 Subject: [PATCH] nRF: PWMOut: At deinit, make pin available again Closes: #2146 --- ports/nrf/common-hal/pulseio/PWMOut.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/nrf/common-hal/pulseio/PWMOut.c b/ports/nrf/common-hal/pulseio/PWMOut.c index 5233c9adc6..ef6ddc5b93 100644 --- a/ports/nrf/common-hal/pulseio/PWMOut.c +++ b/ports/nrf/common-hal/pulseio/PWMOut.c @@ -233,6 +233,9 @@ void common_hal_pulseio_pwmout_deinit(pulseio_pwmout_obj_t* self) { // Disconnect pin from channel. pwm->PSEL.OUT[self->channel] = 0xFFFFFFFF; + reset_pin_number(self->pin_number); + self->pin_number = NO_PIN; + for(int i=0; i < CHANNELS_PER_PWM; i++) { if (self->pwm->PSEL.OUT[i] != 0xFFFFFFFF) { // Some channel is still being used, so don't disable.