Skip to content

Commit

Permalink
[Silabs] Fix linkage and some apps build for the Sparkfun board (#26370)
Browse files Browse the repository at this point in the history
* Add missing sources files to the build. ifdef button usage

* Restyled by whitespace

---------

Co-authored-by: Restyled.io <commits@restyled.io>
  • Loading branch information
2 people authored and pull[bot] committed Jul 17, 2023
1 parent 58e4f85 commit 1271655
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 15 deletions.
1 change: 0 additions & 1 deletion examples/chef/efr32/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <app/clusters/identify-server/identify-server.h>
#include <ble/BLEEndPoint.h>
Expand Down
2 changes: 2 additions & 0 deletions examples/chef/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand All @@ -181,3 +182,4 @@ void AppTask::ButtonEventHandler(uint8_t button, uint8_t btnAction)
sAppTask.PostEvent(&button_event);
}
}
#endif // SL_CATALOG_SIMPLE_BUTTON_PRESENT
1 change: 0 additions & 1 deletion examples/light-switch-app/silabs/efr32/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <app/clusters/identify-server/identify-server.h>
#include <ble/BLEEndPoint.h>
Expand Down
2 changes: 2 additions & 0 deletions examples/light-switch-app/silabs/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -271,3 +272,4 @@ void AppTask::ButtonEventHandler(uint8_t button, uint8_t btnAction)
sAppTask.PostEvent(&button_event);
}
}
#endif // SL_CATALOG_SIMPLE_BUTTON_PRESENT
3 changes: 0 additions & 3 deletions examples/lighting-app/silabs/efr32/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <app/clusters/identify-server/identify-server.h>
#include <ble/BLEEndPoint.h>
Expand Down
1 change: 0 additions & 1 deletion examples/lighting-app/silabs/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion examples/lock-app/silabs/efr32/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <app/clusters/identify-server/identify-server.h>
#include <ble/BLEEndPoint.h>
Expand Down
4 changes: 4 additions & 0 deletions examples/lock-app/silabs/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 = {};
Expand All @@ -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)
{
Expand Down
3 changes: 2 additions & 1 deletion examples/thermostat/silabs/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
1 change: 0 additions & 1 deletion examples/thermostat/silabs/efr32/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <app/clusters/identify-server/identify-server.h>
#include <ble/BLEEndPoint.h>
Expand Down
5 changes: 4 additions & 1 deletion examples/thermostat/silabs/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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 = {};
Expand All @@ -257,3 +259,4 @@ void AppTask::ButtonEventHandler(uint8_t button, uint8_t btnAction)
sAppTask.PostEvent(&aEvent);
}
}
#endif // SL_CATALOG_SIMPLE_BUTTON_PRESENT
1 change: 0 additions & 1 deletion examples/window-app/silabs/efr32/include/WindowAppImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <WindowApp.h>
#include <queue.h>
#include <setup_payload/QRCodeSetupPayloadGenerator.h>
#include <sl_simple_button_instances.h>
#include <string>
#include <task.h>
#include <timers.h>
Expand Down
5 changes: 4 additions & 1 deletion examples/window-app/silabs/efr32/src/WindowAppImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
#include <setup_payload/QRCodeSetupPayloadGenerator.h>
#include <setup_payload/SetupPayload.h>
#endif // QR_CODE_ENABLED
#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT
#include <sl_simple_button_instances.h>
#endif

#include <sl_system_kernel.h>

Expand Down Expand Up @@ -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<Button *>((button == 0) ? sInstance.mButtonUp : sInstance.mButtonDown);

if (btnAction == SL_SIMPLE_BUTTON_PRESSED)
{
btn->Press();
Expand All @@ -526,6 +528,7 @@ void WindowAppImpl::OnButtonChange(uint8_t button, uint8_t btnAction)
{
btn->Release();
}
#endif
}

// Silabs button callback from button event ISR
Expand Down
1 change: 0 additions & 1 deletion examples/window-app/silabs/efr32/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <WindowApp.h>

#include "init_efrPlatform.h"
#include "sl_simple_button_instances.h"
#include "sl_system_kernel.h"
#include <DeviceInfoProviderImpl.h>
#include <app/server/Server.h>
Expand Down
4 changes: 2 additions & 2 deletions third_party/silabs/efr32_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ template("efr32_sdk") {
"${silabs_gen_folder}/autogen",
]

if (slc_generate || slc_reuse_files) {
if (slc_generate || slc_reuse_files || silabs_family == "mgm24") {
_include_dirs +=
[ "${efr32_sdk_root}/hardware/driver/configuration_over_swo/inc/" ]
}
Expand Down Expand Up @@ -721,7 +721,7 @@ template("efr32_sdk") {
]
}

if (slc_generate || slc_reuse_files) {
if (slc_generate || slc_reuse_files || silabs_family == "mgm24") {
sources += [
"${efr32_sdk_root}/hardware/driver/configuration_over_swo/src/sl_cos.c",
"${efr32_sdk_root}/platform/driver/debug/src/sl_debug_swo.c",
Expand Down

0 comments on commit 1271655

Please sign in to comment.