From 3eb6bf6c8e15367c62958a4365155a476cf8249f Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Wed, 20 Aug 2025 21:51:23 +0200 Subject: [PATCH] Add initial c5 support (#23804) --- .github/workflows/build_all_the_things.yml | 2 + boards/esp32c5.json | 44 ++++++++++++ boards/esp32c5ser.json | 44 ++++++++++++ include/esp32x_fixes.h | 2 +- .../src/internal/DotStarEsp32DmaSpiMethod.h | 16 ++--- .../NeoPixelBus/src/internal/NeoBusChannel.h | 2 +- .../src/internal/NeoEsp32RmtMethod.cpp | 2 +- .../src/internal/NeoEsp32RmtMethod.h | 4 +- .../src/internal/NeoEsp32RmtMethod_idf5.h | 12 ++-- .../src/internal/NeoEsp32SpiMethod_idf5.h | 2 +- .../src/internal/NeoEspBitBangMethod.cpp | 2 +- .../src/internal/NeoEspBitBangMethod.h | 2 +- lib/lib_display/UDisplay/uDisplay.h | 2 +- .../src/esp8266toEsp32.cpp | 2 +- pio-tools/add_c_flags.py | 2 +- platformio_override_sample.ini | 4 +- platformio_tasmota32.ini | 3 + platformio_tasmota_cenv_sample.ini | 9 +++ platformio_tasmota_env32.ini | 69 +++++++++++++++++- tasmota/include/tasmota.h | 4 +- tasmota/include/tasmota_globals.h | 8 +-- tasmota/include/tasmota_template.h | 72 +++++++++++++++++++ tasmota/include/tasmota_types.h | 20 +++--- tasmota/tasmota.ino | 5 +- tasmota/tasmota_support/settings.ino | 6 ++ tasmota/tasmota_support/support.ino | 4 +- tasmota/tasmota_support/support_command.ino | 2 +- .../support_crash_recorder.ino | 2 +- tasmota/tasmota_support/support_esp32.ino | 25 ++++++- .../xdrv_01_9_webserver.ino | 12 ++-- .../tasmota_xdrv_driver/xdrv_79_esp32_ble.ino | 2 +- .../xdrv_85_esp32_ble_eq3_trv.ino | 2 +- .../xdrv_91_esp32_twai.ino | 2 + .../xsns_52_esp32_ibeacon_ble.ino | 2 +- .../tasmota_xsns_sensor/xsns_62_esp32_mi.ino | 2 +- .../xsns_62_esp32_mi_ble.ino | 2 +- 36 files changed, 339 insertions(+), 58 deletions(-) create mode 100644 boards/esp32c5.json create mode 100644 boards/esp32c5ser.json diff --git a/.github/workflows/build_all_the_things.yml b/.github/workflows/build_all_the_things.yml index 9a8181e5b..559de46e6 100644 --- a/.github/workflows/build_all_the_things.yml +++ b/.github/workflows/build_all_the_things.yml @@ -102,6 +102,7 @@ jobs: - tasmota32solo1 - tasmota32c2 - tasmota32c3 + - tasmota32c5 - tasmota32c6 - tasmota32p4 - tasmota32s2 @@ -120,6 +121,7 @@ jobs: - tasmota32s3-safeboot - tasmota32c2-safeboot - tasmota32c3-safeboot + - tasmota32c5-safeboot - tasmota32c6-safeboot - tasmota32p4-safeboot steps: diff --git a/boards/esp32c5.json b/boards/esp32c5.json new file mode 100644 index 000000000..a509e16a0 --- /dev/null +++ b/boards/esp32c5.json @@ -0,0 +1,44 @@ +{ + "build": { + "core": "esp32", + "extra_flags": "-DARDUINO_TASMOTA -DARDUINO_USB_MODE=1 -DESP32_4M -DESP32C5 -DUSE_USB_CDC_CONSOLE", + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "mcu": "esp32c5", + "variant": "esp32c5", + "partitions": "partitions/esp32_partition_app2880k_fs320k.csv" + }, + "connectivity": [ + "wifi", + "bluetooth" + ], + "debug": { + "openocd_target": "esp32c5.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "Espressif Generic ESP32-C5 >= 4M Flash, Tasmota 2880k Code/OTA, 320k FS", + "upload": { + "arduino": { + "flash_extra_images": [ + [ + "0x10000", + "tasmota32c5-safeboot.bin" + ] + ] + }, + "flash_size": "4MB", + "maximum_ram_size": 327680, + "maximum_size": 4194304, + "require_upload_port": true, + "speed": 2000000 + }, + "download": { + "speed": 2000000 + }, + "url": "https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32c5/esp32-c5-devkitc-1/index.html", + "vendor": "Espressif" + } diff --git a/boards/esp32c5ser.json b/boards/esp32c5ser.json new file mode 100644 index 000000000..c7c31a5ef --- /dev/null +++ b/boards/esp32c5ser.json @@ -0,0 +1,44 @@ +{ + "build": { + "core": "esp32", + "extra_flags": "-DARDUINO_TASMOTA -DESP32_4M -DESP32C5", + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "mcu": "esp32c5", + "variant": "esp32c5", + "partitions": "partitions/esp32_partition_app2880k_fs320k.csv" + }, + "connectivity": [ + "wifi", + "bluetooth" + ], + "debug": { + "openocd_target": "esp32c5.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "Espressif Generic ESP32-C5 >= 4M Flash, Tasmota 2880k Code/OTA, 320k FS", + "upload": { + "arduino": { + "flash_extra_images": [ + [ + "0x10000", + "tasmota32c5ser-safeboot.bin" + ] + ] + }, + "flash_size": "4MB", + "maximum_ram_size": 327680, + "maximum_size": 4194304, + "require_upload_port": true, + "speed": 460800 + }, + "download": { + "speed": 230400 + }, + "url": "https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32c5/esp32-c5-devkitc-1/index.html", + "vendor": "Espressif" + } diff --git a/include/esp32x_fixes.h b/include/esp32x_fixes.h index 675a480ef..1ceb15b3e 100644 --- a/include/esp32x_fixes.h +++ b/include/esp32x_fixes.h @@ -61,7 +61,7 @@ // SPI_MOSI_DLEN_REG is not defined anymore in esp32s3 #define SPI_MOSI_DLEN_REG(x) SPI_MS_DLEN_REG(x) -#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4 +#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4 #define SPI_HOST SPI1_HOST #define HSPI_HOST SPI2_HOST #define VSPI_HOST SPI2_HOST /* No SPI3_host on C2/C6 */ diff --git a/lib/lib_basic/NeoPixelBus/src/internal/DotStarEsp32DmaSpiMethod.h b/lib/lib_basic/NeoPixelBus/src/internal/DotStarEsp32DmaSpiMethod.h index 953a216e7..9bfd598eb 100644 --- a/lib/lib_basic/NeoPixelBus/src/internal/DotStarEsp32DmaSpiMethod.h +++ b/lib/lib_basic/NeoPixelBus/src/internal/DotStarEsp32DmaSpiMethod.h @@ -29,12 +29,12 @@ License along with NeoPixel. If not, see #include "driver/spi_master.h" -#if (defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C2) || defined(CONFIG_IDF_TARGET_ESP32C6)) && !defined(HSPI_HOST) +#if (defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C2) || defined(CONFIG_IDF_TARGET_ESP32C5) || defined(CONFIG_IDF_TARGET_ESP32C6)) && !defined(HSPI_HOST) // HSPI_HOST depreciated in C3 #define HSPI_HOST SPI2_HOST #endif -#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) class Esp32VspiBus { public: @@ -52,7 +52,7 @@ public: const static int ParallelBits = 1; }; -#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) class Esp32Vspi2BitBus { public: @@ -70,7 +70,7 @@ public: const static int ParallelBits = 2; }; -#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) class Esp32Vspi4BitBus { public: @@ -174,7 +174,7 @@ public: // If pins aren't specified, initialize bus with just the default SCK and MOSI pins for the SPI peripheral (no SS, no >1-bit pins) void Initialize() { -#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) if (T_SPIBUS::SpiHostDevice == VSPI_HOST) { Initialize(SCK, -1, MOSI, -1, -1, -1); @@ -277,7 +277,7 @@ private: int8_t _ssPin; }; -#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) // Clock Speed and Default Definitions for DotStarEsp32DmaVspi typedef DotStarEsp32DmaSpiMethod DotStarEsp32DmaVspi40MhzMethod; typedef DotStarEsp32DmaSpiMethod DotStarEsp32DmaVspi20MhzMethod; @@ -303,7 +303,7 @@ typedef DotStarEsp32DmaSpiMethod DotStarEsp32DmaHspiHz typedef DotStarEsp32DmaHspi10MhzMethod DotStarEsp32DmaHspiMethod; -#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) // Clock Speed and Default Definitions for DotStarEsp32DmaVspi2Bit typedef DotStarEsp32DmaSpiMethod DotStarEsp32DmaVspi2Bit40MhzMethod; typedef DotStarEsp32DmaSpiMethod DotStarEsp32DmaVspi2Bit20MhzMethod; @@ -329,7 +329,7 @@ typedef DotStarEsp32DmaSpiMethod DotStarEsp32DmaHsp typedef DotStarEsp32DmaHspi2Bit10MhzMethod DotStarEsp32DmaHspi2BitMethod; -#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) // Clock Speed and Default Definitions for DotStarEsp32DmaVspi4Bit typedef DotStarEsp32DmaSpiMethod DotStarEsp32DmaVspi4Bit40MhzMethod; typedef DotStarEsp32DmaSpiMethod DotStarEsp32DmaVspi4Bit20MhzMethod; diff --git a/lib/lib_basic/NeoPixelBus/src/internal/NeoBusChannel.h b/lib/lib_basic/NeoPixelBus/src/internal/NeoBusChannel.h index 5fdb131bf..ddfd0f852 100644 --- a/lib/lib_basic/NeoPixelBus/src/internal/NeoBusChannel.h +++ b/lib/lib_basic/NeoPixelBus/src/internal/NeoBusChannel.h @@ -12,7 +12,7 @@ enum NeoBusChannel NeoBusChannel_0, NeoBusChannel_1, -#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) NeoBusChannel_2, diff --git a/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod.cpp b/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod.cpp index c8525e09d..5bd32855d 100644 --- a/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod.cpp +++ b/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod.cpp @@ -32,7 +32,7 @@ License along with NeoPixel. If not, see #include "NeoBusChannel.h" #include "NeoEsp32RmtMethod.h" -#if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32C2) +#if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C5) // translate NeoPixelBuffer into RMT buffer diff --git a/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod.h b/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod.h index e804cc2a7..b820ace1b 100644 --- a/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod.h +++ b/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod.h @@ -29,7 +29,7 @@ License along with NeoPixel. If not, see #pragma once -#if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32C2) +#if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C5) /* General Reference documentation for the APIs used in this implementation LOW LEVEL: (what is actually used) @@ -454,7 +454,7 @@ public: const static rmt_channel_t RmtChannelNumber = RMT_CHANNEL_3; }; -#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) class NeoEsp32RmtChannel4 { diff --git a/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod_idf5.h b/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod_idf5.h index d26aece56..d84a79b80 100644 --- a/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod_idf5.h +++ b/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod_idf5.h @@ -399,7 +399,7 @@ public: rmt_channel_handle_t RmtChannelNumber = NULL; }; -#if !defined(CONFIG_IDF_TARGET_ESP32C6) // C6 only 2 RMT channels ?? +#if !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) // C5 & C6 only 2 RMT channels class NeoEsp32RmtChannel2 { public: @@ -417,7 +417,7 @@ protected: rmt_channel_handle_t RmtChannelNumber = NULL; }; #endif // !defined(CONFIG_IDF_TARGET_ESP32C6) -#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) class NeoEsp32RmtChannel4 { @@ -634,7 +634,7 @@ typedef NeoEsp32RmtMethodBase NeoEs typedef NeoEsp32RmtMethodBase NeoEsp32Rmt1800KbpsMethod; typedef NeoEsp32RmtMethodBase NeoEsp32Rmt1400KbpsMethod; -#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) typedef NeoEsp32RmtMethodBase NeoEsp32Rmt2Ws2811Method; typedef NeoEsp32RmtMethodBase NeoEsp32Rmt2Ws2812xMethod; @@ -741,7 +741,7 @@ typedef NeoEsp32RmtMethodBase NeoEsp32Rmt1800KbpsInvertedMethod; typedef NeoEsp32RmtMethodBase NeoEsp32Rmt1400KbpsInvertedMethod; -#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) typedef NeoEsp32RmtMethodBase NeoEsp32Rmt2Ws2811InvertedMethod; typedef NeoEsp32RmtMethodBase NeoEsp32Rmt2Ws2812xInvertedMethod; @@ -815,13 +815,13 @@ typedef NeoEsp32RmtMethodBase // ESP32C3 I2S is not supported yet -#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) #if !defined(ARDUINO_ARCH_ESP8266) #include "soc/gpio_periph.h" #endif diff --git a/lib/lib_basic/NeoPixelBus/src/internal/NeoEspBitBangMethod.h b/lib/lib_basic/NeoPixelBus/src/internal/NeoEspBitBangMethod.h index 44f865488..655f16ba8 100644 --- a/lib/lib_basic/NeoPixelBus/src/internal/NeoEspBitBangMethod.h +++ b/lib/lib_basic/NeoPixelBus/src/internal/NeoEspBitBangMethod.h @@ -29,7 +29,7 @@ License along with NeoPixel. If not, see #if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32) // ESP32C3 I2S is not supported yet -#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) #if defined(ARDUINO_ARCH_ESP8266) #include diff --git a/lib/lib_display/UDisplay/uDisplay.h b/lib/lib_display/UDisplay/uDisplay.h index dad98b49f..6e0a15557 100755 --- a/lib/lib_display/UDisplay/uDisplay.h +++ b/lib/lib_display/UDisplay/uDisplay.h @@ -112,7 +112,7 @@ enum uColorType { uCOLOR_BW, uCOLOR_COLOR }; #undef GPIO_SET_SLOW #undef GPIO_CLR_SLOW -#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4 #define GPIO_CLR(A) GPIO.out_w1tc.val = (1 << A) #define GPIO_SET(A) GPIO.out_w1ts.val = (1 << A) #else // plain ESP32 diff --git a/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.cpp b/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.cpp index 8149b4bfa..9cfd9b997 100644 --- a/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.cpp +++ b/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.cpp @@ -52,7 +52,7 @@ enum LoggingLevels {LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_D const uint8_t MAX_PWMS = 16; // ESP32: 16 ledc PWM channels in total - TODO for now #elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 const uint8_t MAX_PWMS = 8; // ESP32S2/S3: 8 ledc PWM channels in total -#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 +#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 const uint8_t MAX_PWMS = 6; // ESP32C2/C3/C6: 6 ledc PWM channels in total #else const uint8_t MAX_PWMS = 5; // Unknown - revert to 5 PWM max diff --git a/pio-tools/add_c_flags.py b/pio-tools/add_c_flags.py index 835add5c0..980cd8840 100644 --- a/pio-tools/add_c_flags.py +++ b/pio-tools/add_c_flags.py @@ -10,7 +10,7 @@ env.Append(CXXFLAGS=["-Wno-volatile"]) env.Append(CFLAGS=["-Wno-discarded-qualifiers", "-Wno-implicit-function-declaration", "-Wno-incompatible-pointer-types"]) # Remove build flags which are not valid for risc-v -if mcu in ("esp32c2", "esp32c3", "esp32c6", "esp32h2", "esp32p4"): +if mcu in ("esp32c2", "esp32c3", "esp32c5", "esp32c6", "esp32h2", "esp32p4"): try: build_flags.pop(build_flags.index("-mno-target-align")) except: diff --git a/platformio_override_sample.ini b/platformio_override_sample.ini index 22ea0d674..ee85adce1 100644 --- a/platformio_override_sample.ini +++ b/platformio_override_sample.ini @@ -77,7 +77,7 @@ lib_extra_dirs = ${library.lib_extra_dirs} [env:tasmota32_base] ; *** Uncomment next lines ";" to enable development Tasmota Arduino version ESP32 -;platform = https://github.com/Jason2866/platform-espressif32/releases/download/2024.07.22/platform-espressif32.zip +;platform = https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF55 ;platform_packages = framework-arduinoespressif32 @ ;build_unflags = ${esp32_defaults.build_unflags} @@ -129,3 +129,5 @@ lib_extra_dirs = lib/lib_rf ; *** Mostly not used functions. Recommended to disable lib/lib_div + + diff --git a/platformio_tasmota32.ini b/platformio_tasmota32.ini index a5582accb..65eda4225 100644 --- a/platformio_tasmota32.ini +++ b/platformio_tasmota32.ini @@ -57,6 +57,7 @@ monitor_filters = esp32_exception_decoder lib_ignore = ${esp32_defaults.lib_ignore} ESPmDNS LinkedList + LittleFS ESP Mail Client IRremoteESP8266 NeoPixelBus @@ -72,6 +73,8 @@ lib_ignore = ${esp32_defaults.lib_ignore} SD SD_MMC UdpListener + esp_wireguard_tasmota + IniFile Berry Berry mapping to C Berry Tasmota mapping diff --git a/platformio_tasmota_cenv_sample.ini b/platformio_tasmota_cenv_sample.ini index fbb50c93d..0e3ede730 100644 --- a/platformio_tasmota_cenv_sample.ini +++ b/platformio_tasmota_cenv_sample.ini @@ -216,6 +216,15 @@ build_flags = ${env:tasmota32_base.build_flags} lib_extra_dirs = lib/libesp32, lib/libesp32_div, lib/lib_basic, lib/lib_i2c, lib/lib_div, lib/lib_ssl lib_ignore = Micro-RTSP +[env:tasmota32c5-mi32] +extends = env:tasmota32_base +board = esp32c5 +build_flags = ${env:tasmota32_base.build_flags} + -DFIRMWARE_BLUETOOTH + -DUSE_MI_EXT_GUI + -DCONFIG_BT_NIMBLE_NVS_PERSIST=y + -DOTA_URL='""' + [env:tasmota32c6-mi32] extends = env:tasmota32_base board = esp32c6 diff --git a/platformio_tasmota_env32.ini b/platformio_tasmota_env32.ini index f5e871816..8dc683005 100644 --- a/platformio_tasmota_env32.ini +++ b/platformio_tasmota_env32.ini @@ -130,6 +130,64 @@ build_flags = ${env:tasmota32_base.build_flags} lib_extra_dirs = lib/lib_ssl, lib/libesp32 lib_ignore = ${safeboot_flags.lib_ignore} +[env:tasmota32c5-safeboot] +platform = https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF55 +extends = env:tasmota32_base +board = esp32c5 +board_build.app_partition_name = safeboot +build_flags = ${env:tasmota32_base.build_flags} + -DFIRMWARE_SAFEBOOT + -DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32c5-safeboot.bin"' +lib_extra_dirs = lib/lib_ssl, lib/libesp32 +lib_ignore = ${safeboot_flags.lib_ignore} +custom_sdkconfig = + '# CONFIG_BT_ENABLED is not set' + '# CONFIG_BT_NIMBLE_ENABLED is not set' + '# CONFIG_BT_CONTROLLER_ENABLED is not set' + CONFIG_BT_CONTROLLER_DISABLED=y + '# CONFIG_LWIP_IP_FORWARD is not set' + '# CONFIG_LWIP_IPV4_NAPT is not set' + '# CONFIG_LWIP_IPV4_NAPT_PORTMAP is not set' + '# CONFIG_ETH_ENABLED is not set' + '# CONFIG_ETH_USE_SPI_ETHERNET is not set' + '# CONFIG_ETH_TRANSMIT_MUTEX is not set' + '# CONFIG_ETH_SPI_ETHERNET_DM9051 is not set' + '# CONFIG_ETH_SPI_ETHERNET_W5500 is not set' + '# CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL is not set' + '# CONFIG_LWIP_PPP_SUPPORT is not set' +custom_component_remove = espressif/esp_hosted + espressif/esp_wifi_remote + espressif/esp_modem + +[env:tasmota32c5ser-safeboot] +platform = https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF55 +extends = env:tasmota32_base +board = esp32c5ser +board_build.app_partition_name = safeboot +build_flags = ${env:tasmota32_base.build_flags} + -DFIRMWARE_SAFEBOOT + -DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32c5ser-safeboot.bin"' +lib_extra_dirs = lib/lib_ssl, lib/libesp32 +lib_ignore = ${safeboot_flags.lib_ignore} +custom_sdkconfig = + '# CONFIG_BT_ENABLED is not set' + '# CONFIG_BT_NIMBLE_ENABLED is not set' + '# CONFIG_BT_CONTROLLER_ENABLED is not set' + CONFIG_BT_CONTROLLER_DISABLED=y + '# CONFIG_LWIP_IP_FORWARD is not set' + '# CONFIG_LWIP_IPV4_NAPT is not set' + '# CONFIG_LWIP_IPV4_NAPT_PORTMAP is not set' + '# CONFIG_ETH_ENABLED is not set' + '# CONFIG_ETH_USE_SPI_ETHERNET is not set' + '# CONFIG_ETH_TRANSMIT_MUTEX is not set' + '# CONFIG_ETH_SPI_ETHERNET_DM9051 is not set' + '# CONFIG_ETH_SPI_ETHERNET_W5500 is not set' + '# CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL is not set' + '# CONFIG_LWIP_PPP_SUPPORT is not set' +custom_component_remove = espressif/esp_hosted + espressif/esp_wifi_remote + espressif/esp_modem + [env:tasmota32c6-safeboot] extends = env:tasmota32_base board = esp32c6 @@ -244,7 +302,15 @@ build_flags = ${env:tasmota32_base.build_flags} -DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32c3.bin"' lib_ignore = ${env:tasmota32_base.lib_ignore} Micro-RTSP - +[env:tasmota32c5] +platform = https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF55 +extends = env:tasmota32_base +board = esp32c5 +build_flags = ${env:tasmota32_base.build_flags} + -DFIRMWARE_TASMOTA32 + -DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32c5.bin"' +lib_ignore = ${env:tasmota32_base.lib_ignore} + Micro-RTSP [env:tasmota32c6] extends = env:tasmota32_base board = esp32c6 @@ -456,3 +522,4 @@ build_flags = ${env:tasmota32_base.build_flags} -DMY_LANGUAGE=uk_UA [env:tasmota32-VN] extends = env:tasmota32_base build_flags = ${env:tasmota32_base.build_flags} -DMY_LANGUAGE=vi_VN -DFIRMWARE_TASMOTA32 -DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32-VN.bin"' + diff --git a/tasmota/include/tasmota.h b/tasmota/include/tasmota.h index 86ce99b83..c1771dc83 100644 --- a/tasmota/include/tasmota.h +++ b/tasmota/include/tasmota.h @@ -63,7 +63,7 @@ const uint8_t MAX_PWMS_LEGACY = 5; // Max number of PWM channels in fir const uint8_t MAX_PWMS = 16; // ESP32: 16 ledc PWM channels in total - TODO for now #elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 const uint8_t MAX_PWMS = 8; // ESP32S2/S3: 8 ledc PWM channels in total - #elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 + #elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 const uint8_t MAX_PWMS = 6; // ESP32C2/C3/C6: 6 ledc PWM channels in total #else const uint8_t MAX_PWMS = 5; // Unknown - revert to 5 PWM max @@ -135,6 +135,8 @@ const uint8_t MAX_SWITCHES_TXT = 8; // Max number of switches user text #ifdef ESP32 #if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 const uint8_t MAX_ADCS = 5; // Max number of ESP32-C3 ADC pins (ADC2 pins are unusable with Wifi enabled) + #elif CONFIG_IDF_TARGET_ESP32C5 + const uint8_t MAX_ADCS = 6; // Max number of ESP32 ADC pins (ADC2 pins are unusable with Wifi enabled) #elif CONFIG_IDF_TARGET_ESP32C6 const uint8_t MAX_ADCS = 7; // Max number of ESP32 ADC pins (ADC2 pins are unusable with Wifi enabled) #else // ESP32 diff --git a/tasmota/include/tasmota_globals.h b/tasmota/include/tasmota_globals.h index 4d2603e66..1fa21c4e3 100644 --- a/tasmota/include/tasmota_globals.h +++ b/tasmota/include/tasmota_globals.h @@ -148,15 +148,15 @@ const char WIFI_HOSTNAME[] = WIFI_DEFAULT_HOSTNAME; // Override by user_confi \*-------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------*\ - * Start ESP32-C3/C6 specific parameters - disable features not present in ESP32-C3/C6 + * Start ESP32-C3/C5/C6 specific parameters - disable features not present in ESP32-C3/C5/C6 \*-------------------------------------------------------------------------------------------*/ -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 // ESP32-C3/C6 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 // ESP32-C3/C5/C6 //#ifdef USE_ETHERNET -//#undef USE_ETHERNET // ESP32-C3/C6 does not support ethernet +//#undef USE_ETHERNET // ESP32-C3/C5/C6 does not support ethernet //#endif -#endif // CONFIG_IDF_TARGET_ESP32C3/C6 +#endif // CONFIG_IDF_TARGET_ESP32C3/C5/C6 /*-------------------------------------------------------------------------------------------*\ * End ESP32-C3 specific parameters diff --git a/tasmota/include/tasmota_template.h b/tasmota/include/tasmota_template.h index 68c8178b6..a1f1084b7 100644 --- a/tasmota/include/tasmota_template.h +++ b/tasmota/include/tasmota_template.h @@ -1422,6 +1422,18 @@ const char PINS_WEMOS[] PROGMEM = "AOAOAOAOAOIOIOIOIOIOIOFLFLFLFLFLFLFLIORXTX"; // 0 1 2 3 4 5 6 7 8 9101112131415161718192021 const char PINS_WEMOS[] PROGMEM = "AOAOAOAOAOAOIOIOIOIOIOFLFLFLFLFLFLFLIOIORXTX"; +#elif CONFIG_IDF_TARGET_ESP32C5 // ESP32-C5 +/* **************************************** + * ESP32C5 + * ****************************************/ +#define MAX_GPIO_PIN 27 // Number of supported GPIO +#define MIN_FLASH_PINS 0 // Number of flash chip pins unusable for configuration (GPIO24 to 26) +#define MAX_USER_PINS 27 // MAX_GPIO_PIN - MIN_FLASH_PINS +#define WEMOS_MODULE 0 // Wemos module + +// 0 1 2 3 4 5 6 7 8 91011121314151617181920212223242526 +const char PINS_WEMOS[] PROGMEM = "IOAOAOAOAOAOAOIOIOIOIOIOIOIOIOIOIOIOFLFLFLIOFLFLFLIOIO"; + #elif CONFIG_IDF_TARGET_ESP32C6 /* **************************************** @@ -3078,6 +3090,66 @@ const mytmplt kModules[] PROGMEM = { Known templates \*********************************************************************************************/ +#elif CONFIG_IDF_TARGET_ESP32C5 +/********************************************************************************************\ + * ESP32-C5 Module templates +\********************************************************************************************/ + +#define USER_MODULE 255 + +// Supported hardware modules +enum SupportedModulesESP32C5 { + WEMOS, + MAXMODULE }; + +// Default module settings +const uint8_t kModuleNiceList[] PROGMEM = { + WEMOS, +}; + +// !!! Update this list in the same order as kModuleNiceList !!! +const char kModuleNames[] PROGMEM = + "ESP32C5|" + ; + +// !!! Update this list in the same order as SupportedModulesESP32C5 !!! +const mytmplt kModules[] PROGMEM = { + { // Generic ESP32C5 device + AGPIO(GPIO_USER), // 0 IO GPIO0 + AGPIO(GPIO_USER), // 1 AO GPIO1, ADC1_CH0 + AGPIO(GPIO_USER), // 2 AO GPIO2, ADC1_CH1 + AGPIO(GPIO_USER), // 3 AO GPIO3, ADC1_CH2 + AGPIO(GPIO_USER), // 4 AO GPIO4, ADC1_CH3 + AGPIO(GPIO_USER), // 5 AO GPIO5, ADC1_CH4 + AGPIO(GPIO_USER), // 6 AO GPIO6, ADC1_CH5 + AGPIO(GPIO_USER), // 7 AO GPIO7, ADC1_CH6 + AGPIO(GPIO_USER), // 8 IO GPIO8 + AGPIO(GPIO_USER), // 9 IO GPIO9 + AGPIO(GPIO_USER), // 10 IO GPIO10 + AGPIO(GPIO_USER), // 11 IO GPIO11 + AGPIO(GPIO_USER), // 12 IO GPIO12 + AGPIO(GPIO_USER), // 13 IO GPIO13 + AGPIO(GPIO_USER), // 14 IO GPIO14 + AGPIO(GPIO_USER), // 15 IO GPIO15 + AGPIO(GPIO_USER), // 16 IO GPIO16 + AGPIO(GPIO_USER), // 17 IO GPIO17 + AGPIO(GPIO_USER), // 18 IO GPIO18 + AGPIO(GPIO_USER), // 19 IO GPIO19 + AGPIO(GPIO_USER), // 20 IO GPIO20 + AGPIO(GPIO_USER), // 21 IO GPIO21 + AGPIO(GPIO_USER), // 22 IO GPIO22 + AGPIO(GPIO_USER), // 23 IO GPIO23 + 0, // 24 FL GPIO24, Flash + 0, // 25 FL GPIO25, Flash + 0, // 26 FL GPIO26, Flash + 0 // Flag + }, +}; + +/*********************************************************************************************\ + Known templates +\*********************************************************************************************/ + #elif CONFIG_IDF_TARGET_ESP32C6 /********************************************************************************************\ * ESP32-C6 Module templates diff --git a/tasmota/include/tasmota_types.h b/tasmota/include/tasmota_types.h index d14826b4a..2620cfc22 100644 --- a/tasmota/include/tasmota_types.h +++ b/tasmota/include/tasmota_types.h @@ -659,28 +659,32 @@ typedef struct { uint8_t free_esp32s2_494[2]; // 494 // 496 #else - // -------------------------------------------------------------- - // Mapping 0x3AC to 0x496 for ESP32, ESP32C2, ESP32C3 and ESP32C6 - // -------------------------------------------------------------- - myio my_gp; // 3AC 2x40 bytes (ESP32) / 2x21 bytes (ESP32-C2) / 2x22 bytes (ESP32-C3) / 2x31 bytes (ESP32-C6) + // ----------------------------------------------------------------------- + // Mapping 0x3AC to 0x496 for ESP32, ESP32C2, ESP32C3, ESP32C5 and ESP32C6 + // ----------------------------------------------------------------------- + myio my_gp; // 3AC 2x40 bytes (ESP32) / 2x21 bytes (ESP32-C2) / 2x22 bytes (ESP32-C3) / 2x27 bytes (ESP32-C5) / 2x31 bytes (ESP32-C6) #if CONFIG_IDF_TARGET_ESP32C2 uint8_t free_esp32c2_3D6[38]; // 3D6 - Due to smaller myio #elif CONFIG_IDF_TARGET_ESP32C3 uint8_t free_esp32c3_3D8[36]; // 3D8 - Due to smaller myio + #elif CONFIG_IDF_TARGET_ESP32C5 + uint8_t free_esp32c5_3E2[26]; // 3E2 - Due to smaller myio #elif CONFIG_IDF_TARGET_ESP32C6 uint8_t free_esp32c6_3EA[18]; // 3EA - Due to smaller myio - #endif // CONFIG_IDF_TARGET_ESP32C2/3/6 + #endif // CONFIG_IDF_TARGET_ESP32C2/3/5/6 - mytmplt user_template; // 3FC 2x37 bytes (ESP32) / 2x22 bytes (ESP32-C2) / 2x23 bytes (ESP32-C3) / 2x32 bytes (ESP32-C6) + mytmplt user_template; // 3FC 2x37 bytes (ESP32) / 2x22 bytes (ESP32-C2) / 2x23 bytes (ESP32-C3) / 2x28 bytes (ESP32-C5) / 2x32 bytes (ESP32-C6) #if CONFIG_IDF_TARGET_ESP32C2 uint8_t free_esp32c2_428[30]; // 428 - Due to smaller mytmplt #elif CONFIG_IDF_TARGET_ESP32C3 uint8_t free_esp32c3_42A[28]; // 42A - Due to smaller mytmplt - #elif CONFIG_IDF_TARGET_ESP32C6 + #elif CONFIG_IDF_TARGET_ESP32C5 + uint8_t free_esp32c5_434[18]; // 434 - Due to smaller mytmplt + #elif CONFIG_IDF_TARGET_ESP32C6 uint8_t free_esp32c6_43C[10]; // 43C - Due to smaller mytmplt - #endif // CONFIG_IDF_TARGET_ESP32C2/3/6 + #endif // CONFIG_IDF_TARGET_ESP32C2/3/5/6 uint8_t eth_type; // 446 uint8_t eth_clk_mode; // 447 diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index a8f92e795..c9f31b76c 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -208,11 +208,12 @@ WiFiUDP PortUdp; // UDP Syslog and Alexa #ifdef ESP32 /* #if CONFIG_IDF_TARGET_ESP32C3 || // support USB via HWCDC using JTAG interface + CONFIG_IDF_TARGET_ESP32C5 || // support USB via HWCDC using JTAG interface CONFIG_IDF_TARGET_ESP32C6 || // support USB via HWCDC using JTAG interface CONFIG_IDF_TARGET_ESP32S2 || // support USB via USBCDC CONFIG_IDF_TARGET_ESP32S3 // support USB via HWCDC using JTAG interface or USBCDC */ -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4 //#if CONFIG_TINYUSB_CDC_ENABLED // This define is not recognized here so use USE_USB_CDC_CONSOLE #ifdef USE_USB_CDC_CONSOLE @@ -493,7 +494,7 @@ void setup(void) { } #ifdef ESP32 -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4 #ifdef USE_USB_CDC_CONSOLE bool is_connected_to_USB = false; diff --git a/tasmota/tasmota_support/settings.ino b/tasmota/tasmota_support/settings.ino index 5a083fedd..b828d8d01 100644 --- a/tasmota/tasmota_support/settings.ino +++ b/tasmota/tasmota_support/settings.ino @@ -546,6 +546,8 @@ bool SettingsConfigRestore(void) { valid_settings = (5 == settings_buffer[0xF36]); // Settings->config_version ESP32C2 #elif CONFIG_IDF_TARGET_ESP32C6 valid_settings = (6 == settings_buffer[0xF36]); // Settings->config_version ESP32C6 +#elif CONFIG_IDF_TARGET_ESP32C5 + valid_settings = (7 == settings_buffer[0xF36]); // Settings->config_version ESP32C5 #elif CONFIG_IDF_TARGET_ESP32P4 valid_settings = (7 == settings_buffer[0xF36]); // Settings->config_version ESP32P4 #else @@ -988,6 +990,8 @@ void SettingsDefaultSet2(void) { Settings->config_version = 5; // ESP32C2 #elif CONFIG_IDF_TARGET_ESP32C6 Settings->config_version = 6; // ESP32C6 +#elif CONFIG_IDF_TARGET_ESP32C5 + Settings->config_version = 7; // ESP32C5 #elif CONFIG_IDF_TARGET_ESP32P4 Settings->config_version = 7; // ESP32P4 #else @@ -1602,6 +1606,8 @@ void SettingsDelta(void) { Settings->config_version = 5; // ESP32C2 #elif CONFIG_IDF_TARGET_ESP32C6 Settings->config_version = 6; // ESP32C6 +#elif CONFIG_IDF_TARGET_ESP32C5 + Settings->config_version = 7; // ESP32C5 #else Settings->config_version = 1; // ESP32 #endif // CONFIG_IDF_TARGET_ESP32S3 diff --git a/tasmota/tasmota_support/support.ino b/tasmota/tasmota_support/support.ino index 81fbf377e..1eb5f197f 100755 --- a/tasmota/tasmota_support/support.ino +++ b/tasmota/tasmota_support/support.ino @@ -1714,7 +1714,7 @@ void TemplateGpios(myio *gp) j++; #endif // ESP8266 #ifdef ESP32 -#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4 dest[i] = src[i]; #elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 if (22 == i) { j = 33; } // skip 22-32 @@ -2207,7 +2207,7 @@ void SetSerial(uint32_t baudrate, uint32_t serial_config) { void ClaimSerial(void) { #ifdef ESP32 -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 #ifdef USE_USB_CDC_CONSOLE if (!tasconsole_serial) { return; // USB console does not use serial diff --git a/tasmota/tasmota_support/support_command.ino b/tasmota/tasmota_support/support_command.ino index 14bec975e..ee9b34a0e 100644 --- a/tasmota/tasmota_support/support_command.ino +++ b/tasmota/tasmota_support/support_command.ino @@ -2143,7 +2143,7 @@ void CmndTemplate(void) if (8 == i) { j = 12; } #endif // ESP8266 #ifdef ESP32 -#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 +#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 // No change #elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 // if (22 == i) { j = 33; } // TODO 20230821 verify diff --git a/tasmota/tasmota_support/support_crash_recorder.ino b/tasmota/tasmota_support/support_crash_recorder.ino index 0723edff4..1cf138a55 100644 --- a/tasmota/tasmota_support/support_crash_recorder.ino +++ b/tasmota/tasmota_support/support_crash_recorder.ino @@ -261,7 +261,7 @@ void CrashDump(void) } ResponseJsonEnd(); } -#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4 +#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4 extern "C" { // esp-idf 3.x diff --git a/tasmota/tasmota_support/support_esp32.ino b/tasmota/tasmota_support/support_esp32.ino index 9adf361a5..800f9b84f 100644 --- a/tasmota/tasmota_support/support_esp32.ino +++ b/tasmota/tasmota_support/support_esp32.ino @@ -31,6 +31,8 @@ const static char kWifiPhyMode[] PROGMEM = "low rate|11b|11g|HT20|HT40|HE20"; // #define ESP32_ARCH "esp32c2" #elif CONFIG_IDF_TARGET_ESP32C3 #define ESP32_ARCH "esp32c3" +#elif CONFIG_IDF_TARGET_ESP32C5 + #define ESP32_ARCH "esp32c5" #elif CONFIG_IDF_TARGET_ESP32C6 #define ESP32_ARCH "esp32c6" #elif CONFIG_IDF_TARGET_ESP32H2 @@ -53,6 +55,8 @@ const static char kWifiPhyMode[] PROGMEM = "low rate|11b|11g|HT20|HT40|HE20"; // #include "esp32c2/rom/rtc.h" #elif CONFIG_IDF_TARGET_ESP32C3 // ESP32-C3 #include "esp32c3/rom/rtc.h" +#elif CONFIG_IDF_TARGET_ESP32C5 // ESP32-C5 + #include "esp32c5/rom/rtc.h" #elif CONFIG_IDF_TARGET_ESP32C6 // ESP32-C6 #include "esp32c6/rom/rtc.h" #elif CONFIG_IDF_TARGET_ESP32H2 // ESP32-H2 @@ -248,6 +252,9 @@ extern "C" { #elif CONFIG_IDF_TARGET_ESP32C3 // ESP32-C3 #include "esp32c3/rom/spi_flash.h" #define ESP_FLASH_IMAGE_BASE 0x0000 // Esp32c3 is located at 0x0000 +#elif CONFIG_IDF_TARGET_ESP32C5 // ESP32-C5 + #include "esp32c5/rom/spi_flash.h" + #define ESP_FLASH_IMAGE_BASE 0x2000 // Esp32c5 is located at 0x2000 #elif CONFIG_IDF_TARGET_ESP32C6 // ESP32-C6 #include "esp32c6/rom/spi_flash.h" #define ESP_FLASH_IMAGE_BASE 0x0000 // Esp32c6 is located at 0x0000 @@ -596,7 +603,7 @@ extern "C" { // `psramFound()` can return true even if no PSRAM is actually installed // This new version also checks `esp_spiram_is_initialized` to know if the PSRAM is initialized bool FoundPSRAM(void) { -#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || DISABLE_PSRAMCHECK || CORE32SOLO1 +#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || DISABLE_PSRAMCHECK || CORE32SOLO1 return psramFound(); #elif CONFIG_IDF_TARGET_ESP32P4 return ESP.getPsramSize() > 0; @@ -725,6 +732,7 @@ typedef enum { CHIP_ESP32S3 = 9, //!< ESP32-S3 CHIP_ESP32C3 = 5, //!< ESP32-C3 CHIP_ESP32C2 = 12, //!< ESP32-C2 + CHIP_ESP32C5 = 23, //!< ESP32-C5 CHIP_ESP32C6 = 13, //!< ESP32-C6 CHIP_ESP32H2 = 16, //!< ESP32-H2 CHIP_POSIX_LINUX = 999, //!< The code is running on POSIX/Linux simulator @@ -887,6 +895,21 @@ typedef struct { #endif // CONFIG_IDF_TARGET_ESP32C2 return F("ESP32-C2"); } + case 23: { // ESP32-C5 + /* + ESP32-C5 Series + - Ultra-low-power SoC with 32-bit RISC-V single-core microprocessor + - 2.4 and 5 GHz dual-band Wi-Fi 6 (802.11ax), Bluetooth® 5 (LE), Zigbee and Thread (802.15.4) + - 27 or 19 GPIOs, rich set of peripherals + */ +#ifdef CONFIG_IDF_TARGET_ESP32C5 + switch (pkg_version) { + case 0: return F("ESP32-C5"); + case 1: return F("ESP32-C5FH4"); + } +#endif // CONFIG_IDF_TARGET_ESP32C5 + return F("ESP32-C5"); + } case 7: // ESP32-C6(beta) case 13: { // ESP32-C6 /* diff --git a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino index f5b1c9d0c..eca102081 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino @@ -154,7 +154,7 @@ const char HTTP_SCRIPT_TEMPLATE2[] PROGMEM = "}"; #endif // ESP8266 #ifdef ESP32 -#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4 const char HTTP_SCRIPT_TEMPLATE2[] PROGMEM = "for(i=0;i<" STR(MAX_USER_PINS) ";i++){" "sk(g[i],i);" // Set GPIO @@ -2180,14 +2180,14 @@ void HandleTemplateConfiguration(void) { WSContentBegin(200, CT_PLAIN); WSContentSend_P(PSTR("%s}1"), AnyModuleName(module).c_str()); // NAME: Generic for (uint32_t i = 0; i < nitems(template_gp.io); i++) { // 17,148,29,149,7,255,255,255,138,255,139,255,255 -#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32C6 +#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32C6 // ESP32C2/C3/C6 we always send all GPIOs, Flash are just hidden WSContentSend_P(PSTR("%s%d"), (i>0)?",":"", template_gp.io[i]); #else if (!FlashPin(i)) { WSContentSend_P(PSTR("%s%d"), (i>0)?",":"", template_gp.io[i]); } -#endif // CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 +#endif // CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 } WSContentSend_P(PSTR("}1%d}1%d"), flag, Settings->user_template_base); // FLAG: 1 BASE: 17 WSContentEnd(); @@ -2228,7 +2228,7 @@ void HandleTemplateConfiguration(void) { "
")); WSContentSend_P(HTTP_TABLE100); // "" for (uint32_t i = 0; i < MAX_GPIO_PIN; i++) { -#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 +#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 // ESP32C2/C3/C6 all gpios are in the template, flash are hidden bool hidden = FlashPin(i); WSContentSend_P(PSTR(""), @@ -2241,7 +2241,7 @@ void HandleTemplateConfiguration(void) { RedPin(i) ? WebColor(COL_TEXT_WARNING) : WebColor(COL_TEXT), i, (0==i) ? PSTR(" style='width:146px'") : "", i, i); WSContentSend_P(PSTR(""), i); } -#endif // CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 +#endif // CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 } WSContentSend_P(PSTR("
" D_GPIO "%d
")); @@ -2310,7 +2310,7 @@ void TemplateSaveSettings(void) { j++; #endif // ESP8266 #ifdef ESP32 -#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4 snprintf_P(command, sizeof(command), PSTR("%s%s%d"), command, (i>0)?",":"", WebGetGpioArg(i)); #elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 if (22 == i) { j = 33; } // skip 22-32 diff --git a/tasmota/tasmota_xdrv_driver/xdrv_79_esp32_ble.ino b/tasmota/tasmota_xdrv_driver/xdrv_79_esp32_ble.ino index 99245db41..e99cb2e31 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_79_esp32_ble.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_79_esp32_ble.ino @@ -32,7 +32,7 @@ #endif #ifdef ESP32 // ESP32 family only. Use define USE_HM10 for ESP8266 support -#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S3 +#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S3 #ifdef USE_BLE_ESP32 /* diff --git a/tasmota/tasmota_xdrv_driver/xdrv_85_esp32_ble_eq3_trv.ino b/tasmota/tasmota_xdrv_driver/xdrv_85_esp32_ble_eq3_trv.ino index 982aa2480..105b29b36 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_85_esp32_ble_eq3_trv.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_85_esp32_ble_eq3_trv.ino @@ -128,7 +128,7 @@ print("".join(pin)) #define USE_EQ3_ESP32 #endif -#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S3 +#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S3 #ifdef USE_EQ3_ESP32 #ifdef ESP32 // ESP32 only. Use define USE_HM10 for ESP8266 support #ifdef USE_BLE_ESP32 diff --git a/tasmota/tasmota_xdrv_driver/xdrv_91_esp32_twai.ino b/tasmota/tasmota_xdrv_driver/xdrv_91_esp32_twai.ino index 57ad13870..e357c140b 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_91_esp32_twai.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_91_esp32_twai.ino @@ -7,6 +7,7 @@ */ #ifdef ESP32 +#if !CONFIG_IDF_TARGET_ESP32C5 // todo: remove when ESP32C5 TWAI support is added #ifdef USE_ESP32_TWAI #if SOC_TWAI_SUPPORTED /*********************************************************************************************\ @@ -442,4 +443,5 @@ bool Xdrv91(uint32_t function) { #endif // SOC_TWAI_SUPPORTED #endif // USE_ESP32_TWAI +#endif // !CONFIG_IDF_TARGET_ESP32C5 #endif // ESP32 \ No newline at end of file diff --git a/tasmota/tasmota_xsns_sensor/xsns_52_esp32_ibeacon_ble.ino b/tasmota/tasmota_xsns_sensor/xsns_52_esp32_ibeacon_ble.ino index 201aee852..55740889d 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_52_esp32_ibeacon_ble.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_52_esp32_ibeacon_ble.ino @@ -52,7 +52,7 @@ // for testing of BLE_ESP32, we remove xsns_52_ibeacon.ino completely, and instead add this modified xsns_52_ibeacon_BLE_ESP32.ino // in the future this may be more fine-grained, e.g. to allow hm17 for this, and BLE-ESP32 for other -#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S3 +#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 ||CONFIG_IDF_TARGET_ESP32S3 #ifdef USE_BLE_ESP32 #define XSNS_52 52 diff --git a/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi.ino b/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi.ino index b8a8d1f9d..b5981ac18 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi.ino @@ -1321,7 +1321,7 @@ bool MI32StartConnectionTask(){ } void MI32ConnectionTask(void *pvParameters){ -#if !defined(CONFIG_IDF_TARGET_ESP32C3) || !defined(CONFIG_IDF_TARGET_ESP32C6) //needs more testing ... +#if !defined(CONFIG_IDF_TARGET_ESP32C3) || !defined(CONFIG_IDF_TARGET_ESP32C5) || !defined(CONFIG_IDF_TARGET_ESP32C6) //needs more testing ... // NimBLEDevice::setOwnAddrType(BLE_OWN_ADDR_RANDOM,false); //seems to be important for i.e. xbox controller, hopefully not breaking other things #endif //CONFIG_IDF_TARGET_ESP32C3 MI32.conCtx->error = MI32_CONN_NO_ERROR; diff --git a/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino b/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino index 0ed22f3c1..32f842112 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino @@ -82,7 +82,7 @@ #ifdef USE_BLE_ESP32 #ifdef ESP32 // ESP32 family only. Use define USE_HM10 for ESP8266 support -#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S3 +#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S3 #ifdef USE_MI_ESP32