compilation for ESP32-C3

this allows to compile for -C3  including audioreactive usermod.
** warning ** completely untested and premature. It compiles, that's all.
This commit is contained in:
Frank
2022-09-03 13:16:12 +02:00
parent 159c370bf0
commit a2808bee29
2 changed files with 46 additions and 20 deletions

View File

@@ -130,6 +130,8 @@ build_flags_all_features =
build_flags_esp8266 = ${common.build_flags} ${esp8266.build_flags}
build_flags_esp32 = ${common.build_flags} ${esp32.build_flags}
build_flags_esp32c3 = ${common.build_flags} ${esp32c3.build_flags}
build_flags_esp32s2 = ${common.build_flags} ${esp32s2.build_flags}
build_flags_esp32s3 = ${common.build_flags} ${esp32s3.build_flags}
ldscript_1m128k = eagle.flash.1m128.ld
@@ -243,6 +245,8 @@ build_flags = -g
-DARDUINO_ARCH_ESP32S2
-DCONFIG_IDF_TARGET_ESP32S2
-D CONFIG_ASYNC_TCP_USE_WDT=0
-D CONFIG_LITTLEFS_FOR_IDF_3_2
-D WLED_WATCHDOG_TIMEOUT=0
-D WLED_NO_I2S1_BUS
-DCO
@@ -262,7 +266,8 @@ build_flags = -g
-D CONFIG_LITTLEFS_FOR_IDF_3_2 -D CONFIG_LITTLEFS_SPIFFS_COMPAT=1 -D CONFIG_LITTLEFS_CACHE_SIZE=512
-D WLED_NO_I2S0_BUS
-D WLED_NO_I2S1_BUS
-D WLED_RELEASE_NAME=ESP32S3 -D WLED_DISABLE_BROWNOUT_DET -D WLED_WATCHDOG_TIMEOUT=0
-D WLED_DISABLE_BROWNOUT_DET
-D WLED_WATCHDOG_TIMEOUT=0
-D ARDUINO_USB_MODE=1 -D ARDUINO_USB_CDC_ON_BOOT=0 -D ARDUINO_USB_MSC_ON_BOOT=0
-DCO
@@ -278,6 +283,8 @@ build_flags = -g
-DARDUINO_ARCH_ESP32C3
-DCONFIG_IDF_TARGET_ESP32C3
-D CONFIG_ASYNC_TCP_USE_WDT=0
-D CONFIG_LITTLEFS_FOR_IDF_3_2
-D WLED_WATCHDOG_TIMEOUT=0
-D WLED_NO_I2S0_BUS
-D WLED_NO_I2S1_BUS
-DCO
@@ -391,24 +398,35 @@ board_build.partitions = ${esp32.default_partitions}
[env:esp32s2_saola]
board = esp32-s2-saola-1
platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.2.2/platform-tasmota-espressif32-2.0.2.zip
platform_packages =
;platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.2.2/platform-tasmota-espressif32-2.0.2.zip
;platform_packages =
platform = ${esp32.platform}
platform_packages = ${esp32.platform_packages}
framework = arduino
build_flags = ${common.build_flags_esp32s2}
-D WLED_RELEASE_NAME=ESP32C3 #-D WLED_DISABLE_BLYNK #-D WLED_DISABLE_BROWNOUT_DET
board_build.partitions = tools/WLED_ESP32_4MB_1MB_FS.csv
board_build.flash_mode = qio
upload_speed = 460800
build_unflags = ${common.build_unflags}
lib_deps = ${esp32s2.lib_deps}
[env:esp32c3]
[env:esp32c3dev]
board = esp32-c3-devkitm-1
platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.2.2/platform-tasmota-espressif32-2.0.2.zip
platform_packages =
;platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.2.2/platform-tasmota-espressif32-2.0.2.zip
platform = ${esp32.platform}
platform_packages = ${esp32.platform_packages}
framework = arduino
build_flags = ${common.build_flags_esp32c3}
-D WLED_RELEASE_NAME=ESP32C3 #-D WLED_DISABLE_BLYNK #-D WLED_DISABLE_BROWNOUT_DET
-D USERMOD_AUDIOREACTIVE -D I2S_USE_16BIT_SAMPLES
-D UM_AUDIOREACTIVE_USE_NEW_FFT
-D USERMOD_CUSTOMEFFECTS
board_build.partitions = tools/WLED_ESP32_4MB_1MB_FS.csv
upload_speed = 460800
build_unflags = ${common.build_unflags}
lib_deps = ${esp32c3.lib_deps}
https://github.com/kosme/arduinoFFT#develop @ 1.9.2
[env:esp8285_4CH_MagicHome]
board = esp8285

