Skip to content

Commit

Permalink
[ESP32]: Platform, doc, example change to support ESP32C2
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamdp committed Sep 30, 2022
1 parent 933daab commit cd34049
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
9 changes: 7 additions & 2 deletions config/esp32/components/chip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/ota-image.cmake)

set(CHIP_REQURIE_COMPONENTS freertos lwip bt mbedtls fatfs app_update console openthread nvs_flash)

if(NOT "${IDF_TARGET}" STREQUAL "esp32h2")
if((NOT "${IDF_TARGET}" STREQUAL "esp32h2") AND (NOT "${IDF_TARGET}" STREQUAL "esp32c2"))
list(APPEND CHIP_REQURIE_COMPONENTS mdns)
endif()

Expand Down Expand Up @@ -289,6 +289,11 @@ if(CONFIG_BT_ENABLED)
if(CONFIG_IDF_TARGET_ESP32H2_BETA_VERSION_2)
list(APPEND chip_libraries ${bt_dir}/controller/lib_esp32h2/esp32h2-bt-lib/beta2/libble_app.a)
endif()
elseif("${CONFIG_IDF_TARGET}" STREQUAL "esp32c2")
idf_component_get_property(bt_lib bt COMPONENT_LIB)
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_esp32c2/esp32c2-bt-lib/libble_app.a)
else()
idf_component_get_property(bt_lib bt COMPONENT_LIB)
list(APPEND chip_libraries $<TARGET_FILE:${bt_lib}> -lbtdm_app)
Expand All @@ -305,7 +310,7 @@ if(CONFIG_OPENTHREAD_ENABLED)
list(APPEND chip_libraries $<TARGET_FILE:${openthread_lib}>)
endif()

if(NOT CONFIG_USE_MINIMAL_MDNS AND NOT CONFIG_IDF_TARGET_ESP32H2)
if((NOT CONFIG_USE_MINIMAL_MDNS) AND (NOT CONFIG_IDF_TARGET_ESP32H2) AND (NOT CONFIG_IDF_TARGET_ESP32C2))
idf_component_get_property(mdns_lib mdns COMPONENT_LIB)
list(APPEND chip_libraries $<TARGET_FILE:${mdns_lib}>)
endif()
Expand Down
4 changes: 4 additions & 0 deletions examples/lighting-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
#include <common/Esp32AppServer.h>

#include "esp_log.h"
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
#include "spi_flash_mmap.h"
#else
#include "esp_spi_flash.h"
#endif
#include "esp_system.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
Expand Down
4 changes: 4 additions & 0 deletions src/platform/ESP32/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@
#include "esp_heap_caps_init.h"
#include "esp_log.h"
#include "esp_netif.h"
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
#include "spi_flash_mmap.h"
#else
#include "esp_spi_flash.h"
#endif
#include "esp_system.h"
#include "esp_wifi.h"

Expand Down
4 changes: 4 additions & 0 deletions src/platform/ESP32/PlatformManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@
#include "esp_heap_caps_init.h"
#include "esp_log.h"
#include "esp_netif.h"
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
#include "spi_flash_mmap.h"
#else
#include "esp_spi_flash.h"
#endif
#include "esp_system.h"
#include "esp_wifi.h"

Expand Down

0 comments on commit cd34049

Please sign in to comment.