aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjepler <jepler@gmail.com>2019-09-11 20:09:38 -0500
committerjepler <jepler@gmail.com>2019-09-13 12:30:06 -0500
commit251c0f5507ee49c5f257fa70e4c7b5f2f26ed1aa (patch)
tree25d845b8964c7c963a12207c00c7b361eabdc924
parentdbab5380b22289d44429f8a8ad3daabe7ec1fa45 (diff)
nRF: PWMOut: At deinit, make pin available again
Closes: #2146
-rw-r--r--ports/nrf/common-hal/pulseio/PWMOut.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ports/nrf/common-hal/pulseio/PWMOut.c b/ports/nrf/common-hal/pulseio/PWMOut.c
index 5233c9adc..ef6ddc5b9 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.