From fae6e295460208c18bb2293c8d311ee8942e10d7 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 12 Oct 2019 14:00:04 +0900 Subject: nrf: PWMAudioOut: deactivate PWM when deinitting self .. otherwise, when an AudioPWMOut object was deinitted without being explicitly stop()ped, it would use up a slot in active_audio[]; the 5th iteration would create a non-working audio object which would just buzz instead of playing the right thing. Closes: #2203 --- ports/nrf/common-hal/audiopwmio/PWMAudioOut.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/nrf/common-hal/audiopwmio/PWMAudioOut.c b/ports/nrf/common-hal/audiopwmio/PWMAudioOut.c index 2a284b362..9496277b1 100644 --- a/ports/nrf/common-hal/audiopwmio/PWMAudioOut.c +++ b/ports/nrf/common-hal/audiopwmio/PWMAudioOut.c @@ -194,6 +194,8 @@ void common_hal_audiopwmio_pwmaudioout_deinit(audiopwmio_pwmaudioout_obj_t* self if (common_hal_audiopwmio_pwmaudioout_deinited(self)) { return; } + deactivate_audiopwmout_obj(self); + // TODO: ramp the pwm down from quiescent value to 0 self->pwm->ENABLE = 0; -- cgit v1.2.3