Skip to content

Commit

Permalink
Update silabs_exaples main.cpps with the proper renames from csa master
Browse files Browse the repository at this point in the history
  • Loading branch information
jmartinez-silabs committed Oct 17, 2023
1 parent d23fba7 commit 7b01b06
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <app/server/Server.h>
#include <credentials/DeviceAttestationCredsProvider.h>
#include <matter_config.h>
#ifdef SI917_ATTESTATION_CREDENTIALS
#ifdef SILABS_ATTESTATION_CREDENTIALS
#include <examples/platform/silabs/SilabsDeviceAttestationCreds.h>
#else
#include <credentials/examples/DeviceAttestationCredsExample.h>
Expand All @@ -52,7 +52,7 @@ static chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider;
int main(void)
{
init_ccpPlatform();
if (SI917MatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR)
if (SilabsMatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR)
{
appError(CHIP_ERROR_INTERNAL);
}
Expand All @@ -62,7 +62,7 @@ int main(void)

chip::DeviceLayer::PlatformMgr().LockChipStack();
// Initialize device attestation config
#ifdef SI917_ATTESTATION_CREDENTIALS
#ifdef SILABS_ATTESTATION_CREDENTIALS
SetDeviceAttestationCredentialsProvider(Silabs::GetSilabsDacProvider());
#else
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <app/server/Server.h>
#include <credentials/DeviceAttestationCredsProvider.h>
#include <matter_config.h>
#ifdef EFR32_ATTESTATION_CREDENTIALS
#ifdef SILABS_ATTESTATION_CREDENTIALS
#include <examples/platform/silabs/SilabsDeviceAttestationCreds.h>
#else
#include <credentials/examples/DeviceAttestationCredsExample.h>
Expand All @@ -52,15 +52,15 @@ static chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider;
int main(void)
{
init_efrPlatform();
if (EFR32MatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR)
if (SilabsMatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR)
appError(CHIP_ERROR_INTERNAL);

gExampleDeviceInfoProvider.SetStorageDelegate(&chip::Server::GetInstance().GetPersistentStorage());
chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider);

chip::DeviceLayer::PlatformMgr().LockChipStack();
// Initialize device attestation config
#ifdef EFR32_ATTESTATION_CREDENTIALS
#ifdef SILABS_ATTESTATION_CREDENTIALS
SetDeviceAttestationCredentialsProvider(Silabs::GetSilabsDacProvider());
#else
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
Expand Down
12 changes: 8 additions & 4 deletions silabs_examples/lighting-lite-app/efr32/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@

#include "AppConfig.h"
#include "init_efrPlatform.h"
#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT
#include "sl_simple_button_instances.h"
#endif
#include "sl_system_kernel.h"
#include <DeviceInfoProviderImpl.h>
#include <app/server/Server.h>
#include <credentials/DeviceAttestationCredsProvider.h>
#include <matter_config.h>
#ifdef EFR32_ATTESTATION_CREDENTIALS
#ifdef SILABS_ATTESTATION_CREDENTIALS
#include <examples/platform/silabs/SilabsDeviceAttestationCreds.h>
#else
#include <credentials/examples/DeviceAttestationCredsExample.h>
Expand All @@ -50,16 +52,16 @@ static chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider;
int main(void)
{
init_efrPlatform();
if (EFR32MatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR)
if (SilabsMatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR)
appError(CHIP_ERROR_INTERNAL);

gExampleDeviceInfoProvider.SetStorageDelegate(&chip::Server::GetInstance().GetPersistentStorage());
chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider);

chip::DeviceLayer::PlatformMgr().LockChipStack();
// Initialize device attestation config
#ifdef EFR32_ATTESTATION_CREDENTIALS
SetDeviceAttestationCredentialsProvider(EFR32::GetEFR32DacProvider());
#ifdef SILABS_ATTESTATION_CREDENTIALS
SetDeviceAttestationCredentialsProvider(Silabs::GetSilabsDacProvider());
#else
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
#endif
Expand All @@ -78,7 +80,9 @@ int main(void)
appError(CHIP_ERROR_INTERNAL);
}

