From 1c4d836c068e890c7a00360afed347ae526fc5d7 Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Thu, 19 May 2022 13:01:18 -0700 Subject: [PATCH] Clean up ESP32 I2S interface undefineds --- src/AudioOutputI2S.cpp | 7 ++++++- src/AudioOutputSPDIF.cpp | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/AudioOutputI2S.cpp b/src/AudioOutputI2S.cpp index 0bfab14f..c4e0c3aa 100644 --- a/src/AudioOutputI2S.cpp +++ b/src/AudioOutputI2S.cpp @@ -88,6 +88,7 @@ bool AudioOutputI2S::SetPinout() return false; // Not allowed i2s_pin_config_t pins = { + .mck_io_num = 0, // Unused .bck_io_num = bclkPin, .ws_io_num = wclkPin, .data_out_num = doutPin, @@ -225,7 +226,11 @@ bool AudioOutputI2S::begin(bool txDAC) .intr_alloc_flags = ESP_INTR_FLAG_LEVEL1, // lowest interrupt priority .dma_buf_count = dma_buf_count, .dma_buf_len = 128, - .use_apll = use_apll // Use audio PLL + .use_apll = use_apll, // Use audio PLL + .tx_desc_auto_clear = true, // Silence on underflow + .fixed_mclk = 0, // Unused + .mclk_multiple = I2S_MCLK_MULTIPLE_DEFAULT, // Unused + .bits_per_chan = I2S_BITS_PER_CHAN_DEFAULT // Use bits per sample }; audioLogger->printf("+%d %p\n", portNo, &i2s_config_dac); if (i2s_driver_install((i2s_port_t)portNo, &i2s_config_dac, 0, NULL) != ESP_OK) diff --git a/src/AudioOutputSPDIF.cpp b/src/AudioOutputSPDIF.cpp index 6e1cf197..1d1ec2f3 100644 --- a/src/AudioOutputSPDIF.cpp +++ b/src/AudioOutputSPDIF.cpp @@ -102,7 +102,11 @@ AudioOutputSPDIF::AudioOutputSPDIF(int dout_pin, int port, int dma_buf_count) .intr_alloc_flags = ESP_INTR_FLAG_LEVEL1, // lowest interrupt priority .dma_buf_count = dma_buf_count, .dma_buf_len = DMA_BUF_SIZE_DEFAULT, // bigger buffers, reduces interrupts - .use_apll = true // Audio PLL is needed for low clock jitter + .use_apll = true, // Audio PLL is needed for low clock jitter + .tx_desc_auto_clear = true, // Silence on underflow + .fixed_mclk = 0, // Unused + .mclk_multiple = I2S_MCLK_MULTIPLE_DEFAULT, // Unused + .bits_per_chan = I2S_BITS_PER_CHAN_DEFAULT // Use bits per sample }; if (i2s_driver_install((i2s_port_t)portNo, &i2s_config_spdif, 0, NULL) != ESP_OK) { audioLogger->println(F("ERROR: Unable to install I2S drivers")); @@ -147,6 +151,7 @@ bool AudioOutputSPDIF::SetPinout(int bclk, int wclk, int dout) { #if defined(ESP32) i2s_pin_config_t pins = { + .mck_io_num = 0, // unused .bck_io_num = bclk, .ws_io_num = wclk, .data_out_num = dout,