From 14dada3b099ae6f498faca893f1eb016e87a0de2 Mon Sep 17 00:00:00 2001 From: Jean-Francois Penven <67962328+jepenven-silabs@users.noreply.github.com> Date: Wed, 25 Jan 2023 17:14:08 -0500 Subject: [PATCH] Add module support (#24650) --- .../lighting-app/silabs/efr32/src/AppTask.cpp | 2 +- .../platform/silabs/efr32/BaseApplication.cpp | 30 +++++++++---------- third_party/silabs/efr32_sdk.gni | 16 +++++++--- third_party/silabs/matter_support | 2 +- 4 files changed, 29 insertions(+), 21 deletions(-) diff --git a/examples/lighting-app/silabs/efr32/src/AppTask.cpp b/examples/lighting-app/silabs/efr32/src/AppTask.cpp index e061e40099cb38..b638a93bec8723 100644 --- a/examples/lighting-app/silabs/efr32/src/AppTask.cpp +++ b/examples/lighting-app/silabs/efr32/src/AppTask.cpp @@ -44,7 +44,7 @@ #include #ifdef ENABLE_WSTK_LEDS -#if SL_STATUS_LED +#if defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) #define LIGHT_LED &sl_led_led1 #else #define LIGHT_LED &sl_led_led0 diff --git a/examples/platform/silabs/efr32/BaseApplication.cpp b/examples/platform/silabs/efr32/BaseApplication.cpp index 6dc133e3330b3f..648f192087fd80 100644 --- a/examples/platform/silabs/efr32/BaseApplication.cpp +++ b/examples/platform/silabs/efr32/BaseApplication.cpp @@ -25,7 +25,7 @@ #include "AppEvent.h" #include "AppTask.h" -#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED +#if defined(ENABLE_WSTK_LEDS) && defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) #include "LEDWidget.h" #include "sl_simple_led_instances.h" #endif // ENABLE_WSTK_LEDS @@ -74,7 +74,7 @@ #define APP_EVENT_QUEUE_SIZE 10 #define EXAMPLE_VENDOR_ID 0xcafe -#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED +#if defined(ENABLE_WSTK_LEDS) && defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) #define SYSTEM_STATE_LED &sl_led_led0 #endif // ENABLE_WSTK_LEDS #ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT @@ -96,7 +96,7 @@ TimerHandle_t sLightTimer; TaskHandle_t sAppTaskHandle; QueueHandle_t sAppEventQueue; -#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED +#if defined(ENABLE_WSTK_LEDS) && defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) LEDWidget sStatusLED; #endif // ENABLE_WSTK_LEDS @@ -212,7 +212,7 @@ CHIP_ERROR BaseApplication::Init(Identify * identifyObj) SILABS_LOG("Current Software Version: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); -#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED +#if defined(ENABLE_WSTK_LEDS) && defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) LEDWidget::InitGpio(); sStatusLED.Init(SYSTEM_STATE_LED); #endif // ENABLE_WSTK_LEDS @@ -273,7 +273,7 @@ void BaseApplication::FunctionEventHandler(AppEvent * aEvent) mFunction = kFunction_FactoryReset; -#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED +#if defined(ENABLE_WSTK_LEDS) && defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) // Turn off all LEDs before starting blink to make sure blink is // co-ordinated. sStatusLED.Set(false); @@ -334,7 +334,7 @@ void BaseApplication::LightEventHandler() { if ((gIdentifyptr != nullptr) && (gIdentifyptr->mActive)) { -#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED +#if defined(ENABLE_WSTK_LEDS) && defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) sStatusLED.Blink(250, 250); #endif // ENABLE_WSTK_LEDS } @@ -342,19 +342,19 @@ void BaseApplication::LightEventHandler() { if (sIdentifyEffect == EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BLINK) { -#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED +#if defined(ENABLE_WSTK_LEDS) && defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) sStatusLED.Blink(50, 50); #endif // ENABLE_WSTK_LEDS } if (sIdentifyEffect == EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BREATHE) { -#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED +#if defined(ENABLE_WSTK_LEDS) && defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) sStatusLED.Blink(1000, 1000); #endif // ENABLE_WSTK_LEDS } if (sIdentifyEffect == EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_OKAY) { -#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED +#if defined(ENABLE_WSTK_LEDS) && defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) sStatusLED.Blink(300, 700); #endif // ENABLE_WSTK_LEDS } @@ -364,33 +364,33 @@ void BaseApplication::LightEventHandler() { if (sIsAttached) { -#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED +#if defined(ENABLE_WSTK_LEDS) && defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) sStatusLED.Set(true); #endif // ENABLE_WSTK_LEDS } else { -#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED +#if defined(ENABLE_WSTK_LEDS) && defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) sStatusLED.Blink(950, 50); #endif } } else if (sHaveBLEConnections) { -#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED +#if defined(ENABLE_WSTK_LEDS) && defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) sStatusLED.Blink(100, 100); #endif // ENABLE_WSTK_LEDS } else { -#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED +#if defined(ENABLE_WSTK_LEDS) && defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) sStatusLED.Blink(50, 950); #endif // ENABLE_WSTK_LEDS } #endif // CHIP_DEVICE_CONFIG_ENABLE_SED } -#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED +#if defined(ENABLE_WSTK_LEDS) && defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) sStatusLED.Animate(); #endif // ENABLE_WSTK_LEDS } @@ -504,7 +504,7 @@ void BaseApplication::StartStatusLEDTimer() void BaseApplication::StopStatusLEDTimer() { -#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED +#if defined(ENABLE_WSTK_LEDS) && defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) sStatusLED.Set(false); #endif // ENABLE_WSTK_LEDS diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index 76a2377835e66d..8c4167cd4f2c50 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -123,8 +123,6 @@ template("efr32_sdk") { "${efr32_sdk_root}/platform/radio/rail_lib/common", "${efr32_sdk_root}/platform/radio/rail_lib/chip/efr32", "${efr32_sdk_root}/platform/radio/rail_lib/chip/efr32/rf/common/cortex", - "${efr32_sdk_root}/platform/radio/rail_lib/hal", - "${efr32_sdk_root}/platform/radio/rail_lib/hal/efr32", "${efr32_sdk_root}/platform/radio/rail_lib/protocol/ieee802154", "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions", "${efr32_sdk_root}/platform/radio/rail_lib/plugin/rail_util_pti", @@ -177,6 +175,13 @@ template("efr32_sdk") { "${sdk_support_root}/matter/efr32/${silabs_family}/${silabs_board}/autogen", ] + if (silabs_family != "mgm24") { + _include_dirs += [ + "${efr32_sdk_root}/platform/radio/rail_lib/hal", + "${efr32_sdk_root}/platform/radio/rail_lib/hal/efr32", + ] + } + # Note that we're setting the mbedTLS and PSA configuration files through a # define. This means the build system by default does not pick up changes in # the content of these, only when changing the filename itself. @@ -476,7 +481,6 @@ template("efr32_sdk") { "${efr32_sdk_root}/platform/emlib/src/em_system.c", "${efr32_sdk_root}/platform/emlib/src/em_timer.c", "${efr32_sdk_root}/platform/peripheral/src/peripheral_sysrtc.c", - "${efr32_sdk_root}/platform/radio/rail_lib/hal/efr32/hal_efr.c", "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/pa_conversions_efr32.c", "${efr32_sdk_root}/platform/radio/rail_lib/plugin/rail_util_pti/sl_rail_util_pti.c", "${efr32_sdk_root}/platform/security/sl_component/sl_mbedtls_support/src/aes_aes.c", @@ -625,6 +629,11 @@ template("efr32_sdk") { "${sdk_support_root}/matter/efr32/${silabs_family}/${silabs_board}/autogen/sl_event_handler.c", ] + if (silabs_family != "mgm24") { + sources += + [ "${efr32_sdk_root}/platform/radio/rail_lib/hal/efr32/hal_efr.c" ] + } + if (use_wstk_buttons) { sources += [ "${efr32_sdk_root}/platform/driver/button/src/sl_button.c", @@ -815,7 +824,6 @@ template("efr32_sdk") { sources += [ "${efr32_sdk_root}/platform/Device/SiliconLabs/MGM24/Source/startup_mgm24.c", "${efr32_sdk_root}/platform/Device/SiliconLabs/MGM24/Source/system_mgm24.c", - "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/pa_curves_efr32.c", "${efr32_sdk_root}/platform/security/sl_component/se_manager/src/sl_se_manager.c", "${efr32_sdk_root}/platform/security/sl_component/se_manager/src/sl_se_manager_attestation.c", "${efr32_sdk_root}/platform/security/sl_component/se_manager/src/sl_se_manager_cipher.c", diff --git a/third_party/silabs/matter_support b/third_party/silabs/matter_support index cfc9d78c7565c8..881c8e46cd2745 160000 --- a/third_party/silabs/matter_support +++ b/third_party/silabs/matter_support @@ -1 +1 @@ -Subproject commit cfc9d78c7565c867948435c823b07aefc5835a81 +Subproject commit 881c8e46cd2745f800c77ca40aa1f0fa2c1accdf