Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Silabs] EFR32 common files modification, logging and some extra changes #23751

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/light-switch-app/efr32/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
extern "C" {
#endif

void efr32InitLog(void);
void silabsInitLog(void);

void efr32Log(const char * aFormat, ...);
#define EFR32_LOG(...) efr32Log(__VA_ARGS__);
#define SILABS_LOG(...) efr32Log(__VA_ARGS__);
void appError(int err);

#ifdef __cplusplus
Expand Down
8 changes: 4 additions & 4 deletions examples/light-switch-app/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,15 @@ CHIP_ERROR AppTask::Init()
err = BaseApplication::Init(&gIdentify);
if (err != CHIP_NO_ERROR)
{
EFR32_LOG("BaseApplication::Init() failed");
SILABS_LOG("BaseApplication::Init() failed");
selissia marked this conversation as resolved.
Show resolved Hide resolved
appError(err);
}

// Configure Bindings - TODO ERROR PROCESSING
err = InitBindingHandler();
if (err != CHIP_NO_ERROR)
{
EFR32_LOG("InitBindingHandler() failed");
SILABS_LOG("InitBindingHandler() failed");
appError(err);
}

Expand All @@ -185,15 +185,15 @@ void AppTask::AppTaskMain(void * pvParameter)
CHIP_ERROR err = sAppTask.Init();
if (err != CHIP_NO_ERROR)
{
EFR32_LOG("AppTask.Init() failed");
SILABS_LOG("AppTask.Init() failed");
appError(err);
}

#if !(defined(CHIP_DEVICE_CONFIG_ENABLE_SED) && CHIP_DEVICE_CONFIG_ENABLE_SED)
sAppTask.StartStatusLEDTimer();
#endif

EFR32_LOG("App Task started");
SILABS_LOG("App Task started");
while (true)
{
BaseType_t eventReceived = xQueueReceive(sAppEventQueue, &event, portMAX_DELAY);
Expand Down
10 changes: 5 additions & 5 deletions examples/light-switch-app/efr32/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <credentials/DeviceAttestationCredsProvider.h>
#include <matter_config.h>
#ifdef EFR32_ATTESTATION_CREDENTIALS
#include <examples/platform/efr32/EFR32DeviceAttestationCreds.h>
#include <examples/platform/silabs/SilabsDeviceAttestationCreds.h>
#else
#include <credentials/examples/DeviceAttestationCredsExample.h>
#endif
Expand Down Expand Up @@ -59,22 +59,22 @@ int main(void)
chip::DeviceLayer::PlatformMgr().LockChipStack();
// Initialize device attestation config
#ifdef EFR32_ATTESTATION_CREDENTIALS
SetDeviceAttestationCredentialsProvider(EFR32::GetEFR32DacProvider());
SetDeviceAttestationCredentialsProvider(Silabs::GetSilabsDacProvider());
#else
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
#endif
chip::DeviceLayer::PlatformMgr().UnlockChipStack();

EFR32_LOG("Starting App Task");
SILABS_LOG("Starting App Task");
if (AppTask::GetAppTask().StartAppTask() != CHIP_NO_ERROR)
appError(CHIP_ERROR_INTERNAL);

EFR32_LOG("Starting FreeRTOS scheduler");
SILABS_LOG("Starting FreeRTOS scheduler");
sl_system_kernel_start();

// Should never get here.
chip::Platform::MemoryShutdown();
EFR32_LOG("vTaskStartScheduler() failed");
SILABS_LOG("vTaskStartScheduler() failed");
appError(CHIP_ERROR_INTERNAL);
}

Expand Down
18 changes: 9 additions & 9 deletions examples/lighting-app/silabs/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,14 @@ CHIP_ERROR AppTask::Init()
err = BaseApplication::Init(&gIdentify);
if (err != CHIP_NO_ERROR)
{
EFR32_LOG("BaseApplication::Init() failed");
SILABS_LOG("BaseApplication::Init() failed");
appError(err);
}

err = LightMgr().Init();
if (err != CHIP_NO_ERROR)
{
EFR32_LOG("LightMgr::Init() failed");
SILABS_LOG("LightMgr::Init() failed");
appError(err);
}

Expand All @@ -175,15 +175,15 @@ void AppTask::AppTaskMain(void * pvParameter)
CHIP_ERROR err = sAppTask.Init();
if (err != CHIP_NO_ERROR)
{
EFR32_LOG("AppTask.Init() failed");
SILABS_LOG("AppTask.Init() failed");
appError(err);
}

#if !(defined(CHIP_DEVICE_CONFIG_ENABLE_SED) && CHIP_DEVICE_CONFIG_ENABLE_SED)
sAppTask.StartStatusLEDTimer();
#endif

EFR32_LOG("App Task started");
SILABS_LOG("App Task started");

while (true)
{
Expand Down Expand Up @@ -242,7 +242,7 @@ void AppTask::LightActionEventHandler(AppEvent * aEvent)

if (!initiated)
{
EFR32_LOG("Action is already in progress or active.");
SILABS_LOG("Action is already in progress or active.");
}
}
}
Expand Down Expand Up @@ -274,7 +274,7 @@ void AppTask::ActionInitiated(LightingManager::Action_t aAction, int32_t aActor)
{
// Action initiated, update the light led
bool lightOn = aAction == LightingManager::ON_ACTION;
EFR32_LOG("Turning light %s", (lightOn) ? "On" : "Off")
SILABS_LOG("Turning light %s", (lightOn) ? "On" : "Off")

#ifdef ENABLE_WSTK_LEDS
sLightLED.Set(lightOn);
Expand All @@ -295,11 +295,11 @@ void AppTask::ActionCompleted(LightingManager::Action_t aAction)
// action has been completed bon the light
if (aAction == LightingManager::ON_ACTION)
{
EFR32_LOG("Light ON")
SILABS_LOG("Light ON")
}
else if (aAction == LightingManager::OFF_ACTION)
{
EFR32_LOG("Light OFF")
SILABS_LOG("Light OFF")
}

if (sAppTask.mSyncClusterToButtonAction)
Expand Down Expand Up @@ -328,6 +328,6 @@ void AppTask::UpdateClusterState(intptr_t context)

if (status != EMBER_ZCL_STATUS_SUCCESS)
{
EFR32_LOG("ERR: updating on/off %x", status);
SILABS_LOG("ERR: updating on/off %x", status);
}
}
14 changes: 7 additions & 7 deletions examples/lighting-app/silabs/efr32/src/LightingManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ CHIP_ERROR LightingManager::Init()

