Merge pull request #2212 from jepler/nrf-audio-issue2203
nrf: PWMAudioOut: deactivate PWM when deinitting self
This commit is contained in:
commit
1a53ced167
@ -73,15 +73,17 @@ STATIC void activate_audiopwmout_obj(audiopwmio_pwmaudioout_obj_t *self) {
|
||||
}
|
||||
STATIC void deactivate_audiopwmout_obj(audiopwmio_pwmaudioout_obj_t *self) {
|
||||
for (size_t i=0; i < MP_ARRAY_SIZE(active_audio); i++) {
|
||||
if(active_audio[i] == self)
|
||||
if (active_audio[i] == self) {
|
||||
active_audio[i] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void audiopwmout_reset() {
|
||||
for(size_t i=0; i < MP_ARRAY_SIZE(active_audio); i++)
|
||||
for (size_t i=0; i < MP_ARRAY_SIZE(active_audio); i++) {
|
||||
active_audio[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
STATIC void fill_buffers(audiopwmio_pwmaudioout_obj_t *self, int buf) {
|
||||
self->pwm->EVENTS_SEQSTARTED[1-buf] = 0;
|
||||
@ -192,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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user