Skip to content

Commit 3c97fd8

Browse files
committed
Run background tasks while waiting for next buffer.
1 parent be48374 commit 3c97fd8

File tree

1 file changed

+3
-2
lines changed
  • ports/raspberrypi/common-hal/audiobusio

1 file changed

+3
-2
lines changed

ports/raspberrypi/common-hal/audiobusio/I2SIn.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,9 @@ audioio_get_buffer_result_t audiobusio_i2sin_get_buffer(audiobusio_i2sin_obj_t *
301301

302302
// TODO: single_channel_output
303303

304-
if (!audio_dma_has_buffer(&self->dma)) {
305-
return GET_BUFFER_ERROR;
304+
// Do other things while we wait for the buffer to fill.
305+
while (!audio_dma_has_buffer(&self->dma)) {
306+
RUN_BACKGROUND_TASKS;
306307
}
307308

308309
*buffer_length = self->buffer_size;

0 commit comments

Comments
 (0)