if (sLightTimer == NULL)
{
EFR32_LOG("sLightTimer timer create failed");
SILABS_LOG("sLightTimer timer create failed");
return APP_ERROR_CREATE_TIMER_FAILED;
}

Expand Down Expand Up @@ -156,7 +156,7 @@ void LightingManager::StartTimer(uint32_t aTimeoutMs)
{
if (xTimerIsTimerActive(sLightTimer))
{
EFR32_LOG("app timer already started!");
SILABS_LOG("app timer already started!");
CancelTimer();
}

Expand All @@ -165,7 +165,7 @@ void LightingManager::StartTimer(uint32_t aTimeoutMs)
// cannot immediately be sent to the timer command queue.
if (xTimerChangePeriod(sLightTimer, (aTimeoutMs / portTICK_PERIOD_MS), 100) != pdPASS)
{
EFR32_LOG("sLightTimer timer start() failed");
SILABS_LOG("sLightTimer timer start() failed");
appError(APP_ERROR_START_TIMER_FAILED);
}
}
Expand All @@ -174,7 +174,7 @@ void LightingManager::CancelTimer(void)
{
if (xTimerStop(sLightTimer, 0) == pdFAIL)
{
EFR32_LOG("sLightTimer stop() failed");
SILABS_LOG("sLightTimer stop() failed");
appError(APP_ERROR_STOP_TIMER_FAILED);
}
}
Expand Down Expand Up @@ -218,7 +218,7 @@ void LightingManager::AutoTurnOffTimerEventHandler(AppEvent * aEvent)

light->mAutoTurnOffTimerArmed = false;

EFR32_LOG("Auto Turn Off has been triggered!");
SILABS_LOG("Auto Turn Off has been triggered!");

light->InitiateAction(actor, OFF_ACTION);
}
Expand All @@ -236,7 +236,7 @@ void LightingManager::OffEffectTimerEventHandler(AppEvent * aEvent)

light->mOffEffectArmed = false;

EFR32_LOG("OffEffect completed");
SILABS_LOG("OffEffect completed");

light->InitiateAction(actor, OFF_ACTION);
}
Expand Down Expand Up @@ -272,7 +272,7 @@ void LightingManager::ActuatorMovementTimerEventHandler(AppEvent * aEvent)

light->mAutoTurnOffTimerArmed = true;

EFR32_LOG("Auto Turn off enabled. Will be triggered in %u seconds", light->mAutoTurnOffDuration);
SILABS_LOG("Auto Turn off enabled. Will be triggered in %u seconds", light->mAutoTurnOffDuration);
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions examples/lighting-app/silabs/efr32/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <credentials/DeviceAttestationCredsProvider.h>
#include <matter_config.h>
#ifdef EFR32_ATTESTATION_CREDENTIALS
#include <examples/platform/efr32/EFR32DeviceAttestationCreds.h>
#include <examples/platform/silabs/SilabsDeviceAttestationCreds.h>
#else
#include <credentials/examples/DeviceAttestationCredsExample.h>
#endif
Expand Down Expand Up @@ -59,22 +59,22 @@ int main(void)
chip::DeviceLayer::PlatformMgr().LockChipStack();
// Initialize device attestation config
#ifdef EFR32_ATTESTATION_CREDENTIALS
SetDeviceAttestationCredentialsProvider(EFR32::GetEFR32DacProvider());
SetDeviceAttestationCredentialsProvider(Silabs::GetSilabsDacProvider());
#else
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
#endif
chip::DeviceLayer::PlatformMgr().UnlockChipStack();

