Skip to content

Commit

Permalink
Merge branch 'light_c6_wifi_thread' into 'main'
Browse files Browse the repository at this point in the history
examples/light: Added secondary network interface for esp32c6 light

See merge request app-frameworks/esp-matter!919
  • Loading branch information
chshu committed Nov 7, 2024
2 parents ab4aa48 + 825bd4a commit 2f4ddec
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ variables:
- idf.py build
- cp sdkconfig.defaults.c6_backup sdkconfig.defaults.esp32c6

.build_esp32c6_wifi_thread_example: &build_esp32c6_wifi_thread_example
- cd $ESP_MATTER_PATH/examples/light
- cp sdkconfig.defaults.esp32c6 sdkconfig.defaults.c6_backup
- cp sdkconfig.defaults.c6_wifi_thread sdkconfig.defaults.esp32c6
- idf.py set-target esp32c6
- idf.py build
- cp sdkconfig.defaults.c6_backup sdkconfig.defaults.esp32c6

.build_controller_otbr_example: &build_controller_otbr_example
- cd $ESP_MATTER_PATH/examples/controller
- idf.py -D SDKCONFIG_DEFAULTS="sdkconfig.defaults.otbr" set-target esp32s3 build
Expand Down Expand Up @@ -303,6 +311,7 @@ build_ext_plat_c6_thread_controller_examples:
script:
- *build_external_platform_example
- *build_esp32c6_thread_example
- *build_esp32c6_wifi_thread_example
- *build_controller_otbr_example

build_esp_matter_examples:
Expand Down
8 changes: 8 additions & 0 deletions examples/light/main/app_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,14 @@ extern "C" void app_main()
attribute_t *color_temp_attribute = attribute::get(color_control_cluster, ColorControl::Attributes::ColorTemperatureMireds::Id);
attribute::set_deferred_persistence(color_temp_attribute);

#if CHIP_DEVICE_CONFIG_ENABLE_THREAD && CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION
// Enable secondary network interface
secondary_network_interface::config_t secondary_network_interface_config;
endpoint = endpoint::secondary_network_interface::create(node, &secondary_network_interface_config, ENDPOINT_FLAG_NONE, nullptr);
ABORT_APP_ON_FAILURE(endpoint != nullptr, ESP_LOGE(TAG, "Failed to create secondary network interface endpoint"));
#endif


#if CHIP_DEVICE_CONFIG_ENABLE_THREAD
/* Set OpenThread platform config */
esp_openthread_platform_config_t config = {
Expand Down
78 changes: 78 additions & 0 deletions examples/light/sdkconfig.defaults.c6_wifi_thread
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
CONFIG_IDF_TARGET="esp32c6"

# libsodium
CONFIG_LIBSODIUM_USE_MBEDTLS_SHA=y

# NIMBLE
CONFIG_BT_ENABLED=y
CONFIG_BT_NIMBLE_ENABLED=y
CONFIG_BT_NIMBLE_EXT_ADV=n
CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE=70
CONFIG_USE_BLE_ONLY_FOR_COMMISSIONING=n

# FreeRTOS should use legacy API
CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY=y

# Enable OpenThread
CONFIG_OPENTHREAD_ENABLED=y
CONFIG_OPENTHREAD_SRP_CLIENT=y
CONFIG_OPENTHREAD_DNS_CLIENT=y
CONFIG_OPENTHREAD_LOG_LEVEL_DYNAMIC=n
CONFIG_OPENTHREAD_LOG_LEVEL_NOTE=y
CONFIG_OPENTHREAD_CLI=n

# Disable lwip ipv6 autoconfig
CONFIG_LWIP_IPV6_AUTOCONFIG=n

# Use a custom partition table
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"

# LwIP config for OpenThread
CONFIG_LWIP_IPV6_NUM_ADDRESSES=8
CONFIG_LWIP_MULTICAST_PING=y

# MDNS platform
CONFIG_USE_MINIMAL_MDNS=n
CONFIG_ENABLE_EXTENDED_DISCOVERY=y

# Enable OTA Requestor
CONFIG_ENABLE_OTA_REQUESTOR=y

# Disable AP
CONFIG_ENABLE_WIFI_STATION=y
CONFIG_ENABLE_WIFI_AP=n

# Button
CONFIG_BUTTON_PERIOD_TIME_MS=20
CONFIG_BUTTON_LONG_PRESS_TIME_MS=5000

# Enable chip shell
CONFIG_ENABLE_CHIP_SHELL=y

# Disable persist subscriptions
CONFIG_ENABLE_PERSIST_SUBSCRIPTIONS=y

# ESP32-C6-DevKitM-1 Settings
# Buttons
CONFIG_BSP_BUTTONS_NUM=1
CONFIG_BSP_BUTTON_1_TYPE_GPIO=y
CONFIG_BSP_BUTTON_1_GPIO=9
CONFIG_BSP_BUTTON_1_LEVEL=0
# LEDs
CONFIG_BSP_LEDS_NUM=1
CONFIG_BSP_LED_TYPE_RGB=y
CONFIG_BSP_LED_RGB_GPIO=8
CONFIG_BSP_LED_RGB_BACKEND_RMT=y

# Firmware size optimization
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS=y
CONFIG_NEWLIB_NANO_FORMAT=y
CONFIG_ESP_ERR_TO_NAME_LOOKUP=n

# Set endpoint id for Thread and Wi-Fi, depending on the secondary network interface endpoint id.
CONFIG_THREAD_NETWORK_ENDPOINT_ID=2
CONFIG_WIFI_NETWORK_ENDPOINT_ID=0

0 comments on commit 2f4ddec

Please sign in to comment.