Skip to content

Commit 1108e8f

Browse files
authored
Merge pull request #2400 from jepler/nrf-rawsample-loop
nRF: PWMAudioOut: handle non-looping rawsamples
2 parents be64422 + 8137ac4 commit 1108e8f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ports/nrf/common-hal/audiopwmio/PWMAudioOut.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,16 +255,18 @@ void common_hal_audiopwmio_pwmaudioout_play(audiopwmio_pwmaudioout_obj_t* self,
255255
self->pwm->LOOP = 1;
256256
audiosample_reset_buffer(self->sample, false, 0);
257257
activate_audiopwmout_obj(self);
258+
self->stopping = false;
259+
self->pwm->SHORTS = NRF_PWM_SHORT_LOOPSDONE_SEQSTART0_MASK;
258260
fill_buffers(self, 0);
259261
self->pwm->SEQ[1].PTR = self->pwm->SEQ[0].PTR;
260262
self->pwm->SEQ[1].CNT = self->pwm->SEQ[0].CNT;
261263
self->pwm->EVENTS_SEQSTARTED[0] = 0;
262264
self->pwm->EVENTS_SEQSTARTED[1] = 0;
265+
self->pwm->EVENTS_SEQEND[0] = 0;
266+
self->pwm->EVENTS_SEQEND[1] = 0;
263267
self->pwm->EVENTS_STOPPED = 0;
264-
self->pwm->SHORTS = NRF_PWM_SHORT_LOOPSDONE_SEQSTART0_MASK;
265268
self->pwm->TASKS_SEQSTART[0] = 1;
266269
self->playing = true;
267-
self->stopping = false;
268270
self->paused = false;
269271
}
270272

0 commit comments

Comments
 (0)