Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarthak-Shaha committed Mar 21, 2024
1 parent b4e26c0 commit fee4bc3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
29 changes: 14 additions & 15 deletions examples/platform/silabs/MatterConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand All @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/silabs/MatterConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/silabs/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

0 comments on commit fee4bc3

Please sign in to comment.