From fee4bc3edcd4afa89cbcb9bf44ffc3f918325c7e Mon Sep 17 00:00:00 2001 From: Sarthak Shaha Date: Thu, 21 Mar 2024 14:44:36 -0400 Subject: [PATCH] minor fixes --- examples/platform/silabs/MatterConfig.cpp | 29 +++++++++++------------ examples/platform/silabs/MatterConfig.h | 2 +- examples/platform/silabs/main.cpp | 2 +- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/examples/platform/silabs/MatterConfig.cpp b/examples/platform/silabs/MatterConfig.cpp index 25b2b19c90b272..d0d19ec3082e70 100644 --- a/examples/platform/silabs/MatterConfig.cpp +++ b/examples/platform/silabs/MatterConfig.cpp @@ -98,7 +98,6 @@ using namespace ::chip::Credentials::Silabs; using namespace chip::DeviceLayer::Silabs; TaskHandle_t main_Task; -void application_start(void * unused); volatile int apperror_cnt; static chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider; @@ -156,20 +155,6 @@ CHIP_ERROR SilabsMatterConfig::InitOpenThread(void) } #endif // CHIP_ENABLE_OPENTHREAD -void SilabsMatterConfig::app_init() -{ - GetPlatform().Init(); - - xTaskCreate(application_start, "main_task", MAIN_TASK_STACK_SIZE, NULL, MAIN_TASK_PRIORITY, &main_Task); - SILABS_LOG("Starting scheduler"); - GetPlatform().StartScheduler(); - - // Should never get here. - chip::Platform::MemoryShutdown(); - SILABS_LOG("Start Scheduler Failed"); - appError(CHIP_ERROR_INTERNAL); -} - void application_start(void * unused) { CHIP_ERROR err = SilabsMatterConfig::InitMatter(BLE_DEV_NAME); @@ -192,6 +177,20 @@ void application_start(void * unused) vTaskDelete(main_Task); } +void SilabsMatterConfig::AppInit() +{ + GetPlatform().Init(); + + xTaskCreate(application_start, "main_task", MAIN_TASK_STACK_SIZE, NULL, MAIN_TASK_PRIORITY, &main_Task); + SILABS_LOG("Starting scheduler"); + GetPlatform().StartScheduler(); + + // Should never get here. + chip::Platform::MemoryShutdown(); + SILABS_LOG("Start Scheduler Failed"); + appError(CHIP_ERROR_INTERNAL); +} + #if SILABS_OTA_ENABLED void SilabsMatterConfig::InitOTARequestorHandler(System::Layer * systemLayer, void * appState) { diff --git a/examples/platform/silabs/MatterConfig.h b/examples/platform/silabs/MatterConfig.h index db0da27e20559e..4725e02d36e601 100644 --- a/examples/platform/silabs/MatterConfig.h +++ b/examples/platform/silabs/MatterConfig.h @@ -26,7 +26,7 @@ class SilabsMatterConfig { public: static CHIP_ERROR InitMatter(const char * appName); - static void app_init(); + static void AppInit(); private: static CHIP_ERROR InitOpenThread(void); diff --git a/examples/platform/silabs/main.cpp b/examples/platform/silabs/main.cpp index 5dbe94fbb4dfaa..d01e27f17847f5 100644 --- a/examples/platform/silabs/main.cpp +++ b/examples/platform/silabs/main.cpp @@ -27,5 +27,5 @@ int main(void) // Initialize the application. For example, create periodic timer(s) or // task(s) if the kernel is present. - SilabsMatterConfig::app_init(); + SilabsMatterConfig::AppInit(); }