From 8fe09117153841ffcd57b0d89763534ec5737802 Mon Sep 17 00:00:00 2001 From: FedericoBusero <35894905+FedericoBusero@users.noreply.github.com> Date: Thu, 9 Oct 2025 05:18:33 +0200 Subject: [PATCH] ESP32 AudioOutputULP fixes (#579) * Fix ULP on ESP32 CONFIG_IDF_TARGET_ESP32 is not yet defined before #include "AudioOutputULP.h" * AudioOutputULP: Fix DAC2 stereo in case of DAC1+DAC2 * ULP - no ESP32S2 / S3 On ESP32S2 it compiles, but no audio is coming out On ESP32S3 DAC is not supported * Astyle --------- Co-authored-by: Earle F. Philhower, III --- src/AudioOutputULP.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/AudioOutputULP.cpp b/src/AudioOutputULP.cpp index 85d3fad..cf5a339 100644 --- a/src/AudioOutputULP.cpp +++ b/src/AudioOutputULP.cpp @@ -18,9 +18,12 @@ along with this program. If not, see . */ -#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 +#ifdef ESP32 #include "AudioOutputULP.h" + +#if CONFIG_IDF_TARGET_ESP32 + #include #include #include @@ -174,7 +177,7 @@ bool AudioOutputULP::begin() { for (int i = 0; i < 256; i++) { RTC_SLOW_MEM[dacTableStart1 + i * 2] = create_I_WR_REG(RTC_IO_PAD_DAC1_REG, 19, 26, i); //dac1: 0x1D4C0121 | (i << 10) RTC_SLOW_MEM[dacTableStart1 + 1 + i * 2] = create_I_BXI(retAddress1); // 0x80000000 + retAddress1 * 4 - RTC_SLOW_MEM[dacTableStart2 + i * 2] = create_I_WR_REG(RTC_IO_PAD_DAC1_REG, 19, 26, i); //dac2: 0x1D4C0122 | (i << 10) + RTC_SLOW_MEM[dacTableStart2 + i * 2] = create_I_WR_REG(RTC_IO_PAD_DAC2_REG, 19, 26, i); //dac2: 0x1D4C0122 | (i << 10) RTC_SLOW_MEM[dacTableStart2 + 1 + i * 2] = create_I_BXI(retAddress2); // 0x80000000 + retAddress2 * 4 } break; @@ -270,3 +273,4 @@ bool AudioOutputULP::stop() { } #endif +#endif