#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT
void sl_button_on_change(const sl_button_t * handle)
{
AppTask::GetAppTask().ButtonEventHandler(handle, sl_button_get_state(handle));
}
#endif
13 changes: 8 additions & 5 deletions silabs_examples/onoff-plug-app/SiWx917/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <app/server/Server.h>
#include <credentials/DeviceAttestationCredsProvider.h>
#include <matter_config.h>
#ifdef SI917_ATTESTATION_CREDENTIALS
#ifdef SILABS_ATTESTATION_CREDENTIALS
#include <examples/platform/silabs/SilabsDeviceAttestationCreds.h>
#else
#include <credentials/examples/DeviceAttestationCredsExample.h>
Expand Down Expand Up @@ -53,27 +53,30 @@ static chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider;
int main(void)
{
init_ccpPlatform();
if (SI917MatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR)
if (SilabsMatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR)
{
appError(CHIP_ERROR_INTERNAL);
}

gExampleDeviceInfoProvider.SetStorageDelegate(&chip::Server::GetInstance().GetPersistentStorage());
chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider);

chip::DeviceLayer::PlatformMgr().LockChipStack();
// Initialize device attestation config
#ifdef SI917_ATTESTATION_CREDENTIALS
SetDeviceAttestationCredentialsProvider(SILABS::GetSILABSDacProvider());
#ifdef SILABS_ATTESTATION_CREDENTIALS
SetDeviceAttestationCredentialsProvider(Silabs::GetSilabsDacProvider());
#else
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
#endif
chip::DeviceLayer::PlatformMgr().UnlockChipStack();

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

SILABS_LOG("Starting FreeRTOS scheduler");
//sl_system_kernel_start();
vTaskStartScheduler();

// Should never get here.
Expand Down
12 changes: 8 additions & 4 deletions silabs_examples/onoff-plug-app/efr32/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@

#include "AppConfig.h"
#include "init_efrPlatform.h"
#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT
#include "sl_simple_button_instances.h"
#endif
#include "sl_system_kernel.h"
#include <DeviceInfoProviderImpl.h>
#include <app/server/Server.h>
#include <credentials/DeviceAttestationCredsProvider.h>
#include <matter_config.h>
#ifdef EFR32_ATTESTATION_CREDENTIALS
#ifdef SILABS_ATTESTATION_CREDENTIALS
#include <examples/platform/silabs/SilabsDeviceAttestationCreds.h>
#else
#include <credentials/examples/DeviceAttestationCredsExample.h>
Expand All @@ -50,16 +52,16 @@ static chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider;
int main(void)
{
init_efrPlatform();
if (EFR32MatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR)
if (SilabsMatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR)
appError(CHIP_ERROR_INTERNAL);

gExampleDeviceInfoProvider.SetStorageDelegate(&chip::Server::GetInstance().GetPersistentStorage());
chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider);

chip::DeviceLayer::PlatformMgr().LockChipStack();
// Initialize device attestation config
#ifdef EFR32_ATTESTATION_CREDENTIALS
SetDeviceAttestationCredentialsProvider(EFR32::GetEFR32DacProvider());
#ifdef SILABS_ATTESTATION_CREDENTIALS
SetDeviceAttestationCredentialsProvider(Silabs::GetSilabsDacProvider());
#else
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
#endif
Expand All @@ -78,7 +80,9 @@ int main(void)
appError(CHIP_ERROR_INTERNAL);
}

#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT
void sl_button_on_change(const sl_button_t * handle)
{
AppTask::GetAppTask().ButtonEventHandler(handle, sl_button_get_state(handle));
}
#endif
6 changes: 3 additions & 3 deletions silabs_examples/silabs-sensors/efr32/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <app/server/Server.h>
#include <credentials/DeviceAttestationCredsProvider.h>
#include <matter_config.h>
#ifdef EFR32_ATTESTATION_CREDENTIALS
#ifdef SILABS_ATTESTATION_CREDENTIALS
#include <examples/platform/silabs/SilabsDeviceAttestationCreds.h>
#else
#include <credentials/examples/DeviceAttestationCredsExample.h>
Expand All @@ -54,15 +54,15 @@ static chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider;
int main(void)
{
init_efrPlatform();
if (EFR32MatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR)
if (SilabsMatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR)
appError(CHIP_ERROR_INTERNAL);

gExampleDeviceInfoProvider.SetStorageDelegate(&chip::Server::GetInstance().GetPersistentStorage());
chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider);

chip::DeviceLayer::PlatformMgr().LockChipStack();
// Initialize device attestation config
#ifdef EFR32_ATTESTATION_CREDENTIALS
#ifdef SILABS_ATTESTATION_CREDENTIALS
SetDeviceAttestationCredentialsProvider(Silabs::GetSilabsDacProvider());
#else
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
Expand Down
18 changes: 11 additions & 7 deletions silabs_examples/sl-newLight/efr32/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@

