Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NXP][platform][examples] Low power changes #36389

Merged
merged 4 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions examples/contact-sensor-app/nxp/common/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@

#include "AppTask.h"

#if CONFIG_LOW_POWER
#include "PWR_Interface.h"
#endif

#include <app-common/zap-generated/attributes/Accessors.h>
#include <platform/CHIPDeviceLayer.h>

Expand All @@ -36,18 +32,6 @@ void ContactSensorApp::AppTask::PreInitMatterStack()
ChipLogProgress(DeviceLayer, "Welcome to NXP Contact Sensor Demo App");
}

#if CONFIG_LOW_POWER
void ContactSensorApp::AppTask::AppMatter_DisallowDeviceToSleep()
{
PWR_DisallowDeviceToSleep();
}

void ContactSensorApp::AppTask::AppMatter_AllowDeviceToSleep()
{
PWR_AllowDeviceToSleep();
}
#endif

ContactSensorApp::AppTask & ContactSensorApp::AppTask::GetDefaultInstance()
{
static ContactSensorApp::AppTask sAppTask;
Expand Down
4 changes: 0 additions & 4 deletions examples/contact-sensor-app/nxp/common/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ class AppTask : public chip::NXP::App::AppTaskFreeRTOS

// AppTaskFreeRTOS virtual methods
void PreInitMatterStack() override;
#if CONFIG_LOW_POWER
void AppMatter_DisallowDeviceToSleep() override;
void AppMatter_AllowDeviceToSleep() override;
#endif

// This returns an instance of this class.
static AppTask & GetDefaultInstance();
Expand Down
4 changes: 2 additions & 2 deletions examples/platform/nxp/common/app_task/include/AppTaskBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ class AppTaskBase
* This function can be overridden in order to implement a specific disallow mechanism.
*
*/
virtual void AppMatter_DisallowDeviceToSleep(void) {}
virtual void AppMatter_DisallowDeviceToSleep(void);

/**
* \brief Allow entering low power mode.
*
* This function can be overridden in order to implement a specific allow mechanism.
*
*/
virtual void AppMatter_AllowDeviceToSleep(void) {}
virtual void AppMatter_AllowDeviceToSleep(void);

/**
* \brief Print onboarding information.
Expand Down
15 changes: 15 additions & 0 deletions examples/platform/nxp/common/app_task/source/AppTaskBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@

#if CONFIG_LOW_POWER
#include "LowPower.h"
#include "PWR_Interface.h"
#endif

#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
Expand Down Expand Up @@ -431,6 +432,20 @@ void chip::NXP::App::AppTaskBase::FactoryResetHandler(void)
chip::Server::GetInstance().ScheduleFactoryReset();
}

void chip::NXP::App::AppTaskBase::AppMatter_DisallowDeviceToSleep(void)
{
#if CONFIG_LOW_POWER
PWR_DisallowDeviceToSleep();
#endif
}

void chip::NXP::App::AppTaskBase::AppMatter_AllowDeviceToSleep(void)
{
#if CONFIG_LOW_POWER
PWR_AllowDeviceToSleep();
#endif
}

void chip::NXP::App::AppTaskBase::PrintOnboardingInfo()
{
#if CONFIG_NETWORK_LAYER_BLE
Expand Down
2 changes: 1 addition & 1 deletion src/platform/nxp/common/ble/BLEManagerCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ void BLEManagerCommon::blekw_gap_connection_cb(deviceId_t deviceId, gapConnectio

if (pConnectionEvent->eventType == gConnEvtConnected_c)
{
#if CHIP_DEVICE_K32W1
#if NXP_DEVICE_K32W1_MCXW7X
#if defined(nxp_use_low_power) && (nxp_use_low_power == 1)
/* Disallow must be called here for K32W1, otherwise an assert will be reached.
* Disclaimer: this is a workaround until a better cross platform solution is found. */
Expand Down
Loading