From ffbf4f1607991508dc7f9e6375c70e7456007f02 Mon Sep 17 00:00:00 2001 From: Gatien Chapon Date: Thu, 7 Nov 2024 15:54:31 +0100 Subject: [PATCH] Revert "[nxp fromtree] [nxp][examples][common] Make button components configurable (#36077)" This reverts commit ce07476e931cb96e5c6b5dcb89587ba54cf01316. Signed-off-by: Gatien Chapon --- .../common/matter_button/source/ButtonApp.cpp | 23 ++-------------- .../matter_button/source/ButtonManager.cpp | 3 --- .../source/ButtonRegistrationAppAndBle.cpp | 27 ++----------------- 3 files changed, 4 insertions(+), 49 deletions(-) diff --git a/examples/platform/nxp/common/matter_button/source/ButtonApp.cpp b/examples/platform/nxp/common/matter_button/source/ButtonApp.cpp index ce036dbd756682..c380319a1d1840 100644 --- a/examples/platform/nxp/common/matter_button/source/ButtonApp.cpp +++ b/examples/platform/nxp/common/matter_button/source/ButtonApp.cpp @@ -24,30 +24,11 @@ extern "C" { #include "board_comp.h" } -/** - * @brief Flag to describe if the button handles are predefined in SDK. - * - * Set to true by default. Platforms that do not have this support should - * disable the flag, which will enable handle definition in this file. - */ -#ifndef CONFIG_APP_BUTTON_HANDLE_SDK_PREDEFINED -#define CONFIG_APP_BUTTON_HANDLE_SDK_PREDEFINED 1 -#endif - -#if !CONFIG_APP_BUTTON_HANDLE_SDK_PREDEFINED -BUTTON_HANDLE_ARRAY_DEFINE(g_buttonHandle, gAppButtonCnt_c); -#endif - CHIP_ERROR chip::NXP::App::ButtonApp::Init() { -#if CONFIG_APP_BUTTON_HANDLE_SDK_PREDEFINED - // Button is defined in the SDK and initialized in otSysInit, when APP_InitServices is called. + // Button is initialized in otSysInit, when APP_InitServices is called. + // Overwrite the handle to reference the SDK handle. handle = &g_buttonHandle[1]; -#else - // Button handle is defined in this file and it should be initialized here. - handle = &g_buttonHandle[0]; - BOARD_InitButton0(handle); -#endif return CHIP_NO_ERROR; } diff --git a/examples/platform/nxp/common/matter_button/source/ButtonManager.cpp b/examples/platform/nxp/common/matter_button/source/ButtonManager.cpp index 7aa9866edf9a01..046337397a3c3c 100644 --- a/examples/platform/nxp/common/matter_button/source/ButtonManager.cpp +++ b/examples/platform/nxp/common/matter_button/source/ButtonManager.cpp @@ -17,10 +17,7 @@ */ #include "ButtonManager.h" - -extern "C" { #include "fwk_platform.h" -} #include #include diff --git a/examples/platform/nxp/common/matter_button/source/ButtonRegistrationAppAndBle.cpp b/examples/platform/nxp/common/matter_button/source/ButtonRegistrationAppAndBle.cpp index b16bc1ff5cd58e..45037b268f8254 100644 --- a/examples/platform/nxp/common/matter_button/source/ButtonRegistrationAppAndBle.cpp +++ b/examples/platform/nxp/common/matter_button/source/ButtonRegistrationAppAndBle.cpp @@ -24,37 +24,14 @@ #include -/** - * @brief Flag to configure if the app button is enabled. - * - * Enabled by default. - */ -#ifndef CONFIG_APP_BUTTON_ENABLED -#define CONFIG_APP_BUTTON_ENABLED 1 -#endif - -/** - * @brief Flag to configure if the BLE button is enabled. - * - * Enabled by default. - */ -#ifndef CONFIG_BLE_BUTTON_ENABLED -#define CONFIG_BLE_BUTTON_ENABLED 1 -#endif +static chip::NXP::App::ButtonApp sAppButton; +static chip::NXP::App::ButtonBle sBleButton; CHIP_ERROR chip::NXP::App::RegisterButtons(void) { ReturnErrorOnFailure(ButtonMgr().Init()); - -#if CONFIG_BLE_BUTTON_ENABLED - static chip::NXP::App::ButtonBle sBleButton; ReturnErrorOnFailure(ButtonMgr().RegisterButton(sBleButton)); -#endif - -#if CONFIG_APP_BUTTON_ENABLED - static chip::NXP::App::ButtonApp sAppButton; ReturnErrorOnFailure(ButtonMgr().RegisterButton(sAppButton)); -#endif return CHIP_NO_ERROR; }