Skip to content

Commit

Permalink
Revert "[nxp fromtree] [nxp][examples][common] Make button components…
Browse files Browse the repository at this point in the history
… configurable (project-chip#36077)"

This reverts commit ce07476.

Signed-off-by: Gatien Chapon <gatien.chapon@nxp.com>
  • Loading branch information
chapongatien committed Nov 7, 2024
1 parent f80b898 commit ffbf4f1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 49 deletions.
23 changes: 2 additions & 21 deletions examples/platform/nxp/common/matter_button/source/ButtonApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
*/

#include "ButtonManager.h"

extern "C" {
#include "fwk_platform.h"
}

#include <lib/core/CHIPError.h>
#include <lib/support/CodeUtils.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,37 +24,14 @@

#include <lib/support/CodeUtils.h>

/**
* @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;
}

0 comments on commit ffbf4f1

Please sign in to comment.