Skip to content

Commit 55d3252

Browse files
committed
Send bit width to start PIO program on reset_buffer.
1 parent 76ac311 commit 55d3252

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

ports/raspberrypi/audio_dma.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,7 @@ void __not_in_flash_func(isr_dma_1)(void) {
755755
audio_dma_t *dma = MP_STATE_PORT(recording_audio)[i];
756756
// Update last recorded buffer.
757757
dma->input_index = (uint8_t)(i != dma->input_channel[0]);
758+
// Reset destination buffer for the dma channel.
758759
dma_channel_set_write_addr(i, dma->input_buffer[dma->input_index], false /* trigger */);
759760
dma_channel_set_trans_count(i, dma->input_buffer_length[dma->input_index] / dma->output_size, false /* trigger */);
760761
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,10 @@ void audiobusio_i2sin_reset_buffer(audiobusio_i2sin_obj_t *self,
268268

269269
common_hal_rp2pio_statemachine_restart(&self->state_machine);
270270

271+
// Send bit width
272+
const uint8_t bit_width_data[1] = { self->bits_per_sample };
273+
common_hal_rp2pio_statemachine_write(&self->state_machine, bit_width_data, 1, 1, false);
274+
271275
audio_dma_result result = audio_dma_setup_record(
272276
&self->dma,
273277
self,

0 commit comments

Comments
 (0)