diff --git a/examples/light-switch-app/silabs/SiWx917/BUILD.gn b/examples/light-switch-app/silabs/SiWx917/BUILD.gn index 5972ad7265fbc4..a45c2d7a391ece 100644 --- a/examples/light-switch-app/silabs/SiWx917/BUILD.gn +++ b/examples/light-switch-app/silabs/SiWx917/BUILD.gn @@ -200,7 +200,7 @@ efr32_executable("light_switch_app") { ] if (use_wstk_leds) { - #sources += [ "${examples_plat_dir}/LEDWidget.cpp" ] + sources += [ "${examples_plat_dir}/LEDWidget.cpp" ] } if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli || diff --git a/examples/light-switch-app/silabs/SiWx917/include/AppTask.h b/examples/light-switch-app/silabs/SiWx917/include/AppTask.h index 29a0078d1472f3..de8ab5ce947e8e 100644 --- a/examples/light-switch-app/silabs/SiWx917/include/AppTask.h +++ b/examples/light-switch-app/silabs/SiWx917/include/AppTask.h @@ -38,49 +38,10 @@ /********************************************************** * Defines *********************************************************/ - -#define SL_SIMPLE_BUTTON_MODE_POLL 0U ///< BUTTON input capture using polling -#define SL_SIMPLE_BUTTON_MODE_POLL_AND_DEBOUNCE 1U ///< BUTTON input capture using polling and debouncing -#define SL_SIMPLE_BUTTON_MODE_INTERRUPT 2U ///< BUTTON input capture using interrupt - -#define SL_SIMPLE_BUTTON_DISABLED 2U ///< BUTTON state is disabled -#define SL_SIMPLE_BUTTON_PRESSED 1U ///< BUTTON state is pressed -#define SL_SIMPLE_BUTTON_RELEASED 0U ///< BUTTON state is released - -typedef uint8_t sl_button_mode_t; ///< BUTTON mode -typedef uint8_t sl_button_state_t; ///< BUTTON state -typedef struct sl_button sl_button_t; - -/// A BUTTON instance -typedef struct sl_button -{ - void * context; ///< The context for this BUTTON instance - void (*init)(const sl_button_t * handle); ///< Member function to initialize BUTTON instance - void (*poll)(const sl_button_t * handle); ///< Member function to poll BUTTON - void (*enable)(const sl_button_t * handle); ///< Member function to enable BUTTON - void (*disable)(const sl_button_t * handle); ///< Member function to disable BUTTON - sl_button_state_t (*get_state)(const sl_button_t * handle); ///< Member function to retrieve BUTTON state -} sl_button; - -const sl_button_t sl_button_btn0 = { - .context = NULL, - .init = NULL, - .poll = NULL, - .enable = NULL, - .disable = NULL, - .get_state = NULL, -}; -#define APP_FUNCTION_BUTTON &sl_button_btn0 - -const sl_button_t sl_button_btn1 = { - .context = NULL, - .init = NULL, - .poll = NULL, - .enable = NULL, - .disable = NULL, - .get_state = NULL, -}; -#define APP_LIGHT_SWITCH &sl_button_btn1 +// Button specific defines for SiWx917 +#define SL_SIMPLE_BUTTON_PRESSED 1U +#define SIWx917_BTN0 0 +#define SIWx917_BTN1 1 // Application-defined error codes in the CHIP_ERROR space. #define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01) @@ -115,11 +76,11 @@ class AppTask : public BaseApplication * @brief Event handler when a button is pressed * Function posts an event for button processing * - * @param buttonHandle APP_LIGHT_SWITCH or APP_FUNCTION_BUTTON + * @param button - btn0 or btn1 * @param btnAction button action - SL_SIMPLE_BUTTON_PRESSED, * SL_SIMPLE_BUTTON_RELEASED or SL_SIMPLE_BUTTON_DISABLED */ - void ButtonEventHandler(const sl_button_t * buttonHandle, uint8_t btnAction); + void ButtonEventHandler(uint8_t button, uint8_t btnAction); /** * @brief Callback called by the identify-server when an identify command is received diff --git a/examples/light-switch-app/silabs/SiWx917/src/AppTask.cpp b/examples/light-switch-app/silabs/SiWx917/src/AppTask.cpp index 06a3dc734006ac..3ea96abf726399 100644 --- a/examples/light-switch-app/silabs/SiWx917/src/AppTask.cpp +++ b/examples/light-switch-app/silabs/SiWx917/src/AppTask.cpp @@ -60,9 +60,6 @@ #define SYSTEM_STATE_LED &sl_led_led0 -#define APP_FUNCTION_BUTTON &sl_button_btn0 -#define APP_LIGHT_SWITCH &sl_button_btn1 - namespace { constexpr chip::EndpointId kLightSwitchEndpoint = 1; @@ -258,14 +255,19 @@ void AppTask::SwitchActionEventHandler(AppEvent * aEvent) } } -void AppTask::ButtonEventHandler(const sl_button_t * buttonHandle, uint8_t btnAction) +void AppTask::ButtonEventHandler(uint8_t button, uint8_t btnAction) { - VerifyOrReturn(buttonHandle != NULL); - AppEvent button_event = {}; button_event.Type = AppEvent::kEventType_Button; button_event.ButtonEvent.Action = btnAction; - - button_event.Handler = SwitchActionEventHandler; - sAppTask.PostEvent(&button_event); + if (button == SIWx917_BTN1) + { + button_event.Handler = SwitchActionEventHandler; + sAppTask.PostEvent(&button_event); + } + else if (button == SIWx917_BTN0) + { + button_event.Handler = BaseApplication::ButtonHandler; + sAppTask.PostEvent(&button_event); + } } diff --git a/examples/light-switch-app/silabs/SiWx917/src/main.cpp b/examples/light-switch-app/silabs/SiWx917/src/main.cpp index c67851a2ca78cc..7bae26206310d4 100644 --- a/examples/light-switch-app/silabs/SiWx917/src/main.cpp +++ b/examples/light-switch-app/silabs/SiWx917/src/main.cpp @@ -33,7 +33,7 @@ #define BLE_DEV_NAME "SiLabs-Light-Switch" -extern "C" void sl_button_on_change(); +extern "C" void sl_button_on_change(uint8_t btn, uint8_t btnAction); using namespace ::chip; using namespace ::chip::Inet; @@ -81,7 +81,7 @@ int main(void) appError(CHIP_ERROR_INTERNAL); } -void sl_button_on_change() +void sl_button_on_change(uint8_t btn, uint8_t btnAction) { - AppTask::GetAppTask().ButtonEventHandler(APP_LIGHT_SWITCH, SL_SIMPLE_BUTTON_PRESSED); + AppTask::GetAppTask().ButtonEventHandler(btn, btnAction); } diff --git a/examples/lighting-app/silabs/SiWx917/BUILD.gn b/examples/lighting-app/silabs/SiWx917/BUILD.gn index 8abb554a67c3be..d98d0a80b23388 100644 --- a/examples/lighting-app/silabs/SiWx917/BUILD.gn +++ b/examples/lighting-app/silabs/SiWx917/BUILD.gn @@ -204,8 +204,7 @@ efr32_executable("lighting_app") { ] if (use_wstk_leds) { - # TODO: Commentting for CCP till the bring up of this is done - #sources += [ "${examples_plat_dir}/LEDWidget.cpp" ] + sources += [ "${examples_plat_dir}/LEDWidget.cpp" ] } if (chip_enable_pw_rpc || chip_build_libshell || use_rs911x) { diff --git a/examples/lighting-app/silabs/SiWx917/include/AppTask.h b/examples/lighting-app/silabs/SiWx917/include/AppTask.h index 225b726f732b13..0310e9e187c80c 100644 --- a/examples/lighting-app/silabs/SiWx917/include/AppTask.h +++ b/examples/lighting-app/silabs/SiWx917/include/AppTask.h @@ -39,6 +39,10 @@ /********************************************************** * Defines *********************************************************/ +// Button specific defines for SiWx917 +#define SL_SIMPLE_BUTTON_PRESSED 1 +#define SIWx917_BTN0 0 +#define SIWx917_BTN1 1 // Application-defined error codes in the CHIP_ERROR space. #define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01) @@ -69,6 +73,16 @@ class AppTask : public BaseApplication CHIP_ERROR StartAppTask(); + /** + * @brief Event handler when a button is pressed + * Function posts an event for button processing + * + * @param button - btn0 or btn1 + * @param btnAction button action - SL_SIMPLE_BUTTON_PRESSED, + * SL_SIMPLE_BUTTON_RELEASED or SL_SIMPLE_BUTTON_DISABLED + */ + void ButtonEventHandler(uint8_t button, uint8_t btnAction); + /** * @brief Callback called by the identify-server when an identify command is received * diff --git a/examples/lighting-app/silabs/SiWx917/src/AppTask.cpp b/examples/lighting-app/silabs/SiWx917/src/AppTask.cpp index 06665ad695743c..6133df35c33610 100644 --- a/examples/lighting-app/silabs/SiWx917/src/AppTask.cpp +++ b/examples/lighting-app/silabs/SiWx917/src/AppTask.cpp @@ -36,14 +36,20 @@ #include -#define APP_FUNCTION_BUTTON &sl_button_btn0 -#define APP_LIGHT_SWITCH &sl_button_btn1 +#ifdef ENABLE_WSTK_LEDS +#include "LEDWidget.h" +#define APP_ACTION_LED 1 +#endif // ENABLE_WSTK_LEDS using namespace chip; using namespace ::chip::DeviceLayer; namespace { +#ifdef ENABLE_WSTK_LEDS +LEDWidget sLightLED; +#endif // ENABLE_WSTK_LEDS + EmberAfIdentifyEffectIdentifier sIdentifyEffect = EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_STOP_EFFECT; /********************************************************** @@ -128,16 +134,19 @@ CHIP_ERROR AppTask::Init() appError(err); } - /* TODO - err = LightMgr().Init(); - if (err != CHIP_NO_ERROR) - { - SILABS_LOG("LightMgr::Init() failed"); - appError(err); - } + err = LightMgr().Init(); + if (err != CHIP_NO_ERROR) + { + SILABS_LOG("LightMgr::Init() failed"); + appError(err); + } + + LightMgr().SetCallbacks(ActionInitiated, ActionCompleted); - LightMgr().SetCallbacks(ActionInitiated, ActionCompleted); - */ +#ifdef ENABLE_WSTK_LEDS + sLightLED.Init(APP_ACTION_LED); + sLightLED.Set(LightMgr().IsLightOn()); +#endif // ENABLE_WSTK_LEDS return err; } @@ -227,11 +236,29 @@ void AppTask::LightActionEventHandler(AppEvent * aEvent) } } +void AppTask::ButtonEventHandler(uint8_t button, uint8_t btnAction) +{ + AppEvent button_event = {}; + button_event.Type = AppEvent::kEventType_Button; + button_event.ButtonEvent.Action = btnAction; + if (button == SIWx917_BTN1 && btnAction == SL_SIMPLE_BUTTON_PRESSED) + { + button_event.Handler = LightActionEventHandler; + sAppTask.PostEvent(&button_event); + } + else if (button == SIWx917_BTN0) + { + button_event.Handler = BaseApplication::ButtonHandler; + sAppTask.PostEvent(&button_event); + } +} + void AppTask::ActionInitiated(LightingManager::Action_t aAction, int32_t aActor) { // Action initiated, update the light led bool lightOn = aAction == LightingManager::ON_ACTION; - SILABS_LOG("Turning light %s", (lightOn) ? "On" : "Off") + SILABS_LOG("Turning light %s", (lightOn) ? "On" : "Off"); + sLightLED.Set(lightOn); #ifdef DISPLAY_ENABLED sAppTask.GetLCD().WriteDemoUI(lightOn); diff --git a/examples/lighting-app/silabs/SiWx917/src/main.cpp b/examples/lighting-app/silabs/SiWx917/src/main.cpp index e3ed2a9c8490a8..d95f6b7ab51295 100644 --- a/examples/lighting-app/silabs/SiWx917/src/main.cpp +++ b/examples/lighting-app/silabs/SiWx917/src/main.cpp @@ -33,6 +33,9 @@ #endif #define BLE_DEV_NAME "SiLabs-Light" + +extern "C" void sl_button_on_change(uint8_t btn, uint8_t btnAction); + using namespace ::chip; using namespace ::chip::Inet; using namespace ::chip::DeviceLayer; @@ -80,3 +83,8 @@ int main(void) SILABS_LOG("vTaskStartScheduler() failed"); appError(CHIP_ERROR_INTERNAL); } + +void sl_button_on_change(uint8_t btn, uint8_t btnAction) +{ + AppTask::GetAppTask().ButtonEventHandler(btn, btnAction); +} diff --git a/examples/lock-app/silabs/SiWx917/BUILD.gn b/examples/lock-app/silabs/SiWx917/BUILD.gn index 01710fc7ef48fc..c2cbe6e06ebb59 100644 --- a/examples/lock-app/silabs/SiWx917/BUILD.gn +++ b/examples/lock-app/silabs/SiWx917/BUILD.gn @@ -197,7 +197,7 @@ efr32_executable("lock_app") { ] if (use_wstk_leds) { - #sources += [ "${examples_plat_dir}/LEDWidget.cpp" ] + sources += [ "${examples_plat_dir}/LEDWidget.cpp" ] } if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli || diff --git a/examples/lock-app/silabs/SiWx917/include/AppTask.h b/examples/lock-app/silabs/SiWx917/include/AppTask.h index e6b88fcf127766..9ad4a2cd134773 100644 --- a/examples/lock-app/silabs/SiWx917/include/AppTask.h +++ b/examples/lock-app/silabs/SiWx917/include/AppTask.h @@ -30,7 +30,6 @@ #include "BaseApplication.h" #include "FreeRTOS.h" #include "LockManager.h" -//#include "sl_simple_button_instances.h" #include "timers.h" // provides FreeRTOS timer support #include #include @@ -40,48 +39,10 @@ /********************************************************** * Defines *********************************************************/ -#define SL_SIMPLE_BUTTON_MODE_POLL 0U ///< BUTTON input capture using polling -#define SL_SIMPLE_BUTTON_MODE_POLL_AND_DEBOUNCE 1U ///< BUTTON input capture using polling and debouncing -#define SL_SIMPLE_BUTTON_MODE_INTERRUPT 2U ///< BUTTON input capture using interrupt - -#define SL_SIMPLE_BUTTON_DISABLED 2U ///< BUTTON state is disabled -#define SL_SIMPLE_BUTTON_PRESSED 1U ///< BUTTON state is pressed -#define SL_SIMPLE_BUTTON_RELEASED 0U ///< BUTTON state is released - -typedef uint8_t sl_button_mode_t; ///< BUTTON mode -typedef uint8_t sl_button_state_t; ///< BUTTON state -typedef struct sl_button sl_button_t; - -/// A BUTTON instance -typedef struct sl_button -{ - void * context; ///< The context for this BUTTON instance - void (*init)(const sl_button_t * handle); ///< Member function to initialize BUTTON instance - void (*poll)(const sl_button_t * handle); ///< Member function to poll BUTTON - void (*enable)(const sl_button_t * handle); ///< Member function to enable BUTTON - void (*disable)(const sl_button_t * handle); ///< Member function to disable BUTTON - sl_button_state_t (*get_state)(const sl_button_t * handle); ///< Member function to retrieve BUTTON state -} sl_button; - -const sl_button_t sl_button_btn0 = { - .context = NULL, - .init = NULL, - .poll = NULL, - .enable = NULL, - .disable = NULL, - .get_state = NULL, -}; -#define APP_FUNCTION_BUTTON &sl_button_btn0 - -const sl_button_t sl_button_btn1 = { - .context = NULL, - .init = NULL, - .poll = NULL, - .enable = NULL, - .disable = NULL, - .get_state = NULL, -}; -#define APP_LIGHT_SWITCH &sl_button_btn1 +// Button specific defines for SiWx917 +#define SL_SIMPLE_BUTTON_PRESSED 1 +#define SIWx917_BTN0 0 +#define SIWx917_BTN1 1 // Application-defined error codes in the CHIP_ERROR space. #define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01) @@ -128,7 +89,7 @@ class AppTask : public BaseApplication * @param btnAction button action - SL_SIMPLE_BUTTON_PRESSED, * SL_SIMPLE_BUTTON_RELEASED or SL_SIMPLE_BUTTON_DISABLED */ - void ButtonEventHandler(const sl_button_t * buttonHandle, uint8_t btnAction); + void ButtonEventHandler(uint8_t button, uint8_t btnAction); /** * @brief Callback called by the identify-server when an identify command is received diff --git a/examples/lock-app/silabs/SiWx917/src/AppTask.cpp b/examples/lock-app/silabs/SiWx917/src/AppTask.cpp index 4685000385ae8b..0582eed798470c 100644 --- a/examples/lock-app/silabs/SiWx917/src/AppTask.cpp +++ b/examples/lock-app/silabs/SiWx917/src/AppTask.cpp @@ -26,7 +26,6 @@ #ifdef ENABLE_WSTK_LEDS #include "LEDWidget.h" -#include "sl_simple_led_instances.h" #endif // ENABLE_WSTK_LEDS #ifdef DISPLAY_ENABLED @@ -56,13 +55,9 @@ #include #ifdef ENABLE_WSTK_LEDS -#define SYSTEM_STATE_LED &sl_led_led0 -#define LOCK_STATE_LED &sl_led_led1 +#define LOCK_STATE_LED 1 #endif // ENABLE_WSTK_LEDS -#define APP_FUNCTION_BUTTON &sl_button_btn0 -#define APP_LOCK_SWITCH &sl_button_btn1 - using chip::app::Clusters::DoorLock::DlLockState; using chip::app::Clusters::DoorLock::DlOperationError; using chip::app::Clusters::DoorLock::DlOperationSource; @@ -352,20 +347,23 @@ void AppTask::LockActionEventHandler(AppEvent * aEvent) } } -void AppTask::ButtonEventHandler(const sl_button_t * buttonHandle, uint8_t btnAction) +void AppTask::ButtonEventHandler(uint8_t button, uint8_t btnAction) { - if (buttonHandle == NULL) - { - return; - } AppEvent button_event = {}; button_event.Type = AppEvent::kEventType_Button; button_event.ButtonEvent.Action = btnAction; - SILABS_LOG("### Lock button #### "); - button_event.Handler = BaseApplication::ButtonHandler; - sAppTask.PostEvent(&button_event); + if (button == SIWx917_BTN1 && btnAction == SL_SIMPLE_BUTTON_PRESSED) + { + button_event.Handler = LockActionEventHandler; + sAppTask.PostEvent(&button_event); + } + else if (button == SIWx917_BTN0) + { + button_event.Handler = BaseApplication::ButtonHandler; + sAppTask.PostEvent(&button_event); + } } void AppTask::ActionInitiated(LockManager::Action_t aAction, int32_t aActor) diff --git a/examples/lock-app/silabs/SiWx917/src/main.cpp b/examples/lock-app/silabs/SiWx917/src/main.cpp index c3cbf82681bfdc..a3617564575ec3 100644 --- a/examples/lock-app/silabs/SiWx917/src/main.cpp +++ b/examples/lock-app/silabs/SiWx917/src/main.cpp @@ -32,7 +32,7 @@ #endif #define BLE_DEV_NAME "SiLabs-Door-Lock" -extern "C" void sl_button_on_change(); +extern "C" void sl_button_on_change(uint8_t btn, uint8_t btnAction); using namespace ::chip; using namespace ::chip::Inet; @@ -79,7 +79,7 @@ int main(void) appError(CHIP_ERROR_INTERNAL); } -void sl_button_on_change() +void sl_button_on_change(uint8_t btn, uint8_t btnAction) { - AppTask::GetAppTask().ButtonEventHandler(APP_FUNCTION_BUTTON, SL_SIMPLE_BUTTON_PRESSED); + AppTask::GetAppTask().ButtonEventHandler(btn, btnAction); } diff --git a/examples/platform/silabs/SiWx917/BaseApplication.cpp b/examples/platform/silabs/SiWx917/BaseApplication.cpp index 86b60da581ee77..081bbfa1055419 100644 --- a/examples/platform/silabs/SiWx917/BaseApplication.cpp +++ b/examples/platform/silabs/SiWx917/BaseApplication.cpp @@ -25,6 +25,10 @@ #include "AppEvent.h" #include "AppTask.h" +#ifdef ENABLE_WSTK_LEDS +#include "LEDWidget.h" +#endif // ENABLE_WSTK_LEDS + #ifdef DISPLAY_ENABLED #include "lcd.h" #ifdef QR_CODE_ENABLED @@ -60,6 +64,9 @@ #define APP_TASK_PRIORITY 2 #define APP_EVENT_QUEUE_SIZE 10 #define EXAMPLE_VENDOR_ID 0xcafe +#ifdef ENABLE_WSTK_LEDS +#define APP_STATE_LED 0 +#endif // ENABLE_WSTK_LEDS using namespace chip; using namespace ::chip::DeviceLayer; @@ -76,6 +83,10 @@ TimerHandle_t sLightTimer; TaskHandle_t sAppTaskHandle; QueueHandle_t sAppEventQueue; +#ifdef ENABLE_WSTK_LEDS +LEDWidget sStatusLED; +#endif // ENABLE_WSTK_LEDS + #ifdef SL_WIFI app::Clusters::NetworkCommissioning::Instance sWiFiNetworkCommissioningInstance(0 /* Endpoint Id */, &(NetworkCommissioning::SlWiFiDriver::GetInstance())); @@ -188,6 +199,10 @@ CHIP_ERROR BaseApplication::Init(Identify * identifyObj) SILABS_LOG("Current Software Version: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); +#ifdef ENABLE_WSTK_LEDS + sStatusLED.Init(APP_STATE_LED); +#endif // ENABLE_WSTK_LEDS + ConfigurationMgr().LogDeviceConfig(); // Create buffer for QR code that can fit max size and null terminator. @@ -243,6 +258,13 @@ void BaseApplication::FunctionEventHandler(AppEvent * aEvent) #endif // CHIP_DEVICE_CONFIG_ENABLE_SED mFunction = kFunction_FactoryReset; + +#ifdef ENABLE_WSTK_LEDS + // Turn off LED before starting blink to make sure blink is + // co-ordinated. + sStatusLED.Set(false); + sStatusLED.Blink(500); +#endif // ENABLE_WSTK_LEDS } else if (mFunctionTimerActive && mFunction == kFunction_FactoryReset) { @@ -294,6 +316,106 @@ void BaseApplication::LightEventHandler() // the LEDs at an even rate of 100ms. // // Otherwise, blink the LED ON for a very short time. +#ifdef ENABLE_WSTK_LEDS + if (mFunction != kFunction_FactoryReset) + { + if ((gIdentifyptr != nullptr) && (gIdentifyptr->mActive)) + { + sStatusLED.Blink(250, 250); + } + else if (sIdentifyEffect != EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_STOP_EFFECT) + { + if (sIdentifyEffect == EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BLINK) + { + sStatusLED.Blink(50, 50); + } + if (sIdentifyEffect == EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BREATHE) + { + sStatusLED.Blink(1000, 1000); + } + if (sIdentifyEffect == EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_OKAY) + { + sStatusLED.Blink(300, 700); + } + } +#if !(defined(CHIP_DEVICE_CONFIG_ENABLE_SED) && CHIP_DEVICE_CONFIG_ENABLE_SED) + else if (sIsProvisioned && sIsEnabled) + { + if (sIsAttached) + { + sStatusLED.Set(true); + } + else + { + sStatusLED.Blink(950, 50); + } + } + else if (sHaveBLEConnections) + { + sStatusLED.Blink(100, 100); + } + else + { + sStatusLED.Blink(50, 950); + } +#endif // CHIP_DEVICE_CONFIG_ENABLE_SED + } + + sStatusLED.Animate(); +#endif // ENABLE_WSTK_LEDS +} + +void BaseApplication::ButtonHandler(AppEvent * aEvent) +{ + // To trigger software update: press the APP_FUNCTION_BUTTON button briefly (< + // FACTORY_RESET_TRIGGER_TIMEOUT) To initiate factory reset: press the + // APP_FUNCTION_BUTTON for FACTORY_RESET_TRIGGER_TIMEOUT + + // FACTORY_RESET_CANCEL_WINDOW_TIMEOUT All LEDs start blinking after + // FACTORY_RESET_TRIGGER_TIMEOUT to signal factory reset has been initiated. + // To cancel factory reset: release the APP_FUNCTION_BUTTON once all LEDs + // start blinking within the FACTORY_RESET_CANCEL_WINDOW_TIMEOUT + if (aEvent->ButtonEvent.Action == SL_SIMPLE_BUTTON_PRESSED) + { + if (!mFunctionTimerActive && mFunction == kFunction_NoneSelected) + { + StartFunctionTimer(FACTORY_RESET_TRIGGER_TIMEOUT); + mFunction = kFunction_StartBleAdv; + } + } + else + { + // If the button was released before factory reset got initiated, start BLE advertissement in fast mode + if (mFunctionTimerActive && mFunction == kFunction_StartBleAdv) + { + CancelFunctionTimer(); + mFunction = kFunction_NoneSelected; + +#ifdef SL_WIFI + if (!ConnectivityMgr().IsWiFiStationProvisioned()) +#else + if (!ConnectivityMgr().IsThreadProvisioned()) +#endif /* !SL_WIFI */ + { + // Enable BLE advertisements + ConnectivityMgr().SetBLEAdvertisingEnabled(true); + ConnectivityMgr().SetBLEAdvertisingMode(ConnectivityMgr().kFastAdvertising); + } + else { SILABS_LOG("Network is already provisioned, Ble advertissement not enabled"); } + } + else if (mFunctionTimerActive && mFunction == kFunction_FactoryReset) + { + CancelFunctionTimer(); + +#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1 + StopStatusLEDTimer(); +#endif + + // Change the function to none selected since factory reset has been + // canceled. + mFunction = kFunction_NoneSelected; + SILABS_LOG("Factory Reset has been Canceled"); + } + } } void BaseApplication::CancelFunctionTimer() @@ -338,6 +460,9 @@ void BaseApplication::StartStatusLEDTimer() void BaseApplication::StopStatusLEDTimer() { +#ifdef ENABLE_WSTK_LEDS + sStatusLED.Set(false); +#endif // ENABLE_WSTK_LEDS if (xTimerStop(sLightTimer, 100) != pdPASS) { diff --git a/examples/platform/silabs/SiWx917/LEDWidget.cpp b/examples/platform/silabs/SiWx917/LEDWidget.cpp index 10ffcac363520d..bb80fa3f9dfcd1 100644 --- a/examples/platform/silabs/SiWx917/LEDWidget.cpp +++ b/examples/platform/silabs/SiWx917/LEDWidget.cpp @@ -19,45 +19,32 @@ #include "LEDWidget.h" -extern "C" { -#include "sl_simple_led_instances.h" -} - #include using namespace ::chip::System; -void LEDWidget::InitGpio(void) -{ - // Sets gpio pin mode for ALL board Leds. - sl_simple_led_init_instances(); -} - -void LEDWidget::Init(const sl_led_t * led) +void LEDWidget::Init(int led) { mLastChangeTimeMS = 0; mBlinkOnTimeMS = 0; mBlinkOffTimeMS = 0; mLed = led; + mLedStatus = false; Set(false); } void LEDWidget::Invert(void) { - if (mLed) - { - sl_led_toggle(mLed); - } + RSI_Board_LED_Toggle(mLed); + mLedStatus = !mLedStatus; } void LEDWidget::Set(bool state) { mLastChangeTimeMS = mBlinkOnTimeMS = mBlinkOffTimeMS = 0; - if (mLed) - { - state ? sl_led_turn_on(mLed) : sl_led_turn_off(mLed); - } + state ? RSI_Board_LED_Set(mLed, true) : RSI_Board_LED_Set(mLed, false); + mLedStatus = state; } void LEDWidget::Blink(uint32_t changeRateMS) @@ -77,7 +64,7 @@ void LEDWidget::Animate() if (mBlinkOnTimeMS != 0 && mBlinkOffTimeMS != 0) { uint64_t nowMS = chip::System::SystemClock().GetMonotonicMilliseconds64().count(); - uint64_t stateDurMS = sl_led_get_state(mLed) ? mBlinkOnTimeMS : mBlinkOffTimeMS; + uint64_t stateDurMS = mLedStatus ? mBlinkOnTimeMS : mBlinkOffTimeMS; uint64_t nextChangeTimeMS = mLastChangeTimeMS + stateDurMS; if (nextChangeTimeMS < nowMS) diff --git a/examples/platform/silabs/SiWx917/LEDWidget.h b/examples/platform/silabs/SiWx917/LEDWidget.h index d779cb9d3ef4b6..44fb1937ee0f33 100644 --- a/examples/platform/silabs/SiWx917/LEDWidget.h +++ b/examples/platform/silabs/SiWx917/LEDWidget.h @@ -19,14 +19,16 @@ #pragma once -#include "sl_led.h" #include +extern "C" void RSI_Board_LED_Set(int, bool); +extern "C" void RSI_Board_LED_Toggle(int); +extern "C" bool RSI_Board_LED_GetState(int); + class LEDWidget { public: - static void InitGpio(void); - void Init(const sl_led_t * led); + void Init(int led); void Set(bool state); void Invert(void); void Blink(uint32_t changeRateMS); @@ -37,5 +39,7 @@ class LEDWidget uint64_t mLastChangeTimeMS; uint32_t mBlinkOnTimeMS; uint32_t mBlinkOffTimeMS; - const sl_led_t * mLed; + int mLed; + // created a temporary mLedStatus since Led status is not updating from the platform API(RSI_EGPIO_GetPin) + bool mLedStatus; }; 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 new file mode 100644 index 00000000000000..87d998e0e0ddbb --- /dev/null +++ b/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_m4.c @@ -0,0 +1,302 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "rsi_board.h" +#include "rsi_chip.h" +#include "rsi_driver.h" +#include "rsi_m4.h" +#ifdef COMMON_FLASH_EN +#include "rsi_power_save.h" +#endif + +rsi_m4ta_desc_t tx_desc[2]; +rsi_m4ta_desc_t rx_desc[2]; + +uint8_t btn0 = 1; +uint8_t btn1 = 1; + +void sl_button_on_change(uint8_t btn, uint8_t btnAction); + +uint32_t NVIC_GetIRQEnable(IRQn_Type IRQn) +{ + return ((NVIC->ICER[((uint32_t)(IRQn) >> 5)] & (1 << ((uint32_t)(IRQn) &0x1F))) ? 1 : 0); +} + +void rsi_assertion(uint16_t assertion_val, const char * string) +{ + uint16_t i; + if (assertion_val == 0) + { + for (i = 0; i < strlen(string); i++) + { +#ifdef DEBUG_UART +#ifdef DEBUG_ASSERTION + Board_UARTPutChar(string[i]); +#endif +#endif + } + + return; + } + else + { + for (i = 0; i < strlen(string); i++) + { +#ifdef DEBUG_UART +#ifdef DEBUG_ASSERTION + Board_UARTPutChar(string[i]); +#endif +#endif + } + + while (1) + ; + } +} + +void IRQ074_Handler(void) +{ + ROM_WL_rsi_m4_interrupt_isr(global_cb_p); +} + +void IRQ021_Handler(void) +{ + // TODO: Replace with rsi_delay once that is fixed + for (int i = 0; i < 10000; i++) + __asm__("nop;"); + /* clear NPSS GPIO interrupt*/ + 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 = 1; + } + // 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) + { + btn1 = 0; + sl_button_on_change(1, 1); + } + if (RSI_NPSSGPIO_GetPin(NPSS_GPIO_0)) + { + btn0 = 1; + } + if (!RSI_NPSSGPIO_GetPin(NPSS_GPIO_0) && btn0) + { + btn0 = 0; + sl_button_on_change(0, 1); + } +} + +/*==============================================*/ +/** + * @fn void rsi_raise_pkt_pending_interrupt_to_ta() + * @brief This function raises the packet pending interrupt to TA + * @param[in] none + * @param[out] none + * @return none + * @section description + * This function raises the packet pending interrupt to TA + * + * + */ +void rsi_m4_ta_interrupt_init(void) +{ + //! Unmask the interrupt + unmask_ta_interrupt(TX_PKT_TRANSFER_DONE_INTERRUPT | RX_PKT_TRANSFER_DONE_INTERRUPT); + + P2P_STATUS_REG |= M4_is_active; + + *(volatile uint32_t *) 0xE000E108 = 0x00000400; + +#ifdef RSI_WITH_OS + //! Set P2P Intr priority + NVIC_SetPriority(TASS_P2P_IRQn, TASS_P2P_INTR_PRI); +#endif + + return; +} + +void mask_ta_interrupt(uint32_t interrupt_no) +{ +#ifdef ROM_WIRELESS + ROMAPI_WL->mask_ta_interrupt(interrupt_no); +#else + api_wl->mask_ta_interrupt(interrupt_no); +#endif +} + +void unmask_ta_interrupt(uint32_t interrupt_no) +{ +#ifdef ROM_WIRELESS + ROMAPI_WL->unmask_ta_interrupt(interrupt_no); +#else + api_wl->unmask_ta_interrupt(interrupt_no); +#endif +} + +int rsi_submit_rx_pkt(void) +{ +#ifdef ROM_WIRELESS + return ROMAPI_WL->rsi_submit_rx_pkt(global_cb_p); +#else + return api_wl->rsi_submit_rx_pkt(global_cb_p); +#endif +} + +/*====================================================*/ +/** + * @fn int16_t rsi_frame_read(uint8_t *pkt_buffer) + * @brief This function is used to read the response from module. + * @param[in] uint8_t *pkt_buffer, pointer to the buffer to which packet has to read + * which is used to store the response from the module + * @param[out] none + * @return errCode + * -1 = SPI busy / Timeout + * -2 = SPI Failure + * 0 = SUCCESS + * @section description + * This is a common function to read response for all the command and data from Wi-Fi module. + */ + +rsi_pkt_t * rsi_frame_read(void) +{ +#ifdef ROM_WIRELESS + return ROMAPI_WL->rsi_frame_read(global_cb_p); +#else + return api_wl->rsi_frame_read(global_cb_p); +#endif +} + +/*====================================================*/ +/** + * @fn int16_t rsi_frame_write(rsi_frame_desc_t *uFrameDscFrame,uint8_t *payloadparam,uint16_t size_param) + * @brief Common function for all the commands. + * @param[in] uFrameDsc uFrameDscFrame, frame descriptor + * @param[in] uint8_t *payloadparam, pointer to the command payload parameter structure + * @param[in] uint16_t size_param, size of the payload for the command + * @return errCode + * -1 = SPI busy / Timeout + * -2 = SPI Failure + * 0 = SUCCESS + * @section description + * This is a common function used to process a command to the Wi-Fi module. + */ + +int16_t rsi_frame_write(rsi_frame_desc_t * uFrameDscFrame, uint8_t * payloadparam, uint16_t size_param) +{ +#ifdef ROM_WIRELESS + return ROMAPI_WL->rsi_frame_write(global_cb_p, uFrameDscFrame, payloadparam, size_param); +#else + return api_wl->rsi_frame_write(global_cb_p, uFrameDscFrame, payloadparam, size_param); +#endif +} +/*==============================================*/ +/** + * @fn void rsi_update_tx_dma_desc(uint8 skip_dma_valid) + * @brief This function updates the TX DMA descriptor address + * @param[in] skip_dma_valid + * @param[out] none + * @return none + * @section description + * This function updates the TX DMA descriptor address + * + * + */ + +void rsi_update_tx_dma_desc(uint8_t skip_dma_valid) +{ + if (!skip_dma_valid) + { +#ifdef COMMON_FLASH_EN + if (!(M4_ULP_SLP_STATUS_REG & MCU_ULP_WAKEUP)) +#endif + { + while (M4_TX_DMA_DESC_REG & DMA_DESC_REG_VALID) + ; + } + } + M4_TX_DMA_DESC_REG = (uint32_t) &tx_desc; +} + +/*==============================================*/ +/** + * @fn void rsi_update_rx_dma_desc() + * @brief This function updates the RX DMA descriptor address + * @param[in] none + * @param[out] none + * @return none + * @section description + * This function updates the RX DMA descriptor address + * + * + */ +void rsi_update_rx_dma_desc(void) +{ + M4_RX_DMA_DESC_REG = (uint32_t) &rx_desc; +} + +/*==============================================*/ +/** + * @fn void rsi_config_m4_dma_desc_on_reset() + * @brief This function updates the RX DMA and TX DMA descriptor address after reset + * @param[in] none + * @param[out] none + * @return none + * @section description + * This function updates the RX DMA and TX DMA descriptor address + * + * + */ +void rsi_config_m4_dma_desc_on_reset(void) +{ + //! Wait for TA to go to sleep + while (P2P_STATUS_REG & TA_is_active) + ; + //! Wait for TA to wakeup and should be in bootloader + while (!(P2P_STATUS_REG & TA_is_active)) + ; + //! UPdate M4 TX and RX dma descriptors + M4_TX_DMA_DESC_REG = (uint32_t) &tx_desc; + M4_RX_DMA_DESC_REG = (uint32_t) &rx_desc; +} + +/*==================================================*/ +/** + * @fn int16_t rsi_device_interrupt_status(uint8_t *int_status) + * @brief Returns the value of the Interrupt register + * @param[in] status + * @param[out] buffer full status reg value + * @return errorcode + * 0 = Success + * -2 = Reg read failure + */ +int16_t rsi_device_interrupt_status(uint8_t * int_status) +{ + + //! Check for TA active .If it is not active Buffer full status is not valid, + //! SO return fail from here + if (!(P2P_STATUS_REG & TA_is_active)) + { + return RSI_FAIL; + } + //! copy buffer full status reg value + *int_status = (uint8_t) HOST_INTR_STATUS_REG; + + return RSI_SUCCESS; +} diff --git a/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_platform_init.c b/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_platform_init.c index b2effb5997f388..1cf672c1508dc1 100644 --- a/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_platform_init.c +++ b/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_platform_init.c @@ -27,7 +27,7 @@ #define SOC_PLL_REF_FREQUENCY 32000000 /* PLL input REFERENCE clock 32MHZ */ // Note: Change this macro to required PLL frequency in hertz -#define PS4_SOC_FREQ 80000000 /* PLL out clock 80MHz */ +#define PS4_SOC_FREQ 180000000 /* PLL out clock 180MHz */ #define SWITCH_QSPI_TO_SOC_PLL #define ICACHE_DISABLE #define DEBUG_DISABLE @@ -83,6 +83,80 @@ int soc_pll_config(void) return 0; } +/*==============================================*/ +/** + * @fn void RSI_Wakeupsw_config() + * @brief This function Initializes the platform + * @param[in] none + * @param[out] none + * @return none + * @section description + * This function initializes the platform + * + */ +void RSI_Wakeupsw_config(void) +{ + /*Enable the REN*/ + RSI_NPSSGPIO_InputBufferEn(NPSS_GPIO_2, 1); + + /*Configure the NPSS GPIO mode to wake up */ + RSI_NPSSGPIO_SetPinMux(NPSS_GPIO_2, 2); + + /*Configure the NPSS GPIO direction to input */ + RSI_NPSSGPIO_SetDir(NPSS_GPIO_2, NPSS_GPIO_DIR_OUTPUT); + + /* Enables rise edge interrupt detection for UULP_VBAT_GPIO_0 */ + RSI_NPSSGPIO_SetIntLevelLowEnable(NPSS_GPIO_2_INTR); + + /* Un mask the NPSS GPIO interrupt*/ + RSI_NPSSGPIO_IntrUnMask(NPSS_GPIO_2_INTR); + + /*Select wake up sources */ + RSI_PS_SetWkpSources(GPIO_BASED_WAKEUP); + + /* clear NPSS GPIO interrupt*/ + RSI_NPSSGPIO_ClrIntr(NPSS_GPIO_2_INTR); + + /*Enable the NPSS GPIO interrupt slot*/ + NVIC_EnableIRQ(21); + + NVIC_SetPriority(21, 7); +} + +void RSI_Wakeupsw_config_gpio0(void) +{ + /*Configure the NPSS GPIO mode to wake up */ + RSI_NPSSGPIO_SetPinMux(NPSS_GPIO_0, NPSSGPIO_PIN_MUX_MODE2); + + /*Configure the NPSS GPIO direction to input */ + RSI_NPSSGPIO_SetDir(NPSS_GPIO_0, NPSS_GPIO_DIR_INPUT); + + /*Configure the NPSS GPIO interrupt polarity */ + RSI_NPSSGPIO_SetPolarity(NPSS_GPIO_0, NPSS_GPIO_INTR_HIGH); + + /*Enable the REN*/ + RSI_NPSSGPIO_InputBufferEn(NPSS_GPIO_0, 1); + + /* Set the GPIO to wake from deep sleep */ + RSI_NPSSGPIO_SetWkpGpio(NPSS_GPIO_0_INTR); + + /* Enables rise edge interrupt detection for UULP_VBAT_GPIO_0 */ + RSI_NPSSGPIO_SetIntLevelLowEnable(NPSS_GPIO_0_INTR); + + /* Un mask the NPSS GPIO interrupt*/ + RSI_NPSSGPIO_IntrUnMask(NPSS_GPIO_0_INTR); + + /*Select wake up sources */ + RSI_PS_SetWkpSources(GPIO_BASED_WAKEUP); + + /* clear NPSS GPIO interrupt*/ + RSI_NPSSGPIO_ClrIntr(NPSS_GPIO_0_INTR); + + // 21 being the NPSS_TO_MCU_GPIO_INTR_IRQn + NVIC_EnableIRQ(21); + NVIC_SetPriority(21, 7); +} + /*==============================================*/ /** * @fn void rsi_hal_board_init() @@ -98,6 +172,9 @@ void rsi_hal_board_init(void) { SystemCoreClockUpdate(); + // initialize the LED pins + RSI_Board_Init(); + /* configure clock for SiWx917 SoC */ soc_pll_config(); SILABS_LOG("%s, soc_pll_config, SystemCoreClock=%d\n", __func__, SystemCoreClock); diff --git a/examples/platform/silabs/SiWx917/SiWx917/rs911x.gni b/examples/platform/silabs/SiWx917/SiWx917/rs911x.gni index 0cca17540074ab..7730c98efc5bd8 100644 --- a/examples/platform/silabs/SiWx917/SiWx917/rs911x.gni +++ b/examples/platform/silabs/SiWx917/SiWx917/rs911x.gni @@ -14,9 +14,9 @@ rs911x_src_plat = [ "${examples_plat_dir}/SiWx917/hal/rsi_hal_mcu_timer.c", "${examples_plat_dir}/SiWx917/hal/rsi_hal_mcu_platform_init.c", + "${examples_plat_dir}/SiWx917/hal/rsi_hal_mcu_m4.c", "${wiseconnect_sdk_root}/platforms/si91x/hal/src/rsi_bootup_config.c", - "${wiseconnect_sdk_root}/platforms/si91x/hal/src/rsi_hal_mcu_m4.c", "${wiseconnect_sdk_root}/platforms/si91x/hal/src/rsi_hal_mcu_m4_rom.c", "${wiseconnect_sdk_root}/platforms/si91x/hal/src/rsi_hal_mcu_interrupt.c", ] diff --git a/examples/platform/silabs/SiWx917/init_ccpPlatform.cpp b/examples/platform/silabs/SiWx917/init_ccpPlatform.cpp index 0d5bb78bea9e7c..3723d72f090c5b 100644 --- a/examples/platform/silabs/SiWx917/init_ccpPlatform.cpp +++ b/examples/platform/silabs/SiWx917/init_ccpPlatform.cpp @@ -33,9 +33,16 @@ extern "C" { void initAntenna(void); +/* GPIO button config */ +void RSI_Wakeupsw_config(void); +void RSI_Wakeupsw_config_gpio0(void); + void init_ccpPlatform(void) { + RSI_Wakeupsw_config(); + + RSI_Wakeupsw_config_gpio0(); #if SILABS_LOG_ENABLED silabsInitLog(); #endif diff --git a/examples/window-app/silabs/SiWx917/BUILD.gn b/examples/window-app/silabs/SiWx917/BUILD.gn index 007831481970b7..1aa89a1e00be5a 100644 --- a/examples/window-app/silabs/SiWx917/BUILD.gn +++ b/examples/window-app/silabs/SiWx917/BUILD.gn @@ -193,7 +193,7 @@ efr32_executable("window_app") { ] if (use_wstk_leds) { - #sources += [ "${examples_plat_dir}/LEDWidget.cpp" ] + sources += [ "${examples_plat_dir}/LEDWidget.cpp" ] } if (chip_build_libshell || enable_openthread_cli || use_wf200 || use_rs911x) { diff --git a/examples/window-app/silabs/SiWx917/include/WindowAppImpl.h b/examples/window-app/silabs/SiWx917/include/WindowAppImpl.h index 86158e3d4da14b..a486de4f5dcb08 100644 --- a/examples/window-app/silabs/SiWx917/include/WindowAppImpl.h +++ b/examples/window-app/silabs/SiWx917/include/WindowAppImpl.h @@ -21,7 +21,6 @@ #ifdef ENABLE_WSTK_LEDS #include "LEDWidget.h" -#include "sl_simple_led_instances.h" #endif // ENABLE_WSTK_LEDS #include diff --git a/examples/window-app/silabs/SiWx917/src/WindowAppImpl.cpp b/examples/window-app/silabs/SiWx917/src/WindowAppImpl.cpp index 8cb6774f9d8da4..a0582a4dd6e4f8 100644 --- a/examples/window-app/silabs/SiWx917/src/WindowAppImpl.cpp +++ b/examples/window-app/silabs/SiWx917/src/WindowAppImpl.cpp @@ -32,9 +32,6 @@ #include #endif // QR_CODE_ENABLED -#ifdef ENABLE_WSTK_LEDS -#include -#endif // ENABLE_WSTK_LEDS extern "C" void sl_button_on_change(); #ifdef SL_WIFI @@ -58,8 +55,8 @@ SilabsLCD slLCD; using namespace chip::app::Clusters::WindowCovering; using namespace chip; using namespace ::chip::DeviceLayer; -#define APP_STATE_LED &sl_led_led0 -#define APP_ACTION_LED &sl_led_led1 +#define APP_STATE_LED 0 +#define APP_ACTION_LED 1 #ifdef SL_WIFI chip::app::Clusters::NetworkCommissioning::Instance @@ -207,7 +204,6 @@ CHIP_ERROR WindowAppImpl::Init() // Initialize LEDs #ifdef ENABLE_WSTK_LEDS - LEDWidget::InitGpio(); mStatusLED.Init(APP_STATE_LED); mActionLED.Init(APP_ACTION_LED); #endif // ENABLE_WSTK_LEDS diff --git a/src/platform/silabs/SiWx917/bluetooth/rsi_ble_config.h b/src/platform/silabs/SiWx917/bluetooth/rsi_ble_config.h index 7849747dd28152..078a050f470cc6 100644 --- a/src/platform/silabs/SiWx917/bluetooth/rsi_ble_config.h +++ b/src/platform/silabs/SiWx917/bluetooth/rsi_ble_config.h @@ -104,8 +104,10 @@ #define RSI_BLE_ADV_DIR_ADDR_TYPE LE_PUBLIC_ADDRESS #define RSI_BLE_ADV_DIR_ADDR "00:15:83:6A:64:17" -#define RSI_BLE_ADV_INT_MIN 0x100 -#define RSI_BLE_ADV_INT_MAX 0x200 +//! Reduced the BLE adv interval time to match with EFR BLE +#define RSI_BLE_ADV_INT_MIN 0x20 +#define RSI_BLE_ADV_INT_MAX 0x20 + #define RSI_BLE_ADV_CHANNEL_MAP 0x07 //! Advertise status diff --git a/third_party/silabs/SiWx917_sdk.gni b/third_party/silabs/SiWx917_sdk.gni index 7bcc4638879ca6..c01bef488d55e1 100644 --- a/third_party/silabs/SiWx917_sdk.gni +++ b/third_party/silabs/SiWx917_sdk.gni @@ -145,6 +145,11 @@ template("efr32_sdk") { defines += board_defines + # Enabling led interface + if (use_wstk_leds) { + defines += [ "ENABLE_WSTK_LEDS" ] + } + if (defined(invoker.enable_sleepy_device)) { if (invoker.enable_sleepy_device) { defines += [