From a1f56e76554294c2c34f03fe9a85ea685016dd6a Mon Sep 17 00:00:00 2001 From: Junior Martinez Date: Sat, 22 Apr 2023 09:23:43 -0400 Subject: [PATCH] Update silabs_exaples main.cpps with the proper renames from csa master --- .../SiWx917/src/main.cpp | 6 ++-- .../efr32/src/main.cpp | 6 ++-- .../lighting-lite-app/efr32/src/main.cpp | 12 +++++--- .../onoff-plug-app/SiWx917/src/main.cpp | 13 +++++---- .../onoff-plug-app/efr32/src/main.cpp | 12 +++++--- .../silabs-sensors/efr32/src/main.cpp | 6 ++-- .../sl-newLight/efr32/src/main.cpp | 18 +++++++----- silabs_examples/template/efr32/src/main.cpp | 28 ++++++++++++++++++- 8 files changed, 71 insertions(+), 30 deletions(-) diff --git a/silabs_examples/Direct_Internet_lighting-app/SiWx917/src/main.cpp b/silabs_examples/Direct_Internet_lighting-app/SiWx917/src/main.cpp index d95f6b7ab51295..ce2ae970887a40 100644 --- a/silabs_examples/Direct_Internet_lighting-app/SiWx917/src/main.cpp +++ b/silabs_examples/Direct_Internet_lighting-app/SiWx917/src/main.cpp @@ -26,7 +26,7 @@ #include #include #include -#ifdef SI917_ATTESTATION_CREDENTIALS +#ifdef SILABS_ATTESTATION_CREDENTIALS #include #else #include @@ -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); } @@ -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()); diff --git a/silabs_examples/Direct_Internet_lighting-app/efr32/src/main.cpp b/silabs_examples/Direct_Internet_lighting-app/efr32/src/main.cpp index 9f447b972678b6..73d81d7c2979c5 100644 --- a/silabs_examples/Direct_Internet_lighting-app/efr32/src/main.cpp +++ b/silabs_examples/Direct_Internet_lighting-app/efr32/src/main.cpp @@ -29,7 +29,7 @@ #include #include #include -#ifdef EFR32_ATTESTATION_CREDENTIALS +#ifdef SILABS_ATTESTATION_CREDENTIALS #include #else #include @@ -52,7 +52,7 @@ 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()); @@ -60,7 +60,7 @@ int main(void) chip::DeviceLayer::PlatformMgr().LockChipStack(); // Initialize device attestation config -#ifdef EFR32_ATTESTATION_CREDENTIALS +#ifdef SILABS_ATTESTATION_CREDENTIALS SetDeviceAttestationCredentialsProvider(Silabs::GetSilabsDacProvider()); #else SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); diff --git a/silabs_examples/lighting-lite-app/efr32/src/main.cpp b/silabs_examples/lighting-lite-app/efr32/src/main.cpp index 62f45d8e1e3a1d..db0d8cb7b96b76 100644 --- a/silabs_examples/lighting-lite-app/efr32/src/main.cpp +++ b/silabs_examples/lighting-lite-app/efr32/src/main.cpp @@ -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 #include #include #include -#ifdef EFR32_ATTESTATION_CREDENTIALS +#ifdef SILABS_ATTESTATION_CREDENTIALS #include #else #include @@ -50,7 +52,7 @@ 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()); @@ -58,8 +60,8 @@ int main(void) 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 @@ -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 diff --git a/silabs_examples/onoff-plug-app/SiWx917/src/main.cpp b/silabs_examples/onoff-plug-app/SiWx917/src/main.cpp index 02638e8744adff..d4cb1b864639be 100644 --- a/silabs_examples/onoff-plug-app/SiWx917/src/main.cpp +++ b/silabs_examples/onoff-plug-app/SiWx917/src/main.cpp @@ -25,7 +25,7 @@ #include #include #include -#ifdef SI917_ATTESTATION_CREDENTIALS +#ifdef SILABS_ATTESTATION_CREDENTIALS #include #else #include @@ -53,16 +53,18 @@ 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 @@ -70,10 +72,11 @@ int main(void) 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. diff --git a/silabs_examples/onoff-plug-app/efr32/src/main.cpp b/silabs_examples/onoff-plug-app/efr32/src/main.cpp index 090ac7c1c44488..89630bbdf278e0 100644 --- a/silabs_examples/onoff-plug-app/efr32/src/main.cpp +++ b/silabs_examples/onoff-plug-app/efr32/src/main.cpp @@ -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 #include #include #include -#ifdef EFR32_ATTESTATION_CREDENTIALS +#ifdef SILABS_ATTESTATION_CREDENTIALS #include #else #include @@ -50,7 +52,7 @@ 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()); @@ -58,8 +60,8 @@ int main(void) 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 @@ -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 diff --git a/silabs_examples/silabs-sensors/efr32/src/main.cpp b/silabs_examples/silabs-sensors/efr32/src/main.cpp index f22f0188295c6e..80b316f44a67ca 100644 --- a/silabs_examples/silabs-sensors/efr32/src/main.cpp +++ b/silabs_examples/silabs-sensors/efr32/src/main.cpp @@ -29,7 +29,7 @@ #include #include #include -#ifdef EFR32_ATTESTATION_CREDENTIALS +#ifdef SILABS_ATTESTATION_CREDENTIALS #include #else #include @@ -54,7 +54,7 @@ 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()); @@ -62,7 +62,7 @@ int main(void) chip::DeviceLayer::PlatformMgr().LockChipStack(); // Initialize device attestation config -#ifdef EFR32_ATTESTATION_CREDENTIALS +#ifdef SILABS_ATTESTATION_CREDENTIALS SetDeviceAttestationCredentialsProvider(Silabs::GetSilabsDacProvider()); #else SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); diff --git a/silabs_examples/sl-newLight/efr32/src/main.cpp b/silabs_examples/sl-newLight/efr32/src/main.cpp index 498b86b8b59bf8..3658fcaa81f036 100644 --- a/silabs_examples/sl-newLight/efr32/src/main.cpp +++ b/silabs_examples/sl-newLight/efr32/src/main.cpp @@ -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 #include #include #include -#ifdef EFR32_ATTESTATION_CREDENTIALS +#ifdef SILABS_ATTESTATION_CREDENTIALS #include #else #include @@ -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); @@ -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 diff --git a/silabs_examples/template/efr32/src/main.cpp b/silabs_examples/template/efr32/src/main.cpp index b8471c84293d71..c3c2098f8619f6 100644 --- a/silabs_examples/template/efr32/src/main.cpp +++ b/silabs_examples/template/efr32/src/main.cpp @@ -21,19 +21,31 @@ #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 +#include +#include #include +#ifdef SILABS_ATTESTATION_CREDENTIALS +#include +#else +#include +#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 @@ -41,9 +53,21 @@ volatile int apperror_cnt; 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); @@ -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