View File

@@ -913,16 +913,20 @@ class AudioReactive : public Usermod {
// Reset I2S peripheral for good measure
i2s_driver_uninstall(I2S_NUM_0);
periph_module_reset(PERIPH_I2S0_MODULE);
#if !defined(CONFIG_IDF_TARGET_ESP32C3)
periph_module_reset(PERIPH_I2S0_MODULE); // not possible on -C3
#endif
delay(100); // Give that poor microphone some time to setup.
switch (dmType) {
#if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3)
#if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3)
// stub cases for not-yet-supported I2S modes on other ESP32 chips
case 0: //ADC analog
case 3: //MCLK
case 4: //SPH0645
#endif
#if defined(CONFIG_IDF_TARGET_ESP32C3)
case 5: //PDM Microphone
#endif
#endif
case 1:
DEBUGSR_PRINT(F("AR: Generic I2S Microphone - ")); DEBUGSR_PRINTLN(F(I2S_MIC_CHANNEL_TEXT));
audioSource = new I2SSource(SAMPLE_RATE, BLOCK_SIZE);
@@ -935,7 +939,7 @@ class AudioReactive : public Usermod {
delay(100);
if (audioSource) audioSource->initialize(sdaPin, sclPin, i2swsPin, i2ssdPin, i2sckPin, mclkPin);
break;
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
// SPH0645 is currently only possible on "classic" ESP32
case 3:
DEBUGSR_PRINT(F("AR: SPH0645 Microphone - ")); DEBUGSR_PRINTLN(F(I2S_MIC_CHANNEL_TEXT));
@@ -943,8 +947,8 @@ class AudioReactive : public Usermod {
delay(100);
audioSource->initialize(i2swsPin, i2ssdPin, i2sckPin);
break;
#endif
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
#endif
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
// MCLK routing currently only works on "classic" ESP32
case 4:
DEBUGSR_PRINT(F("AR: Generic I2S Microphone with Master Clock - ")); DEBUGSR_PRINTLN(F(I2S_MIC_CHANNEL_TEXT));
@@ -952,14 +956,16 @@ class AudioReactive : public Usermod {
delay(100);
if (audioSource) audioSource->initialize(i2swsPin, i2ssdPin, i2sckPin, mclkPin);
break;
#endif
#endif
#if !defined(CONFIG_IDF_TARGET_ESP32C3)
case 5:
DEBUGSR_PRINT(F("AR: I2S PDM Microphone - ")); DEBUGSR_PRINTLN(F(I2S_MIC_CHANNEL_TEXT));
audioSource = new I2SSource(SAMPLE_RATE, BLOCK_SIZE);
delay(100);
if (audioSource) audioSource->initialize(i2swsPin, i2ssdPin);
break;
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
#endif
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
// ADC over I2S is only possible on "classic" ESP32
case 0:
default:
@@ -968,7 +974,7 @@ class AudioReactive : public Usermod {
delay(100);
if (audioSource) audioSource->initialize(audioPin);
break;
#endif
#endif
}
delay(250); // give microphone enough time to initialise
@@ -1496,16 +1502,18 @@ class AudioReactive : public Usermod {
void appendConfigData()
{
oappend(SET_F("dd=addDropdown('AudioReactive','digitalmic:type');"));
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
oappend(SET_F("addOption(dd,'Generic Analog',0);"));
#endif
#endif
oappend(SET_F("addOption(dd,'Generic I2S',1);"));
oappend(SET_F("addOption(dd,'ES7243',2);"));
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
oappend(SET_F("addOption(dd,'SPH0654',3);"));
oappend(SET_F("addOption(dd,'Generic I2S with Mclk',4);"));
#endif
#endif
#if !defined(CONFIG_IDF_TARGET_ESP32C3)
oappend(SET_F("addOption(dd,'Generic I2S PDM',5);"));
#endif
oappend(SET_F("dd=addDropdown('AudioReactive','cfg:AGC');"));
oappend(SET_F("addOption(dd,'Off',0);"));
oappend(SET_F("addOption(dd,'Normal',1);"));