From a49b5243123df8a7037040568115040e0b1906bf Mon Sep 17 00:00:00 2001 From: Junior Martinez <67972863+jmartinez-silabs@users.noreply.github.com> Date: Thu, 4 May 2023 17:14:01 -0400 Subject: [PATCH] [Silabs] Fix linkage and some apps build for the Sparkfun board (#26370) * Add missing sources files to the build. ifdef button usage * Restyled by whitespace --------- Co-authored-by: Restyled.io --- examples/chef/efr32/include/AppTask.h | 1 - examples/chef/efr32/src/AppTask.cpp | 2 ++ examples/light-switch-app/silabs/efr32/include/AppTask.h | 1 - examples/light-switch-app/silabs/efr32/src/AppTask.cpp | 2 ++ examples/lighting-app/silabs/efr32/include/AppTask.h | 3 --- examples/lighting-app/silabs/efr32/src/AppTask.cpp | 1 - examples/lock-app/silabs/efr32/include/AppTask.h | 1 - examples/lock-app/silabs/efr32/src/AppTask.cpp | 4 ++++ examples/thermostat/silabs/efr32/BUILD.gn | 3 ++- examples/thermostat/silabs/efr32/include/AppTask.h | 1 - examples/thermostat/silabs/efr32/src/AppTask.cpp | 5 ++++- examples/window-app/silabs/efr32/include/WindowAppImpl.h | 1 - examples/window-app/silabs/efr32/src/WindowAppImpl.cpp | 5 ++++- examples/window-app/silabs/efr32/src/main.cpp | 1 - third_party/silabs/efr32_sdk.gni | 4 ++-- 15 files changed, 20 insertions(+), 15 deletions(-) diff --git a/examples/chef/efr32/include/AppTask.h b/examples/chef/efr32/include/AppTask.h index afa323b2d277f1..2e97883abfe872 100644 --- a/examples/chef/efr32/include/AppTask.h +++ b/examples/chef/efr32/include/AppTask.h @@ -29,7 +29,6 @@ #include "AppEvent.h" #include "BaseApplication.h" #include "FreeRTOS.h" -#include "sl_simple_button_instances.h" #include "timers.h" // provides FreeRTOS timer support #include #include diff --git a/examples/chef/efr32/src/AppTask.cpp b/examples/chef/efr32/src/AppTask.cpp index 04355d98fd2035..ee2e2921202fc6 100644 --- a/examples/chef/efr32/src/AppTask.cpp +++ b/examples/chef/efr32/src/AppTask.cpp @@ -169,6 +169,7 @@ void AppTask::AppTaskMain(void * pvParameter) } } +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT void AppTask::ButtonEventHandler(uint8_t button, uint8_t btnAction) { AppEvent button_event = {}; @@ -181,3 +182,4 @@ void AppTask::ButtonEventHandler(uint8_t button, uint8_t btnAction) sAppTask.PostEvent(&button_event); } } +#endif // SL_CATALOG_SIMPLE_BUTTON_PRESENT diff --git a/examples/light-switch-app/silabs/efr32/include/AppTask.h b/examples/light-switch-app/silabs/efr32/include/AppTask.h index 20ced3fb49a323..20f42610f82059 100644 --- a/examples/light-switch-app/silabs/efr32/include/AppTask.h +++ b/examples/light-switch-app/silabs/efr32/include/AppTask.h @@ -29,7 +29,6 @@ #include "AppEvent.h" #include "BaseApplication.h" #include "FreeRTOS.h" -#include "sl_simple_button_instances.h" #include "timers.h" // provides FreeRTOS timer support #include #include diff --git a/examples/light-switch-app/silabs/efr32/src/AppTask.cpp b/examples/light-switch-app/silabs/efr32/src/AppTask.cpp index 257104fb427568..81ba6afad54c0a 100644 --- a/examples/light-switch-app/silabs/efr32/src/AppTask.cpp +++ b/examples/light-switch-app/silabs/efr32/src/AppTask.cpp @@ -229,6 +229,7 @@ void AppTask::OnIdentifyStop(Identify * identify) #endif } +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT void AppTask::SwitchActionEventHandler(AppEvent * aEvent) { VerifyOrReturn(aEvent->Type == AppEvent::kEventType_Button); @@ -271,3 +272,4 @@ void AppTask::ButtonEventHandler(uint8_t button, uint8_t btnAction) sAppTask.PostEvent(&button_event); } } +#endif // SL_CATALOG_SIMPLE_BUTTON_PRESENT diff --git a/examples/lighting-app/silabs/efr32/include/AppTask.h b/examples/lighting-app/silabs/efr32/include/AppTask.h index e80d6bf75a9276..f8ad1b45367a0b 100644 --- a/examples/lighting-app/silabs/efr32/include/AppTask.h +++ b/examples/lighting-app/silabs/efr32/include/AppTask.h @@ -30,9 +30,6 @@ #include "BaseApplication.h" #include "FreeRTOS.h" #include "LightingManager.h" -#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT -#include "sl_simple_button_instances.h" -#endif #include "timers.h" // provides FreeRTOS timer support #include #include diff --git a/examples/lighting-app/silabs/efr32/src/AppTask.cpp b/examples/lighting-app/silabs/efr32/src/AppTask.cpp index a1fc21b66fa4a1..a8c63c8e61b1d0 100755 --- a/examples/lighting-app/silabs/efr32/src/AppTask.cpp +++ b/examples/lighting-app/silabs/efr32/src/AppTask.cpp @@ -281,7 +281,6 @@ void AppTask::ButtonEventHandler(uint8_t button, uint8_t btnAction) AppTask::GetAppTask().PostEvent(&button_event); } } - #endif void AppTask::ActionInitiated(LightingManager::Action_t aAction, int32_t aActor) diff --git a/examples/lock-app/silabs/efr32/include/AppTask.h b/examples/lock-app/silabs/efr32/include/AppTask.h index 4205a9b891f2a3..df0c38f4a19015 100644 --- a/examples/lock-app/silabs/efr32/include/AppTask.h +++ b/examples/lock-app/silabs/efr32/include/AppTask.h @@ -30,7 +30,6 @@ #include "BaseApplication.h" #include "FreeRTOS.h" #include "LockManager.h" -#include "sl_simple_button_instances.h" #include "timers.h" // provides FreeRTOS timer support #include #include diff --git a/examples/lock-app/silabs/efr32/src/AppTask.cpp b/examples/lock-app/silabs/efr32/src/AppTask.cpp index 93757638519773..93226e14f28646 100644 --- a/examples/lock-app/silabs/efr32/src/AppTask.cpp +++ b/examples/lock-app/silabs/efr32/src/AppTask.cpp @@ -143,7 +143,9 @@ CHIP_ERROR AppTask::Init() { CHIP_ERROR err = CHIP_NO_ERROR; +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT chip::DeviceLayer::Silabs::GetPlatform().SetButtonsCb(AppTask::ButtonEventHandler); +#endif // SL_CATALOG_SIMPLE_BUTTON_PRESENT #ifdef DISPLAY_ENABLED GetLCD().Init((uint8_t *) "Lock-App", true); @@ -359,6 +361,7 @@ void AppTask::LockActionEventHandler(AppEvent * aEvent) } } +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT void AppTask::ButtonEventHandler(uint8_t button, uint8_t btnAction) { AppEvent button_event = {}; @@ -376,6 +379,7 @@ void AppTask::ButtonEventHandler(uint8_t button, uint8_t btnAction) sAppTask.PostEvent(&button_event); } } +#endif // SL_CATALOG_SIMPLE_BUTTON_PRESENT void AppTask::ActionInitiated(LockManager::Action_t aAction, int32_t aActor) { diff --git a/examples/thermostat/silabs/efr32/BUILD.gn b/examples/thermostat/silabs/efr32/BUILD.gn index 31485ed1bcdc29..4bf824c4812147 100644 --- a/examples/thermostat/silabs/efr32/BUILD.gn +++ b/examples/thermostat/silabs/efr32/BUILD.gn @@ -46,7 +46,8 @@ declare_args() { # Enable the temperature sensor # Some boards do not have a temperature sensor - use_temp_sensor = silabs_board != "BRD2703A" && silabs_board != "BRD4319A" + use_temp_sensor = silabs_board != "BRD2703A" && silabs_board != "BRD4319A" && + silabs_board != "BRD2704A" } efr32_sdk("sdk") { diff --git a/examples/thermostat/silabs/efr32/include/AppTask.h b/examples/thermostat/silabs/efr32/include/AppTask.h index 8e0458d8a6fdf1..5a96d148dd35e5 100644 --- a/examples/thermostat/silabs/efr32/include/AppTask.h +++ b/examples/thermostat/silabs/efr32/include/AppTask.h @@ -35,7 +35,6 @@ #include "FreeRTOS.h" #include "SensorManager.h" #include "TemperatureManager.h" -#include "sl_simple_button_instances.h" #include "timers.h" // provides FreeRTOS timer support #include #include diff --git a/examples/thermostat/silabs/efr32/src/AppTask.cpp b/examples/thermostat/silabs/efr32/src/AppTask.cpp index f3f8fdecf2e5a2..ef7204cbfd4b82 100644 --- a/examples/thermostat/silabs/efr32/src/AppTask.cpp +++ b/examples/thermostat/silabs/efr32/src/AppTask.cpp @@ -142,8 +142,9 @@ AppTask AppTask::sAppTask; CHIP_ERROR AppTask::Init() { CHIP_ERROR err = CHIP_NO_ERROR; - +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT chip::DeviceLayer::Silabs::GetPlatform().SetButtonsCb(AppTask::ButtonEventHandler); +#endif // SL_CATALOG_SIMPLE_BUTTON_PRESENT #ifdef DISPLAY_ENABLED GetLCD().Init((uint8_t *) "Thermostat-App"); @@ -245,6 +246,7 @@ void AppTask::UpdateThermoStatUI() #endif // DISPLAY_ENABLED } +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT void AppTask::ButtonEventHandler(uint8_t button, uint8_t btnAction) { AppEvent aEvent = {}; @@ -257,3 +259,4 @@ void AppTask::ButtonEventHandler(uint8_t button, uint8_t btnAction) sAppTask.PostEvent(&aEvent); } } +#endif // SL_CATALOG_SIMPLE_BUTTON_PRESENT diff --git a/examples/window-app/silabs/efr32/include/WindowAppImpl.h b/examples/window-app/silabs/efr32/include/WindowAppImpl.h index 86444574ba0088..8cc1b14906aad3 100644 --- a/examples/window-app/silabs/efr32/include/WindowAppImpl.h +++ b/examples/window-app/silabs/efr32/include/WindowAppImpl.h @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/window-app/silabs/efr32/src/WindowAppImpl.cpp b/examples/window-app/silabs/efr32/src/WindowAppImpl.cpp index 5358344b58ebe7..51c6652c6da149 100644 --- a/examples/window-app/silabs/efr32/src/WindowAppImpl.cpp +++ b/examples/window-app/silabs/efr32/src/WindowAppImpl.cpp @@ -31,7 +31,9 @@ #include #include #endif // QR_CODE_ENABLED +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT #include +#endif #include @@ -516,8 +518,8 @@ WindowAppImpl::Button::Button(WindowApp::Button::Id id, const char * name) : Win void WindowAppImpl::OnButtonChange(uint8_t button, uint8_t btnAction) { +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT WindowApp::Button * btn = static_cast