summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott@adafruit.com>2019-09-13 19:02:56 -0700
committerGitHub <noreply@github.com>2019-09-13 19:02:56 -0700
commitc8eee68fa03f9d453e35d2731086ac08101dd95b (patch)
tree63c404dca47f6e0e79af09fc6be669449ad1baf0
parent8d14266bc3b0893bf83c1b5c99c6439c1b11cb8e (diff)
parent251c0f5507ee49c5f257fa70e4c7b5f2f26ed1aa (diff)
Merge pull request #2153 from jepler/issue2146-4x
nRF: PWMOut: At deinit, make pin available again
-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.