Skip to content

Commit

Permalink
Revert "[nxp fromtree] [NXP][common][mcxw71_k32w1] Update ButtonApp::…
Browse files Browse the repository at this point in the history
…HandleLongPress and PlatformManagerImpl (project-chip#35989)"

This reverts commit 3bb99e1.

Signed-off-by: Andrei Menzopol <[email protected]>
  • Loading branch information
andrei-menzopol committed Oct 17, 2024
1 parent 32a62db commit d42a437
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,7 @@ void chip::NXP::App::ButtonApp::HandleShortPress()

void chip::NXP::App::ButtonApp::HandleLongPress()
{
// Execute "clean" reset
chip::DeviceLayer::PlatformMgr().ScheduleWork(
[](intptr_t arg) {
chip::DeviceLayer::PlatformMgr().StopEventLoopTask();
chip::DeviceLayer::PlatformMgr().Shutdown();
chip::DeviceLayer::PlatformMgrImpl().Reset();
},
(intptr_t) nullptr);
chip::DeviceLayer::PlatformMgrImpl().CleanReset();
}

void chip::NXP::App::ButtonApp::HandleDoubleClick()
Expand Down
15 changes: 5 additions & 10 deletions src/platform/nxp/mcxw71_k32w1/PlatformManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@

#include <mbedtls/platform.h>

extern "C" void HAL_ResetMCU(void);
extern "C" void freertos_mbedtls_mutex_init(void);

extern uint8_t __data_end__[], m_data0_end[];
Expand Down Expand Up @@ -92,16 +93,14 @@ CHIP_ERROR PlatformManagerImpl::ServiceInit(void)
return CHIP_NO_ERROR;
}

void PlatformManagerImpl::Reset()
void PlatformManagerImpl::CleanReset()
{
StopEventLoopTask();
Shutdown();
#if (CHIP_PLAT_NVM_SUPPORT == 1)
NvCompletePendingOperations();
#endif
// Restart the system.
NVIC_SystemReset();
while (1)
{
}
HAL_ResetMCU();
}

void PlatformManagerImpl::ScheduleResetInIdle(void)
Expand Down Expand Up @@ -201,10 +200,6 @@ void PlatformManagerImpl::_Shutdown()
ChipLogError(DeviceLayer, "Failed to get current uptime since the Node’s last reboot");
}

/* Handle the server shutting down & emit the ShutDown event */
/* Make sure to call this function from Matter Task */
PlatformMgr().HandleServerShuttingDown();
/* Shutdown all layers */
Internal::GenericPlatformManagerImpl_FreeRTOS<PlatformManagerImpl>::_Shutdown();
}

Expand Down
2 changes: 1 addition & 1 deletion src/platform/nxp/mcxw71_k32w1/PlatformManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class PlatformManagerImpl final : public PlatformManager, public Internal::Gener
System::Clock::Timestamp GetStartTime() { return mStartTime; }
void HardwareInit(void);
CHIP_ERROR ServiceInit(void);
void Reset();
void CleanReset();
void StopBLEConnectivity() {}
void ScheduleResetInIdle(void);
bool GetResetInIdleValue(void);
Expand Down

0 comments on commit d42a437

Please sign in to comment.