From e01471d6fb7422021ee1bb3c92048239f3522f4a Mon Sep 17 00:00:00 2001 From: bhmanda-silabs <107180296+bhmanda-silabs@users.noreply.github.com> Date: Thu, 16 Jan 2025 20:35:26 +0530 Subject: [PATCH] Added changes to fix 917 SoC build when LED and button disabled (#37010) --- examples/platform/silabs/MatterConfig.cpp | 2 + .../silabs/SiWx917/SiWxPlatformInterface.h | 2 + .../platformAbstraction/WiseMcuSpam.cpp | 40 ++++++++++++------- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/examples/platform/silabs/MatterConfig.cpp b/examples/platform/silabs/MatterConfig.cpp index 3f99a3daf6d1d3..0bf0af2a17c75f 100644 --- a/examples/platform/silabs/MatterConfig.cpp +++ b/examples/platform/silabs/MatterConfig.cpp @@ -331,7 +331,9 @@ CHIP_ERROR SilabsMatterConfig::InitWiFi(void) extern "C" void vApplicationIdleHook(void) { #if (SLI_SI91X_MCU_INTERFACE && CHIP_CONFIG_ENABLE_ICD_SERVER) +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT SiWxPlatformInterface::sl_si91x_btn_event_handler(); +#endif // SL_CATALOG_SIMPLE_BUTTON_PRESENT SiWxPlatformInterface::sl_si91x_uart_power_requirement_handler(); #endif } diff --git a/src/platform/silabs/SiWx917/SiWxPlatformInterface.h b/src/platform/silabs/SiWx917/SiWxPlatformInterface.h index 1b654332f11c72..287ed50e9426d2 100644 --- a/src/platform/silabs/SiWx917/SiWxPlatformInterface.h +++ b/src/platform/silabs/SiWx917/SiWxPlatformInterface.h @@ -30,8 +30,10 @@ extern "C" { #endif #if CHIP_CONFIG_ENABLE_ICD_SERVER #if SLI_SI91X_MCU_INTERFACE +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT #include "sl_si91x_button.h" #include "sl_si91x_button_pin_config.h" +#endif // SL_CATALOG_SIMPLE_BUTTON_PRESENT #include "sl_si91x_driver_gpio.h" #include "sl_si91x_power_manager.h" diff --git a/src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp b/src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp index 1b03de76f37de2..77ad1f210c1c28 100644 --- a/src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp +++ b/src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp @@ -16,7 +16,6 @@ */ #include -#include #include #include @@ -36,17 +35,28 @@ extern "C" { #include "em_core.h" #include "rsi_board.h" #include "sl_event_handler.h" + +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT #include "sl_si91x_button.h" #include "sl_si91x_button_pin_config.h" -#if defined(SL_MATTER_RGB_LED_ENABLED) && SL_MATTER_RGB_LED_ENABLED +#endif // SL_CATALOG_SIMPLE_BUTTON_PRESENT + +#ifdef ENABLE_WSTK_LEDS +#if (defined(SL_MATTER_RGB_LED_ENABLED) && SL_MATTER_RGB_LED_ENABLED == 1) #include "sl_si91x_rgb_led.h" #include "sl_si91x_rgb_led_config.h" #include "sl_si91x_rgb_led_instances.h" +#define SL_LED_COUNT SL_SI91X_RGB_LED_COUNT +const sl_rgb_led_t * ledPinArray[SL_LED_COUNT] = { &led_led0 }; +#define SL_RGB_LED_INSTANCE(n) (ledPinArray[n]) #else #include "sl_si91x_led.h" #include "sl_si91x_led_config.h" #include "sl_si91x_led_instances.h" -#endif // defined(SL_MATTER_RGB_LED_ENABLED) && SL_MATTER_RGB_LED_ENABLED +#define SL_LED_COUNT SL_SI91x_LED_COUNT +uint8_t ledPinArray[SL_LED_COUNT] = { SL_LED_LED0_PIN, SL_LED_LED1_PIN }; +#endif // SL_MATTER_RGB_LED_ENABLED +#endif // ENABLE_WSTK_LEDS #if CHIP_CONFIG_ENABLE_ICD_SERVER == 0 void soc_pll_config(void); @@ -61,20 +71,15 @@ void soc_pll_config(void); #include "uart.h" #endif -#if defined(SL_MATTER_RGB_LED_ENABLED) && SL_MATTER_RGB_LED_ENABLED -#define SL_LED_COUNT SL_SI91X_RGB_LED_COUNT -const sl_rgb_led_t * ledPinArray[SL_LED_COUNT] = { &led_led0 }; -#define SL_RGB_LED_INSTANCE(n) (ledPinArray[n]) -#else -#define SL_LED_COUNT SL_SI91x_LED_COUNT -uint8_t ledPinArray[SL_LED_COUNT] = { SL_LED_LED0_PIN, SL_LED_LED1_PIN }; -#endif // defined(SL_MATTER_RGB_LED_ENABLED) && SL_MATTER_RGB_LED_ENABLED - namespace chip { namespace DeviceLayer { namespace Silabs { namespace { + +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT uint8_t sButtonStates[SL_SI91x_BUTTON_COUNT] = { 0 }; +#endif // SL_CATALOG_SIMPLE_BUTTON_PRESENT + #if CHIP_CONFIG_ENABLE_ICD_SERVER bool btn0_pressed = false; #endif /* SL_ICD_ENABLED */ @@ -121,7 +126,7 @@ void SilabsPlatform::InitLed(void) CHIP_ERROR SilabsPlatform::SetLed(bool state, uint8_t led) { VerifyOrReturnError(led < SL_LED_COUNT, CHIP_ERROR_INVALID_ARGUMENT); -#if defined(SL_MATTER_RGB_LED_ENABLED) && SL_MATTER_RGB_LED_ENABLED +#if (defined(SL_MATTER_RGB_LED_ENABLED) && SL_MATTER_RGB_LED_ENABLED == 1) (state) ? sl_si91x_simple_rgb_led_on(SL_RGB_LED_INSTANCE(led)) : sl_si91x_simple_rgb_led_off(SL_RGB_LED_INSTANCE(led)); #else (state) ? sl_si91x_led_set(ledPinArray[led]) : sl_si91x_led_clear(ledPinArray[led]); @@ -138,7 +143,7 @@ bool SilabsPlatform::GetLedState(uint8_t led) CHIP_ERROR SilabsPlatform::ToggleLed(uint8_t led) { VerifyOrReturnError(led < SL_LED_COUNT, CHIP_ERROR_INVALID_ARGUMENT); -#if defined(SL_MATTER_RGB_LED_ENABLED) && SL_MATTER_RGB_LED_ENABLED +#if (defined(SL_MATTER_RGB_LED_ENABLED) && SL_MATTER_RGB_LED_ENABLED == 1) sl_si91x_simple_rgb_led_toggle(SL_RGB_LED_INSTANCE(led)); #else sl_si91x_led_toggle(ledPinArray[led]); @@ -152,6 +157,7 @@ void SilabsPlatform::StartScheduler() vTaskStartScheduler(); } +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT extern "C" void sl_button_on_change(uint8_t btn, uint8_t btnAction) { #if SL_ICD_ENABLED @@ -191,6 +197,12 @@ uint8_t SilabsPlatform::GetButtonState(uint8_t button) { return (button < SL_SI91x_BUTTON_COUNT) ? sButtonStates[button] : 0; } +#else +uint8_t SilabsPlatform::GetButtonState(uint8_t button) +{ + return 0; +} +#endif // SL_CATALOG_SIMPLE_BUTTON_PRESENT CHIP_ERROR SilabsPlatform::FlashInit() {