diff --git a/config/telink/chip-module/Kconfig.defaults b/config/telink/chip-module/Kconfig.defaults index 703bc8262f7f78..fea64941d3474e 100644 --- a/config/telink/chip-module/Kconfig.defaults +++ b/config/telink/chip-module/Kconfig.defaults @@ -158,6 +158,9 @@ endchoice if BOARD_TLSR9528A_RETENTION || BOARD_TLSR9518ADK80D_RETENTION config BOARD_TLSR9X_NON_RETENTION_RAM_CODE default y if PM + +config TELINK_B9x_MATTER_RETENTION_LAYOUT + default y if PM endif # Config dynamic interrupts to have posibility to switch between BLE/Thread radio drivers diff --git a/examples/light-switch-app/telink/prj.conf b/examples/light-switch-app/telink/prj.conf index 9d986655de9c3f..184e824904c519 100755 --- a/examples/light-switch-app/telink/prj.conf +++ b/examples/light-switch-app/telink/prj.conf @@ -56,9 +56,3 @@ CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE=n # Enable Power Management CONFIG_PM=y -CONFIG_TELINK_B9x_MATTER_RETENTION_LAYOUT=y -CONFIG_CHIP_ICD_SLOW_POLL_INTERVAL=10000 -CONFIG_CHIP_ICD_FAST_POLLING_INTERVAL=2000 -CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL=2000 -CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL=2001 -CONFIG_CHIP_ICD_ACTIVE_MODE_THRESHOLD=2000 diff --git a/examples/platform/telink/common/include/AppTaskCommon.h b/examples/platform/telink/common/include/AppTaskCommon.h index 7204df2ba4b7a9..c4d2fd4ed51b05 100644 --- a/examples/platform/telink/common/include/AppTaskCommon.h +++ b/examples/platform/telink/common/include/AppTaskCommon.h @@ -99,7 +99,7 @@ class AppTaskCommon static void StartBleAdvHandler(AppEvent * aEvent); #endif -#if APP_USE_THREAD_START_BUTTON +#if APP_USE_THREAD_START_BUTTON || !CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE static void StartThreadButtonEventHandler(void); static void StartThreadHandler(AppEvent * aEvent); #endif diff --git a/examples/platform/telink/common/src/AppTaskCommon.cpp b/examples/platform/telink/common/src/AppTaskCommon.cpp index 7a1a537d1110df..0a388c238ac022 100644 --- a/examples/platform/telink/common/src/AppTaskCommon.cpp +++ b/examples/platform/telink/common/src/AppTaskCommon.cpp @@ -59,7 +59,7 @@ const struct gpio_dt_spec sBleStartButtonDt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_ #if APP_USE_THREAD_START_BUTTON const struct gpio_dt_spec sThreadStartButtonDt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_3), gpios); #endif -#if APP_USE_EXAMPLE_START_BUTTON +#if APP_USE_EXAMPLE_START_BUTTON const struct gpio_dt_spec sExampleActionButtonDt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_4), gpios); #endif #else @@ -145,11 +145,13 @@ class AppCallbacks : public AppDelegate void OnCommissioningSessionStarted() override { isComissioningStarted = true; } void OnCommissioningSessionStopped() override { isComissioningStarted = false; } void OnCommissioningSessionEstablishmentError(CHIP_ERROR err) override { sIsCommissioningFailed = true; } +#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE void OnCommissioningWindowClosed() override { if (!isComissioningStarted) chip::DeviceLayer::Internal::BLEMgr().Shutdown(); } +#endif }; AppCallbacks sCallbacks; @@ -245,6 +247,10 @@ CHIP_ERROR AppTaskCommon::StartApp(void) AppEvent event = {}; +#if !CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE + StartThreadButtonEventHandler(); +#endif + while (true) { GetEvent(&event); @@ -634,7 +640,7 @@ void AppTaskCommon::FactoryResetTimerEventHandler(AppEvent * aEvent) LOG_INF("Factory Reset Trigger Counter is cleared"); } -#if APP_USE_THREAD_START_BUTTON +#if APP_USE_THREAD_START_BUTTON || !CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE void AppTaskCommon::StartThreadButtonEventHandler(void) { AppEvent event; @@ -651,8 +657,13 @@ void AppTaskCommon::StartThreadHandler(AppEvent * aEvent) if (!chip::DeviceLayer::ConnectivityMgr().IsThreadProvisioned()) { // Switch context from BLE to Thread +#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE Internal::BLEManagerImpl sInstance; sInstance.SwitchToIeee802154(); +#else + ThreadStackMgrImpl().SetRadioBlocked(false); + ThreadStackMgrImpl().SetThreadEnabled(true); +#endif StartDefaultThreadNetwork(); } else