#include "AppConfig.h"
#include "init_efrPlatform.h"
#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT
#include "sl_simple_button_instances.h"
#endif
#include "sl_system_kernel.h"
#include <DeviceInfoProviderImpl.h>
#include <app/server/Server.h>
#include <credentials/DeviceAttestationCredsProvider.h>
#include <matter_config.h>
#ifdef EFR32_ATTESTATION_CREDENTIALS
#ifdef SILABS_ATTESTATION_CREDENTIALS
#include <examples/platform/silabs/SilabsDeviceAttestationCreds.h>
#else
#include <credentials/examples/DeviceAttestationCredsExample.h>
Expand All @@ -43,28 +45,29 @@ using namespace ::chip::Credentials;

volatile int apperror_cnt;
static chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider;

// ================================================================================
// Main Code
// ================================================================================
int main(void)
{
init_efrPlatform();
if (EFR32MatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR)
if (SilabsMatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR)
appError(CHIP_ERROR_INTERNAL);

gExampleDeviceInfoProvider.SetStorageDelegate(&chip::Server::GetInstance().GetPersistentStorage());
chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider);

chip::DeviceLayer::PlatformMgr().LockChipStack();
// Initialize device attestation config
#ifdef EFR32_ATTESTATION_CREDENTIALS
SetDeviceAttestationCredentialsProvider(EFR32::GetEFR32DacProvider());
#ifdef SILABS_ATTESTATION_CREDENTIALS
SetDeviceAttestationCredentialsProvider(Silabs::GetSilabsDacProvider());
#else
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
#endif

chip::DeviceLayer::PlatformMgr().UnlockChipStack();
SILABS_LOG("Starting App Task");

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

Expand All @@ -77,8 +80,9 @@ int main(void)
appError(CHIP_ERROR_INTERNAL);
}

#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT
void sl_button_on_change(const sl_button_t * handle)
{

AppTask::GetAppTask().ButtonEventHandler(handle, sl_button_get_state(handle));
}
#endif
28 changes: 27 additions & 1 deletion silabs_examples/template/efr32/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,53 @@

#include "AppConfig.h"
#include "init_efrPlatform.h"
#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT
#include "sl_simple_button_instances.h"
#endif
#include "sl_system_kernel.h"
#include <DeviceInfoProviderImpl.h>
#include <app/server/Server.h>
#include <credentials/DeviceAttestationCredsProvider.h>
#include <matter_config.h>
#ifdef SILABS_ATTESTATION_CREDENTIALS
#include <examples/platform/silabs/SilabsDeviceAttestationCreds.h>
#else
#include <credentials/examples/DeviceAttestationCredsExample.h>
#endif

// The name must not be longer than 13 characters
#define BLE_DEV_NAME "SL-Template"
using namespace ::chip;
using namespace ::chip::Inet;
using namespace ::chip::DeviceLayer;
using namespace ::chip::Credentials;

#define UNUSED_PARAMETER(a) (a = a)

volatile int apperror_cnt;
static chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider;

// ================================================================================
// Main Code
// ================================================================================
int main(void)
{
init_efrPlatform();
if (EFR32MatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR)
if (SilabsMatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR)
appError(CHIP_ERROR_INTERNAL);

gExampleDeviceInfoProvider.SetStorageDelegate(&chip::Server::GetInstance().GetPersistentStorage());
chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider);

chip::DeviceLayer::PlatformMgr().LockChipStack();
// Initialize device attestation config
#ifdef SILABS_ATTESTATION_CREDENTIALS
SetDeviceAttestationCredentialsProvider(Silabs::GetSilabsDacProvider());
#else
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
#endif
chip::DeviceLayer::PlatformMgr().UnlockChipStack();

SILABS_LOG("Starting App Task");
if (AppTask::GetAppTask().StartAppTask() != CHIP_NO_ERROR)
appError(CHIP_ERROR_INTERNAL);
Expand All @@ -57,7 +81,9 @@ int main(void)
appError(CHIP_ERROR_INTERNAL);
}

#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT
void sl_button_on_change(const sl_button_t * handle)
{
AppTask::GetAppTask().ButtonEventHandler(handle, sl_button_get_state(handle));
}
#endif

0 comments on commit 7b01b06

Please sign in to comment.