Skip to content

Commit f24d58f

Browse files
committed
ESP32 I2S getClockSource
1 parent 028b64c commit f24d58f

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/AudioTools/CoreAudio/AudioI2S/I2SESP32V1.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -289,30 +289,27 @@ class I2SDriverESP32V1 {
289289
soc_periph_i2s_clk_src_t getClockSource(I2SConfigESP32V1 &cfg){
290290
soc_periph_i2s_clk_src_t result = I2S_CLK_SRC_DEFAULT;
291291
// use mclk pin as input in slave mode if supported
292-
bool is_pin_mck_input = false;
292+
bool is_pin_mck_output = true;
293293
if (cfg.pin_mck != -1) {
294294
if (!cfg.is_master) {
295295
#if SOC_I2S_HW_VERSION_2
296296
LOGI("pin_mclk is input");
297297
result = I2S_CLK_SRC_EXTERNAL;
298-
is_pin_mck_input = true;
298+
is_pin_mck_output = false;
299299
#else
300300
LOGE("pin_mclk as input not supported");
301301
#endif
302302
}
303303

304-
if (!is_pin_mck_input) {
304+
// select APLL clock if possible
305+
if (is_pin_mck_output && cfg.use_apll) {
305306
// select clock source
306307
#if SOC_I2S_SUPPORTS_APLL
307-
if (cfg.use_apll) {
308308
result = I2S_CLK_SRC_APLL;
309309
LOGI("clk_src is I2S_CLK_SRC_APLL");
310-
}
311310
#elif SOC_I2S_SUPPORTS_PLL_F160M
312-
if (cfg.use_apll) {
313311
result = I2S_CLK_SRC_PLL_160M;
314312
LOGI("clk_src is I2S_CLK_SRC_PLL_160M");
315-
}
316313
#endif
317314
}
318315
}

0 commit comments

Comments
 (0)