Skip to content

Commit bf850ab

Browse files
committed
ESP32 I2S Compile Error for Arduino ESP 3.2.1
1 parent c1a907b commit bf850ab

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/AudioTools/CoreAudio/AudioI2S/I2SESP32V1.h

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,10 @@ class I2SDriverESP32V1 {
162162
i2s_chan_handle_t &rx_chan, int txPin, int rxPin) {
163163
TRACED();
164164
LOGI("tx: %d, rx: %d", txPin, rxPin);
165-
i2s_std_config_t std_cfg = {
166-
.clk_cfg = getClockConfig(cfg),
167-
.slot_cfg = getSlotConfig(cfg),
168-
.gpio_cfg =
169-
{
165+
i2s_std_config_t std_cfg;
166+
std_cfg.clk_cfg = getClockConfig(cfg);
167+
std_cfg.slot_cfg = getSlotConfig(cfg);
168+
std_cfg.gpio_cfg = {
170169
.mclk = (gpio_num_t)cfg.pin_mck,
171170
.bclk = (gpio_num_t)cfg.pin_bck,
172171
.ws = (gpio_num_t)cfg.pin_ws,
@@ -178,8 +177,8 @@ class I2SDriverESP32V1 {
178177
.bclk_inv = false,
179178
.ws_inv = false,
180179
},
181-
},
182180
};
181+
183182

184183
if (cfg.rx_tx_mode == RXTX_MODE || cfg.rx_tx_mode == TX_MODE) {
185184
if (i2s_channel_init_std_mode(tx_chan, &std_cfg) != ESP_OK) {
@@ -264,8 +263,12 @@ class I2SDriverESP32V1 {
264263

265264
i2s_std_clk_config_t getClockConfig(I2SConfigESP32V1 &cfg) {
266265
TRACED();
267-
i2s_std_clk_config_t clk_cfg =
268-
I2S_STD_CLK_DEFAULT_CONFIG((uint32_t)cfg.sample_rate);
266+
i2s_std_clk_config_t clk_cfg;// = I2S_STD_CLK_DEFAULT_CONFIG((uint32_t)cfg.sample_rate);
267+
memset(&clk_cfg, 0, sizeof(i2s_std_clk_config_t));
268+
clk_cfg.sample_rate_hz = cfg.sample_rate;
269+
clk_cfg.clk_src = getClockSource(cfg);
270+
// clk_cfg.ext_clk_freq_hz = 0;
271+
269272
if (cfg.mclk_multiple > 0) {
270273
clk_cfg.mclk_multiple = (i2s_mclk_multiple_t)cfg.mclk_multiple;
271274
LOGI("mclk_multiple=%d", clk_cfg.mclk_multiple);
@@ -275,13 +278,11 @@ class I2SDriverESP32V1 {
275278
clk_cfg.mclk_multiple = I2S_MCLK_MULTIPLE_384;
276279
LOGI("mclk_multiple=384");
277280
} else {
281+
clk_cfg.mclk_multiple = I2S_MCLK_MULTIPLE_256;
278282
LOGI("mclk_multiple=%d", clk_cfg.mclk_multiple);
279283
}
280284
}
281285

282-
// determine clock source
283-
clk_cfg.clk_src = getClockSource(cfg);
284-
285286
return clk_cfg;
286287
}
287288

0 commit comments

Comments
 (0)