EFR32_LOG("Starting App Task");
SILABS_LOG("Starting App Task");
if (AppTask::GetAppTask().StartAppTask() != CHIP_NO_ERROR)
appError(CHIP_ERROR_INTERNAL);

EFR32_LOG("Starting FreeRTOS scheduler");
SILABS_LOG("Starting FreeRTOS scheduler");
sl_system_kernel_start();

// Should never get here.
chip::Platform::MemoryShutdown();
EFR32_LOG("vTaskStartScheduler() failed");
SILABS_LOG("vTaskStartScheduler() failed");
appError(CHIP_ERROR_INTERNAL);
}

Expand Down
4 changes: 2 additions & 2 deletions examples/lock-app/efr32/include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
extern "C" {
#endif

void efr32InitLog(void);
void silabsInitLog(void);

void efr32Log(const char * aFormat, ...);
#define EFR32_LOG(...) efr32Log(__VA_ARGS__);
#define SILABS_LOG(...) efr32Log(__VA_ARGS__);
void appError(int err);

#ifdef __cplusplus
Expand Down
18 changes: 9 additions & 9 deletions examples/lock-app/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ CHIP_ERROR AppTask::Init()
err = BaseApplication::Init(&gIdentify);
if (err != CHIP_NO_ERROR)
{
EFR32_LOG("BaseApplication::Init() failed");
SILABS_LOG("BaseApplication::Init() failed");
appError(err);
}

Expand Down Expand Up @@ -241,7 +241,7 @@ CHIP_ERROR AppTask::Init()

if (err != CHIP_NO_ERROR)
{
EFR32_LOG("LockMgr().Init() failed");
SILABS_LOG("LockMgr().Init() failed");
appError(err);
}

Expand Down Expand Up @@ -273,15 +273,15 @@ void AppTask::AppTaskMain(void * pvParameter)
CHIP_ERROR err = sAppTask.Init();
if (err != CHIP_NO_ERROR)
{
EFR32_LOG("AppTask.Init() failed");
SILABS_LOG("AppTask.Init() failed");
appError(err);
}

#if !(defined(CHIP_DEVICE_CONFIG_ENABLE_SED) && CHIP_DEVICE_CONFIG_ENABLE_SED)
sAppTask.StartStatusLEDTimer();
#endif

EFR32_LOG("App Task started");
SILABS_LOG("App Task started");

// Users and credentials should be checked once from nvm flash on boot
LockMgr().ReadConfigValues();
Expand Down Expand Up @@ -350,7 +350,7 @@ void AppTask::LockActionEventHandler(AppEvent * aEvent)

if (!initiated)
{
EFR32_LOG("Action is already in progress or active.");
SILABS_LOG("Action is already in progress or active.");
}
}
}
Expand Down Expand Up @@ -383,7 +383,7 @@ void AppTask::ActionInitiated(LockManager::Action_t aAction, int32_t aActor)
if (aAction == LockManager::UNLOCK_ACTION || aAction == LockManager::LOCK_ACTION)
{
bool locked = (aAction == LockManager::LOCK_ACTION);
EFR32_LOG("%s Action has been initiated", (locked) ? "Lock" : "Unlock");
SILABS_LOG("%s Action has been initiated", (locked) ? "Lock" : "Unlock");
#ifdef ENABLE_WSTK_LEDS
sLockLED.Set(!locked);
#endif // ENABLE_WSTK_LEDS
Expand All @@ -406,11 +406,11 @@ void AppTask::ActionCompleted(LockManager::Action_t aAction)
// Turn on the lock LED if in an UNLOCKED state.
if (aAction == LockManager::LOCK_ACTION)
{
EFR32_LOG("Lock Action has been completed")
SILABS_LOG("Lock Action has been completed")
}
else if (aAction == LockManager::UNLOCK_ACTION)
{
EFR32_LOG("Unlock Action has been completed")
SILABS_LOG("Unlock Action has been completed")
}

if (sAppTask.mSyncClusterToButtonAction)
Expand Down Expand Up @@ -443,6 +443,6 @@ void AppTask::UpdateClusterState(intptr_t context)

if (status != EMBER_ZCL_STATUS_SUCCESS)
{
EFR32_LOG("ERR: updating lock state %x", status);
SILABS_LOG("ERR: updating lock state %x", status);
}
}
Loading