From c7a015dd02e176a5b46ecb15615f76ac8f42527b Mon Sep 17 00:00:00 2001 From: esp Date: Thu, 26 Sep 2024 15:51:08 +0530 Subject: [PATCH] Added support for esp32c5 with latest idf master --- config/esp32/components/chip/CMakeLists.txt | 2 +- examples/all-clusters-app/esp32/main/Kconfig.projbuild | 8 ++++++-- examples/all-clusters-app/esp32/main/LEDWidget.cpp | 10 +++++----- .../all-clusters-app/esp32/main/include/LEDWidget.h | 4 ++-- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/config/esp32/components/chip/CMakeLists.txt b/config/esp32/components/chip/CMakeLists.txt index 161a3ce6e2249c..f4e6bf429e598d 100644 --- a/config/esp32/components/chip/CMakeLists.txt +++ b/config/esp32/components/chip/CMakeLists.txt @@ -439,7 +439,7 @@ set(target_name "${idf_target}") if(CONFIG_BT_ENABLED) idf_component_get_property(bt_lib bt COMPONENT_LIB) - if((target_name STREQUAL "esp32h2") OR (target_name STREQUAL "esp32c2") OR (target_name STREQUAL "esp32c6")) + if((target_name STREQUAL "esp32h2") OR (target_name STREQUAL "esp32c2") OR (target_name STREQUAL "esp32c6") OR (target_name STREQUAL "esp32c5")) idf_component_get_property(bt_dir bt COMPONENT_DIR) list(APPEND chip_libraries $) list(APPEND chip_libraries "${bt_dir}/controller/lib_${target_name}/${target_name}-bt-lib/libble_app.a") diff --git a/examples/all-clusters-app/esp32/main/Kconfig.projbuild b/examples/all-clusters-app/esp32/main/Kconfig.projbuild index 2cec0c32093734..769ed25e3be9e4 100644 --- a/examples/all-clusters-app/esp32/main/Kconfig.projbuild +++ b/examples/all-clusters-app/esp32/main/Kconfig.projbuild @@ -26,6 +26,7 @@ menu "Demo" default DEVICE_TYPE_ESP32_C3_DEVKITM if IDF_TARGET_ESP32C3 default DEVICE_TYPE_ESP32_C2_DEVKITM if IDF_TARGET_ESP32C2 default DEVICE_TYPE_ESP32_C6_DEVKITC if IDF_TARGET_ESP32C6 + default DEVICE_TYPE_ESP32_C5_DEVKITC if IDF_TARGET_ESP32C5 help Specifies the type of ESP32 device. @@ -57,6 +58,9 @@ menu "Demo" config DEVICE_TYPE_ESP32_H2_DEVKITM bool "ESP32H2-DevKitM" depends on IDF_TARGET_ESP32H2 + config DEVICE_TYPE_ESP32_C5_DEVKITC + bool "ESP32c5-DevkitC" + depends on IDF_TARGET_ESP32C5 endchoice choice @@ -88,7 +92,7 @@ menu "Demo" int range 0 5 default 0 if DEVICE_TYPE_ESP32_DEVKITC || DEVICE_TYPE_ESP32_H2_DEVKITM - default 0 if DEVICE_TYPE_ESP32_C3_DEVKITM || DEVICE_TYPE_ESP32_C2_DEVKITM || DEVICE_TYPE_ESP32_C6_DEVKITC + default 0 if DEVICE_TYPE_ESP32_C3_DEVKITM || DEVICE_TYPE_ESP32_C2_DEVKITM || DEVICE_TYPE_ESP32_C6_DEVKITC || DEVICE_TYPE_ESP32_C5_DEVKITC default 3 if DEVICE_TYPE_M5STACK default 4 if DEVICE_TYPE_ESP32_WROVER_KIT @@ -118,7 +122,7 @@ menu "Demo" range 0 40 default 2 if DEVICE_TYPE_ESP32_DEVKITC #Use LED1 (blue LED) as status LED on DevKitC default 2 if DEVICE_TYPE_ESP32_ETHERNET_KIT - default 8 if DEVICE_TYPE_ESP32_C3_DEVKITM || DEVICE_TYPE_ESP32_C2_DEVKITM || DEVICE_TYPE_ESP32_C6_DEVKITC || DEVICE_TYPE_ESP32_H2_DEVKITM + default 8 if DEVICE_TYPE_ESP32_C3_DEVKITM || DEVICE_TYPE_ESP32_C2_DEVKITM || DEVICE_TYPE_ESP32_C6_DEVKITC || DEVICE_TYPE_ESP32_H2_DEVKITM || DEVICE_TYPE_ESP32_C5_DEVKITC default 26 if DEVICE_TYPE_ESP32_WROVER_KIT default 40 if DEVICE_TYPE_M5STACK help diff --git a/examples/all-clusters-app/esp32/main/LEDWidget.cpp b/examples/all-clusters-app/esp32/main/LEDWidget.cpp index 9927e490c0d3d4..e2e177344dc8fa 100644 --- a/examples/all-clusters-app/esp32/main/LEDWidget.cpp +++ b/examples/all-clusters-app/esp32/main/LEDWidget.cpp @@ -30,7 +30,7 @@ #include "esp_log.h" #include "esp_system.h" #include "esp_timer.h" -#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM || CONFIG_DEVICE_TYPE_ESP32_C6_DEVKITC +#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM || CONFIG_DEVICE_TYPE_ESP32_C6_DEVKITC || DEVICE_TYPE_ESP32_C5_DEVKITC #include "driver/rmt.h" #include "led_strip.h" #define RMT_TX_DEFAULT_GPIO GPIO_NUM_8 @@ -51,7 +51,7 @@ void LEDWidget::Init(gpio_num_t gpioNum) mState = false; mError = false; errorTimer = NULL; -#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM || CONFIG_DEVICE_TYPE_ESP32_C6_DEVKITC +#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM || CONFIG_DEVICE_TYPE_ESP32_C6_DEVKITC || DEVICE_TYPE_ESP32_C5_DEVKITC if (gpioNum == RMT_TX_DEFAULT_GPIO) { rmt_config_t config = RMT_DEFAULT_CONFIG_TX(RMT_TX_DEFAULT_GPIO, RMT_TX_DEFAULT_CHANNEL); @@ -98,7 +98,7 @@ void LEDWidget::Set(bool state) void LEDWidget::SetBrightness(uint8_t brightness) { -#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM || CONFIG_DEVICE_TYPE_ESP32_C6_DEVKITC +#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM || CONFIG_DEVICE_TYPE_ESP32_C6_DEVKITC || DEVICE_TYPE_ESP32_C5_DEVKITC if (strip) { uint8_t red, green, blue; @@ -186,7 +186,7 @@ void LEDWidget::DoSet(bool state) { bool stateChange = (mState != state); mState = state; -#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM || CONFIG_DEVICE_TYPE_ESP32_C6_DEVKITC +#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM || CONFIG_DEVICE_TYPE_ESP32_C6_DEVKITC || DEVICE_TYPE_ESP32_C5_DEVKITC if (strip) { uint8_t red, green, blue; @@ -229,7 +229,7 @@ void LEDWidget::SetVLED(int id1, int id2) } #endif -#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM || CONFIG_DEVICE_TYPE_ESP32_C6_DEVKITC +#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM || CONFIG_DEVICE_TYPE_ESP32_C6_DEVKITC || DEVICE_TYPE_ESP32_C5_DEVKITC void LEDWidget::SetColor(uint8_t Hue, uint8_t Saturation) { uint8_t red, green, blue; diff --git a/examples/all-clusters-app/esp32/main/include/LEDWidget.h b/examples/all-clusters-app/esp32/main/include/LEDWidget.h index 93e38d4001acc8..4e29d894e7b36a 100644 --- a/examples/all-clusters-app/esp32/main/include/LEDWidget.h +++ b/examples/all-clusters-app/esp32/main/include/LEDWidget.h @@ -45,7 +45,7 @@ class LEDWidget void BlinkOnError(); void Animate(); -#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM || CONFIG_DEVICE_TYPE_ESP32_C6_DEVKITC +#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM || CONFIG_DEVICE_TYPE_ESP32_C6_DEVKITC || DEVICE_TYPE_ESP32_C5_DEVKITC void SetColor(uint8_t Hue, uint8_t Saturation); void HSB2rgb(uint16_t Hue, uint8_t Saturation, uint8_t brightness, uint8_t & red, uint8_t & green, uint8_t & blue); @@ -59,7 +59,7 @@ class LEDWidget uint32_t mBlinkOnTimeMS; uint32_t mBlinkOffTimeMS; uint8_t mDefaultOnBrightness; -#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM || CONFIG_DEVICE_TYPE_ESP32_C6_DEVKITC +#if CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM || CONFIG_DEVICE_TYPE_ESP32_C6_DEVKITC || DEVICE_TYPE_ESP32_C5_DEVKITC uint16_t mHue; // mHue [0, 360] uint8_t mSaturation; // mSaturation [0, 100] #endif