Skip to content

Commit

Permalink
Added support for esp32c5 with latest idf master
Browse files Browse the repository at this point in the history
  • Loading branch information
esp committed Sep 26, 2024
1 parent 90b0fd2 commit c7a015d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion config/esp32/components/chip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<TARGET_FILE:${bt_lib}>)
list(APPEND chip_libraries "${bt_dir}/controller/lib_${target_name}/${target_name}-bt-lib/libble_app.a")
Expand Down
8 changes: 6 additions & 2 deletions examples/all-clusters-app/esp32/main/Kconfig.projbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions examples/all-clusters-app/esp32/main/LEDWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions examples/all-clusters-app/esp32/main/include/LEDWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down

0 comments on commit c7a015d

Please sign in to comment.