stm32,esp32: In machine_i2s, send null samples in underflow situations.
Eliminate noise data from being sent to the I2S peripheral when the transmitted sample stream is stopped. Signed-off-by: Mike Teachman <mike.teachman@gmail.com>
This commit is contained in:
committed by
Damien George
parent
6d9da27c21
commit
0be3b91f11
@@ -509,6 +509,9 @@ STATIC void feed_dma(machine_i2s_obj_t *self, ping_pong_t dma_ping_pong) {
|
||||
if (self->bits == 32) {
|
||||
reformat_32_bit_samples((int32_t *)dma_buffer_p, SIZEOF_HALF_DMA_BUFFER_IN_BYTES / (sizeof(uint32_t)));
|
||||
}
|
||||
} else {
|
||||
// underflow. clear buffer to transmit "silence" on the I2S bus
|
||||
memset(dma_buffer_p, 0, SIZEOF_HALF_DMA_BUFFER_IN_BYTES);
|
||||
}
|
||||
|
||||
// flush cache to RAM so DMA can read the sample data
|
||||
|
||||
Reference in New Issue
Block a user