From bf7fa23320baa95cb11aa9497499a87fedde75e5 Mon Sep 17 00:00:00 2001 From: kirankha Date: Wed, 2 Aug 2023 14:12:33 +0530 Subject: [PATCH 1/8] Build Error fix for Window app on CSA for 917 SOC --- examples/platform/silabs/MatterConfig.cpp | 4 +++- scripts/examples/gn_silabs_example.sh | 2 ++ src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/platform/silabs/MatterConfig.cpp b/examples/platform/silabs/MatterConfig.cpp index 36f78aa84839c2..357f50909acd41 100644 --- a/examples/platform/silabs/MatterConfig.cpp +++ b/examples/platform/silabs/MatterConfig.cpp @@ -52,6 +52,7 @@ using namespace ::chip::DeviceLayer; #include static chip::DeviceLayer::Internal::Efr32PsaOperationalKeystore gOperationalKeystore; #endif +#endif #include "SilabsDeviceDataProvider.h" #include "SilabsTestEventTriggerDelegate.h" @@ -172,7 +173,7 @@ CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName) // WiFi needs to be initialized after Memory Init for some reason #ifdef SL_WIFI - InitWiFi(); + ReturnErrorOnFailure(InitWiFi()); #endif ReturnErrorOnFailure(PlatformMgr().InitChipStack()); @@ -220,6 +221,7 @@ CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName) // instead of the default (insecure) one. gOperationalKeystore.Init(); initParams.operationalKeystore = &gOperationalKeystore; +#endif #endif // Initialize the remaining (not overridden) providers to the SDK example defaults diff --git a/scripts/examples/gn_silabs_example.sh b/scripts/examples/gn_silabs_example.sh index 90adc9f9b9ed25..e2482346f28254 100755 --- a/scripts/examples/gn_silabs_example.sh +++ b/scripts/examples/gn_silabs_example.sh @@ -273,6 +273,8 @@ else # 917 exception. TODO find a more generic way if [ "$SILABS_BOARD" == "BRD4325B" ]; then + # TODO: remove this flag once ota is supported + optArgs+="chip_enable_ota_requestor=false " echo "Compiling for 917 WiFi SOC" USE_WIFI=true optArgs+="chip_device_platform =\"SiWx917\" " diff --git a/src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp b/src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp index 0eba1701c5dec1..08ca04e00f1039 100644 --- a/src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp +++ b/src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp @@ -20,6 +20,10 @@ #include #include +#if SILABS_LOG_ENABLED +#include "silabs_utils.h" +#endif + // TODO add includes ? extern "C" void RSI_Board_LED_Set(int, bool); extern "C" void RSI_Board_LED_Toggle(int); From 1bb2044e4169bba90efebedc87bf3faf44e1d529 Mon Sep 17 00:00:00 2001 From: kirankha Date: Wed, 2 Aug 2023 15:11:32 +0530 Subject: [PATCH 2/8] Added Conditions for 917 SOC --- examples/platform/silabs/MatterConfig.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/platform/silabs/MatterConfig.cpp b/examples/platform/silabs/MatterConfig.cpp index 357f50909acd41..b050abb55e8604 100644 --- a/examples/platform/silabs/MatterConfig.cpp +++ b/examples/platform/silabs/MatterConfig.cpp @@ -52,7 +52,6 @@ using namespace ::chip::DeviceLayer; #include static chip::DeviceLayer::Internal::Efr32PsaOperationalKeystore gOperationalKeystore; #endif -#endif #include "SilabsDeviceDataProvider.h" #include "SilabsTestEventTriggerDelegate.h" @@ -221,7 +220,6 @@ CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName) // instead of the default (insecure) one. gOperationalKeystore.Init(); initParams.operationalKeystore = &gOperationalKeystore; -#endif #endif // Initialize the remaining (not overridden) providers to the SDK example defaults From 70137f2eb9a60435d042fad57cc4bee9e39662b1 Mon Sep 17 00:00:00 2001 From: srningap Date: Thu, 3 Aug 2023 14:59:40 +0530 Subject: [PATCH 3/8] Adds fix for 917SoC button and LED0 issue --- examples/lighting-app/silabs/src/AppTask.cpp | 2 +- examples/platform/silabs/BaseApplication.cpp | 18 ++++++++++-------- .../window-app/silabs/src/WindowManager.cpp | 8 ++++++++ 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/examples/lighting-app/silabs/src/AppTask.cpp b/examples/lighting-app/silabs/src/AppTask.cpp index c3797797644b5b..bb27d8c702bff5 100644 --- a/examples/lighting-app/silabs/src/AppTask.cpp +++ b/examples/lighting-app/silabs/src/AppTask.cpp @@ -40,7 +40,7 @@ #include -#if (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(BRD4325B)) +#if (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(SIWX_917)) #define LIGHT_LED 1 #else #define LIGHT_LED 0 diff --git a/examples/platform/silabs/BaseApplication.cpp b/examples/platform/silabs/BaseApplication.cpp index cd37c4615fa4bb..839597c0018a05 100644 --- a/examples/platform/silabs/BaseApplication.cpp +++ b/examples/platform/silabs/BaseApplication.cpp @@ -25,9 +25,11 @@ #include "AppEvent.h" #include "AppTask.h" -#if defined(ENABLE_WSTK_LEDS) && defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) +#if (defined(ENABLE_WSTK_LEDS) && (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(SIWX_917))) #include "LEDWidget.h" +#ifndef SIWX_917 #include "sl_simple_led_instances.h" +#endif #endif // ENABLE_WSTK_LEDS #ifdef DISPLAY_ENABLED @@ -74,7 +76,7 @@ #define APP_EVENT_QUEUE_SIZE 10 #define EXAMPLE_VENDOR_ID 0xcafe -#if defined(ENABLE_WSTK_LEDS) && defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) +#if (defined(ENABLE_WSTK_LEDS) && (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(SIWX_917))) #define SYSTEM_STATE_LED 0 #endif // ENABLE_WSTK_LEDS #define APP_FUNCTION_BUTTON 0 @@ -96,7 +98,7 @@ TimerHandle_t sLightTimer; TaskHandle_t sAppTaskHandle; QueueHandle_t sAppEventQueue; -#if defined(ENABLE_WSTK_LEDS) && defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) +#if (defined(ENABLE_WSTK_LEDS) && (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(SIWX_917))) LEDWidget sStatusLED; #endif // ENABLE_WSTK_LEDS @@ -215,7 +217,7 @@ CHIP_ERROR BaseApplication::Init() SILABS_LOG("Current Software Version String: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); SILABS_LOG("Current Software Version: %d", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION); -#if defined(ENABLE_WSTK_LEDS) && defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) +#if (defined(ENABLE_WSTK_LEDS) && (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(SIWX_917))) LEDWidget::InitGpio(); sStatusLED.Init(SYSTEM_STATE_LED); #endif // ENABLE_WSTK_LEDS @@ -267,7 +269,7 @@ void BaseApplication::FunctionEventHandler(AppEvent * aEvent) mFunction = kFunction_FactoryReset; -#if defined(ENABLE_WSTK_LEDS) && defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) +#if (defined(ENABLE_WSTK_LEDS) && (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(SIWX_917))) // Turn off all LEDs before starting blink to make sure blink is // co-ordinated. sStatusLED.Set(false); @@ -290,7 +292,7 @@ void BaseApplication::FunctionEventHandler(AppEvent * aEvent) bool BaseApplication::ActivateStatusLedPatterns() { bool isPatternSet = false; -#if defined(ENABLE_WSTK_LEDS) && defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) +#if (defined(ENABLE_WSTK_LEDS) && (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(SIWX_917))) #ifdef EMBER_AF_PLUGIN_IDENTIFY_SERVER if (gIdentify.mActive) { @@ -392,7 +394,7 @@ void BaseApplication::LightEventHandler() } #endif // CHIP_CONFIG_ENABLE_ICD_SERVER -#if defined(ENABLE_WSTK_LEDS) && defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) +#if (defined(ENABLE_WSTK_LEDS) && (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(SIWX_917))) // Update the status LED if factory reset has not been initiated. // // If system has "full connectivity", keep the LED On constantly. @@ -531,7 +533,7 @@ void BaseApplication::StartStatusLEDTimer() void BaseApplication::StopStatusLEDTimer() { -#if defined(ENABLE_WSTK_LEDS) && defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) +#if (defined(ENABLE_WSTK_LEDS) && (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(SIWX_917))) sStatusLED.Set(false); #endif // ENABLE_WSTK_LEDS diff --git a/examples/window-app/silabs/src/WindowManager.cpp b/examples/window-app/silabs/src/WindowManager.cpp index c6687ab2ba512e..b5545ea8a28335 100644 --- a/examples/window-app/silabs/src/WindowManager.cpp +++ b/examples/window-app/silabs/src/WindowManager.cpp @@ -742,6 +742,14 @@ void WindowManager::ButtonEventHandler(uint8_t button, uint8_t btnAction) } AppTask::GetAppTask().PostEvent(&event); + +// Since there is no release interrupt for button1 posting release event after press event +#ifdef SIWX_917 + if (button) { + event = CreateNewEvent(AppEvent::kEventType_DownReleased); + AppTask::GetAppTask().PostEvent(&event); + } +#endif } void WindowManager::GeneralEventHandler(AppEvent * aEvent) From 6c61638751017f97431c8de11b0d7b264ba067f6 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Thu, 3 Aug 2023 09:31:22 +0000 Subject: [PATCH 4/8] Restyled by clang-format --- examples/window-app/silabs/src/WindowManager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/window-app/silabs/src/WindowManager.cpp b/examples/window-app/silabs/src/WindowManager.cpp index b5545ea8a28335..f9a45b578fdce2 100644 --- a/examples/window-app/silabs/src/WindowManager.cpp +++ b/examples/window-app/silabs/src/WindowManager.cpp @@ -745,7 +745,8 @@ void WindowManager::ButtonEventHandler(uint8_t button, uint8_t btnAction) // Since there is no release interrupt for button1 posting release event after press event #ifdef SIWX_917 - if (button) { + if (button) + { event = CreateNewEvent(AppEvent::kEventType_DownReleased); AppTask::GetAppTask().PostEvent(&event); } From 18288bbd7308fba6b85ee623ab5215613e797ba7 Mon Sep 17 00:00:00 2001 From: kirankha Date: Tue, 8 Aug 2023 18:14:31 +0530 Subject: [PATCH 5/8] Removed not required ifndef condition for 917 SOC --- examples/platform/silabs/BaseApplication.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/examples/platform/silabs/BaseApplication.cpp b/examples/platform/silabs/BaseApplication.cpp index 839597c0018a05..2fd0325d6a6b12 100644 --- a/examples/platform/silabs/BaseApplication.cpp +++ b/examples/platform/silabs/BaseApplication.cpp @@ -27,9 +27,6 @@ #if (defined(ENABLE_WSTK_LEDS) && (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(SIWX_917))) #include "LEDWidget.h" -#ifndef SIWX_917 -#include "sl_simple_led_instances.h" -#endif #endif // ENABLE_WSTK_LEDS #ifdef DISPLAY_ENABLED From 8806df8997c51d412fe24017121e2128b246fae7 Mon Sep 17 00:00:00 2001 From: kirankha Date: Fri, 18 Aug 2023 11:57:04 +0530 Subject: [PATCH 6/8] Removed OTA Requestor changes from scripts file --- scripts/examples/gn_silabs_example.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/examples/gn_silabs_example.sh b/scripts/examples/gn_silabs_example.sh index e2482346f28254..90adc9f9b9ed25 100755 --- a/scripts/examples/gn_silabs_example.sh +++ b/scripts/examples/gn_silabs_example.sh @@ -273,8 +273,6 @@ else # 917 exception. TODO find a more generic way if [ "$SILABS_BOARD" == "BRD4325B" ]; then - # TODO: remove this flag once ota is supported - optArgs+="chip_enable_ota_requestor=false " echo "Compiling for 917 WiFi SOC" USE_WIFI=true optArgs+="chip_device_platform =\"SiWx917\" " From 809869df56fdc567e938ed97490152bf4a476ca1 Mon Sep 17 00:00:00 2001 From: srningap Date: Fri, 18 Aug 2023 19:12:13 +0530 Subject: [PATCH 7/8] using release interrupt for button 1 --- .../platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_m4.c | 3 ++- examples/window-app/silabs/src/WindowManager.cpp | 9 --------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_m4.c b/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_m4.c index bcedf1c8a52c16..15c56ec47bcd24 100644 --- a/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_m4.c +++ b/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_m4.c @@ -82,9 +82,10 @@ void IRQ021_Handler(void) RSI_NPSSGPIO_ClrIntr(NPSS_GPIO_0_INTR); RSI_NPSSGPIO_ClrIntr(NPSS_GPIO_2_INTR); // if the btn is not pressed setting the state to 1 - if (RSI_NPSSGPIO_GetPin(NPSS_GPIO_2)) + if (RSI_NPSSGPIO_GetPin(NPSS_GPIO_2) && (!btn1)) { btn1 = 1; + sl_button_on_change(1, 0); } // geting the state of the gpio 2 pin and checking if the btn is already pressed or not if (!RSI_NPSSGPIO_GetPin(NPSS_GPIO_2) && btn1) diff --git a/examples/window-app/silabs/src/WindowManager.cpp b/examples/window-app/silabs/src/WindowManager.cpp index f9a45b578fdce2..c6687ab2ba512e 100644 --- a/examples/window-app/silabs/src/WindowManager.cpp +++ b/examples/window-app/silabs/src/WindowManager.cpp @@ -742,15 +742,6 @@ void WindowManager::ButtonEventHandler(uint8_t button, uint8_t btnAction) } AppTask::GetAppTask().PostEvent(&event); - -// Since there is no release interrupt for button1 posting release event after press event -#ifdef SIWX_917 - if (button) - { - event = CreateNewEvent(AppEvent::kEventType_DownReleased); - AppTask::GetAppTask().PostEvent(&event); - } -#endif } void WindowManager::GeneralEventHandler(AppEvent * aEvent) From 08a2da5959379eb24fb35eb8ffad76e610650c79 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 18 Aug 2023 13:43:12 +0000 Subject: [PATCH 8/8] Restyled by clang-format --- examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_m4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_m4.c b/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_m4.c index 15c56ec47bcd24..88a9b97f571807 100644 --- a/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_m4.c +++ b/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_m4.c @@ -82,7 +82,7 @@ void IRQ021_Handler(void) RSI_NPSSGPIO_ClrIntr(NPSS_GPIO_0_INTR); RSI_NPSSGPIO_ClrIntr(NPSS_GPIO_2_INTR); // if the btn is not pressed setting the state to 1 - if (RSI_NPSSGPIO_GetPin(NPSS_GPIO_2) && (!btn1)) + if (RSI_NPSSGPIO_GetPin(NPSS_GPIO_2) && (!btn1)) { btn1 = 1; sl_button_on_change(1, 0);