Skip to content

Commit

Permalink
Migrate our AppTask files to use cmsisos abtraction api rather than f…
Browse files Browse the repository at this point in the history
…reertos (#32690)
  • Loading branch information
jmartinez-silabs authored Mar 26, 2024
1 parent 657fa28 commit 4b26ef4
Show file tree
Hide file tree
Showing 18 changed files with 45 additions and 55 deletions.
3 changes: 1 addition & 2 deletions examples/chef/silabs/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@

#include "AppEvent.h"
#include "BaseApplication.h"
#include "FreeRTOS.h"
#include "timers.h" // provides FreeRTOS timer support
#include <ble/BLEEndPoint.h>
#include <cmsis_os2.h>
#include <lib/core/CHIPError.h>
#include <platform/CHIPDeviceLayer.h>

Expand Down
8 changes: 4 additions & 4 deletions examples/chef/silabs/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ CHIP_ERROR AppTask::StartAppTask()
void AppTask::AppTaskMain(void * pvParameter)
{
AppEvent event;
QueueHandle_t sAppEventQueue = *(static_cast<QueueHandle_t *>(pvParameter));
osMessageQueueId_t sAppEventQueue = *(static_cast<osMessageQueueId_t *>(pvParameter));

CHIP_ERROR err = sAppTask.Init();
if (err != CHIP_NO_ERROR)
Expand All @@ -94,11 +94,11 @@ void AppTask::AppTaskMain(void * pvParameter)

while (true)
{
BaseType_t eventReceived = xQueueReceive(sAppEventQueue, &event, pdMS_TO_TICKS(10));
while (eventReceived == pdTRUE)
osStatus_t eventReceived = osMessageQueueGet(sAppEventQueue, &event, NULL, osWaitForever);
while (eventReceived == osOK)
{
sAppTask.DispatchEvent(&event);
eventReceived = xQueueReceive(sAppEventQueue, &event, 0);
eventReceived = osMessageQueueGet(sAppEventQueue, &event, NULL, 0);
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions examples/light-switch-app/silabs/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@

#include "AppEvent.h"
#include "BaseApplication.h"
#include "FreeRTOS.h"
#include "timers.h" // provides FreeRTOS timer support
#include <ble/BLEEndPoint.h>
#include <cmsis_os2.h>
#include <lib/core/CHIPError.h>
#include <platform/CHIPDeviceLayer.h>

Expand Down
8 changes: 4 additions & 4 deletions examples/light-switch-app/silabs/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ CHIP_ERROR AppTask::StartAppTask()
void AppTask::AppTaskMain(void * pvParameter)
{
AppEvent event;
QueueHandle_t sAppEventQueue = *(static_cast<QueueHandle_t *>(pvParameter));
osMessageQueueId_t sAppEventQueue = *(static_cast<osMessageQueueId_t *>(pvParameter));

CHIP_ERROR err = sAppTask.Init();
if (err != CHIP_NO_ERROR)
Expand All @@ -121,11 +121,11 @@ void AppTask::AppTaskMain(void * pvParameter)
SILABS_LOG("App Task started");
while (true)
{
BaseType_t eventReceived = xQueueReceive(sAppEventQueue, &event, portMAX_DELAY);
while (eventReceived == pdTRUE)
osStatus_t eventReceived = osMessageQueueGet(sAppEventQueue, &event, NULL, osWaitForever);
while (eventReceived == osOK)
{
sAppTask.DispatchEvent(&event);
eventReceived = xQueueReceive(sAppEventQueue, &event, 0);
eventReceived = osMessageQueueGet(sAppEventQueue, &event, NULL, 0);
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions examples/lighting-app/silabs/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@

#include "AppEvent.h"
#include "BaseApplication.h"
#include "FreeRTOS.h"
#include "LightingManager.h"
#include "timers.h" // provides FreeRTOS timer support
#include <ble/BLEEndPoint.h>
#include <cmsis_os2.h>
#include <lib/core/CHIPError.h>
#include <platform/CHIPDeviceLayer.h>

Expand Down
8 changes: 4 additions & 4 deletions examples/lighting-app/silabs/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ CHIP_ERROR AppTask::StartAppTask()
void AppTask::AppTaskMain(void * pvParameter)
{
AppEvent event;
QueueHandle_t sAppEventQueue = *(static_cast<QueueHandle_t *>(pvParameter));
osMessageQueueId_t sAppEventQueue = *(static_cast<osMessageQueueId_t *>(pvParameter));

CHIP_ERROR err = sAppTask.Init();
if (err != CHIP_NO_ERROR)
Expand All @@ -134,11 +134,11 @@ void AppTask::AppTaskMain(void * pvParameter)

while (true)
{
BaseType_t eventReceived = xQueueReceive(sAppEventQueue, &event, portMAX_DELAY);
while (eventReceived == pdTRUE)
osStatus_t eventReceived = osMessageQueueGet(sAppEventQueue, &event, NULL, osWaitForever);
while (eventReceived == osOK)
{
sAppTask.DispatchEvent(&event);
eventReceived = xQueueReceive(sAppEventQueue, &event, 0);
eventReceived = osMessageQueueGet(sAppEventQueue, &event, NULL, 0);
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions examples/lit-icd-app/silabs/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@

#include "AppEvent.h"
#include "BaseApplication.h"
#include "FreeRTOS.h"
#include "timers.h" // provides FreeRTOS timer support
#include <ble/BLEEndPoint.h>
#include <cmsis_os2.h>
#include <lib/core/CHIPError.h>
#include <platform/CHIPDeviceLayer.h>

Expand Down
8 changes: 4 additions & 4 deletions examples/lit-icd-app/silabs/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ CHIP_ERROR AppTask::StartAppTask()
void AppTask::AppTaskMain(void * pvParameter)
{
AppEvent event;
QueueHandle_t sAppEventQueue = *(static_cast<QueueHandle_t *>(pvParameter));
osMessageQueueId_t sAppEventQueue = *(static_cast<osMessageQueueId_t *>(pvParameter));

CHIP_ERROR err = sAppTask.Init();
if (err != CHIP_NO_ERROR)
Expand All @@ -110,11 +110,11 @@ void AppTask::AppTaskMain(void * pvParameter)
SILABS_LOG("App Task started");
while (true)
{
BaseType_t eventReceived = xQueueReceive(sAppEventQueue, &event, portMAX_DELAY);
while (eventReceived == pdTRUE)
osStatus_t eventReceived = osMessageQueueGet(sAppEventQueue, &event, NULL, osWaitForever);
while (eventReceived == osOK)
{
sAppTask.DispatchEvent(&event);
eventReceived = xQueueReceive(sAppEventQueue, &event, 0);
eventReceived = osMessageQueueGet(sAppEventQueue, &event, NULL, 0);
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions examples/lock-app/silabs/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@

#include "AppEvent.h"
#include "BaseApplication.h"
#include "FreeRTOS.h"
#include "LockManager.h"
#include "timers.h" // provides FreeRTOS timer support
#include <ble/BLEEndPoint.h>
#include <cmsis_os2.h>
#include <lib/core/CHIPError.h>
#include <platform/CHIPDeviceLayer.h>

Expand Down
8 changes: 4 additions & 4 deletions examples/lock-app/silabs/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ CHIP_ERROR AppTask::StartAppTask()
void AppTask::AppTaskMain(void * pvParameter)
{
AppEvent event;
QueueHandle_t sAppEventQueue = *(static_cast<QueueHandle_t *>(pvParameter));
osMessageQueueId_t sAppEventQueue = *(static_cast<osMessageQueueId_t *>(pvParameter));

CHIP_ERROR err = sAppTask.Init();
if (err != CHIP_NO_ERROR)
Expand All @@ -230,11 +230,11 @@ void AppTask::AppTaskMain(void * pvParameter)

while (true)
{
BaseType_t eventReceived = xQueueReceive(sAppEventQueue, &event, portMAX_DELAY);
while (eventReceived == pdTRUE)
osStatus_t eventReceived = osMessageQueueGet(sAppEventQueue, &event, NULL, osWaitForever);
while (eventReceived == osOK)
{
sAppTask.DispatchEvent(&event);
eventReceived = xQueueReceive(sAppEventQueue, &event, 0);
eventReceived = osMessageQueueGet(sAppEventQueue, &event, NULL, 0);
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions examples/pump-app/silabs/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@

#include "AppEvent.h"
#include "BaseApplication.h"
#include "FreeRTOS.h"
#include "PumpManager.h"
#include "timers.h" // provides FreeRTOS timer support
#include <ble/BLEEndPoint.h>
#include <cmsis_os2.h>
#include <lib/core/CHIPError.h>
#include <platform/CHIPDeviceLayer.h>

Expand Down
8 changes: 4 additions & 4 deletions examples/pump-app/silabs/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ CHIP_ERROR AppTask::StartAppTask()
void AppTask::AppTaskMain(void * pvParameter)
{
AppEvent event;
QueueHandle_t sAppEventQueue = *(static_cast<QueueHandle_t *>(pvParameter));
osMessageQueueId_t sAppEventQueue = *(static_cast<osMessageQueueId_t *>(pvParameter));

CHIP_ERROR err = sAppTask.Init();
if (err != CHIP_NO_ERROR)
Expand All @@ -142,11 +142,11 @@ void AppTask::AppTaskMain(void * pvParameter)

while (true)
{
BaseType_t eventReceived = xQueueReceive(sAppEventQueue, &event, portMAX_DELAY);
while (eventReceived == pdTRUE)
osStatus_t eventReceived = osMessageQueueGet(sAppEventQueue, &event, NULL, osWaitForever);
while (eventReceived == osOK)
{
sAppTask.DispatchEvent(&event);
eventReceived = xQueueReceive(sAppEventQueue, &event, 0);
eventReceived = osMessageQueueGet(sAppEventQueue, &event, NULL, 0);
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions examples/smoke-co-alarm-app/silabs/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@

#include "AppEvent.h"
#include "BaseApplication.h"
#include "FreeRTOS.h"
#include "SmokeCoAlarmManager.h"
#include "timers.h" // provides FreeRTOS timer support
#include <ble/BLEEndPoint.h>
#include <cmsis_os2.h>
#include <lib/core/CHIPError.h>
#include <platform/CHIPDeviceLayer.h>

Expand Down
8 changes: 4 additions & 4 deletions examples/smoke-co-alarm-app/silabs/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ CHIP_ERROR AppTask::StartAppTask()
void AppTask::AppTaskMain(void * pvParameter)
{
AppEvent event;
QueueHandle_t sAppEventQueue = *(static_cast<QueueHandle_t *>(pvParameter));
osMessageQueueId_t sAppEventQueue = *(static_cast<osMessageQueueId_t *>(pvParameter));

CHIP_ERROR err = sAppTask.Init();
if (err != CHIP_NO_ERROR)
Expand All @@ -129,11 +129,11 @@ void AppTask::AppTaskMain(void * pvParameter)

while (true)
{
BaseType_t eventReceived = xQueueReceive(sAppEventQueue, &event, portMAX_DELAY);
while (eventReceived == pdTRUE)
osStatus_t eventReceived = osMessageQueueGet(sAppEventQueue, &event, NULL, osWaitForever);
while (eventReceived == osOK)
{
sAppTask.DispatchEvent(&event);
eventReceived = xQueueReceive(sAppEventQueue, &event, 0);
eventReceived = osMessageQueueGet(sAppEventQueue, &event, NULL, 0);
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions examples/thermostat/silabs/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@

#include "AppEvent.h"
#include "BaseApplication.h"
#include "FreeRTOS.h"
#include "SensorManager.h"
#include "TemperatureManager.h"
#include "timers.h" // provides FreeRTOS timer support
#include <ble/BLEEndPoint.h>
#include <cmsis_os2.h>
#include <lib/core/CHIPError.h>
#include <platform/CHIPDeviceLayer.h>

Expand Down
8 changes: 4 additions & 4 deletions examples/thermostat/silabs/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ CHIP_ERROR AppTask::StartAppTask()
void AppTask::AppTaskMain(void * pvParameter)
{
AppEvent event;
QueueHandle_t sAppEventQueue = *(static_cast<QueueHandle_t *>(pvParameter));
osMessageQueueId_t sAppEventQueue = *(static_cast<osMessageQueueId_t *>(pvParameter));

CHIP_ERROR err = sAppTask.Init();
if (err != CHIP_NO_ERROR)
Expand All @@ -129,11 +129,11 @@ void AppTask::AppTaskMain(void * pvParameter)
SILABS_LOG("App Task started");
while (true)
{
BaseType_t eventReceived = xQueueReceive(sAppEventQueue, &event, portMAX_DELAY);
while (eventReceived == pdTRUE)
osStatus_t eventReceived = osMessageQueueGet(sAppEventQueue, &event, NULL, osWaitForever);
while (eventReceived == osOK)
{
sAppTask.DispatchEvent(&event);
eventReceived = xQueueReceive(sAppEventQueue, &event, 0);
eventReceived = osMessageQueueGet(sAppEventQueue, &event, NULL, 0);
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions examples/window-app/silabs/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@
#include <stdint.h>

#include "BaseApplication.h"
#include "FreeRTOS.h"
#include "timers.h" // provides FreeRTOS timer support
#include <ble/BLEEndPoint.h>
#include <cmsis_os2.h>
#include <lib/core/CHIPError.h>
#include <platform/CHIPDeviceLayer.h>

Expand Down
9 changes: 4 additions & 5 deletions examples/window-app/silabs/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,8 @@ CHIP_ERROR AppTask::StartAppTask()

void AppTask::AppTaskMain(void * pvParameter)
{

AppEvent event;
QueueHandle_t sAppEventQueue = *(static_cast<QueueHandle_t *>(pvParameter));
osMessageQueueId_t sAppEventQueue = *(static_cast<osMessageQueueId_t *>(pvParameter));

CHIP_ERROR err = sAppTask.Init();
if (err != CHIP_NO_ERROR)
Expand All @@ -102,11 +101,11 @@ void AppTask::AppTaskMain(void * pvParameter)

while (true)
{
BaseType_t eventReceived = xQueueReceive(sAppEventQueue, &event, portMAX_DELAY);
while (eventReceived == pdTRUE)
osStatus_t eventReceived = osMessageQueueGet(sAppEventQueue, &event, NULL, osWaitForever);
while (eventReceived == osOK)
{
sAppTask.DispatchEvent(&event);
eventReceived = xQueueReceive(sAppEventQueue, &event, 0);
eventReceived = osMessageQueueGet(sAppEventQueue, &event, NULL, 0);
}
}
}

0 comments on commit 4b26ef4

Please sign in to comment.