Ersa Wearable Platform
Embedded smartwatch firmware and application framework
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ersa::hal::IPowerManagement Class Referenceabstract

#include <power_management.h>

Inheritance diagram for ersa::hal::IPowerManagement:
Inheritance graph
[legend]

Public Member Functions

virtual ~IPowerManagement ()=default
 
virtual bool initialize ()=0
 
virtual void tick ()=0
 
virtual bool initializeWakeSources (const board::Pins &pins)=0
 Configure GPIO/button wake sources from the selected board's pin map.
 
virtual void allowAutomaticSleep (bool allow)=0
 
virtual void waitForWake (uint32_t timeoutMs)=0
 
virtual void notifyWake ()=0
 
virtual void enterDeepSleep (uint64_t timerUs)=0
 
virtual bool acquirePerformance (PerformanceProfile profile, const char *reason)=0
 
virtual void releasePerformance (PerformanceProfile profile, const char *reason)=0
 Release a performance profile acquired earlier.
 
virtual void reportPowerModes ()=0
 Emit a one-time power-mode diagnostic report.
 
virtual bool getPowerModeReport (char *buffer, size_t capacity)=0
 Copy a power-mode report into a caller-owned buffer.
 
virtual bool setTestCpuFrequencyMHz (unsigned mhz)=0
 Queue a development CPU-frequency override for the next controlled restart.
 
virtual unsigned testCpuFrequencyMHz () const =0
 Return the queued development CPU-frequency override, or zero for automatic mode.
 

Detailed Description

Platform contract for clock scaling, wake sources, and low-power states.

Power policy decides when automatic sleep is appropriate; this interface configures the chip/RTOS and coordinates peripheral locks. The normal idle path waits on the RTOS so automatic sleep can honor BLE and PM constraints.

Constructor & Destructor Documentation

◆ ~IPowerManagement()

virtual ersa::hal::IPowerManagement::~IPowerManagement ( )
virtualdefault

Member Function Documentation

◆ acquirePerformance()

virtual bool ersa::hal::IPowerManagement::acquirePerformance ( PerformanceProfile  profile,
const char *  reason 
)
pure virtual

Acquire a temporary CPU/APB minimum for latency-sensitive work.

Parameters
profileWorkload class selecting the platform's performance guarantee.
reasonShort diagnostic label paired with releasePerformance().
Returns
False when the profile is unsupported or the platform lock failed.

Implemented in ersa::test::MockPowerManagement, and ersa::hal::Esp32PowerManagement.

◆ allowAutomaticSleep()

virtual void ersa::hal::IPowerManagement::allowAutomaticSleep ( bool  allow)
pure virtual

Permit FreeRTOS automatic sleep when true; false holds the platform's no-light-sleep guard for display, network, USB, or active interaction.

Implemented in ersa::hal::Esp32PowerManagement, and ersa::test::MockPowerManagement.

◆ enterDeepSleep()

virtual void ersa::hal::IPowerManagement::enterDeepSleep ( uint64_t  timerUs)
pure virtual

Enter deep sleep after configuring enabled GPIO/timer sources. This normally restarts firmware on wake, unlike light sleep.

Implemented in ersa::hal::Esp32PowerManagement, and ersa::test::MockPowerManagement.

◆ getPowerModeReport()

virtual bool ersa::hal::IPowerManagement::getPowerModeReport ( char *  buffer,
size_t  capacity 
)
pure virtual

Copy a power-mode report into a caller-owned buffer.

Implemented in ersa::test::MockPowerManagement, and ersa::hal::Esp32PowerManagement.

◆ initialize()

virtual bool ersa::hal::IPowerManagement::initialize ( )
pure virtual

Configure PM/tickless-idle policy before radio stacks acquire locks.

Implemented in ersa::hal::Esp32PowerManagement, and ersa::test::MockPowerManagement.

◆ initializeWakeSources()

virtual bool ersa::hal::IPowerManagement::initializeWakeSources ( const board::Pins &  pins)
pure virtual

Configure GPIO/button wake sources from the selected board's pin map.

Implemented in ersa::test::MockPowerManagement, and ersa::hal::Esp32PowerManagement.

◆ notifyWake()

virtual void ersa::hal::IPowerManagement::notifyWake ( )
pure virtual

Notify the task that new event/driver work is ready to process.

Implemented in ersa::hal::Esp32PowerManagement, and ersa::test::MockPowerManagement.

◆ releasePerformance()

virtual void ersa::hal::IPowerManagement::releasePerformance ( PerformanceProfile  profile,
const char *  reason 
)
pure virtual

Release a performance profile acquired earlier.

Implemented in ersa::test::MockPowerManagement, and ersa::hal::Esp32PowerManagement.

◆ reportPowerModes()

virtual void ersa::hal::IPowerManagement::reportPowerModes ( )
pure virtual

Emit a one-time power-mode diagnostic report.

Implemented in ersa::hal::Esp32PowerManagement, and ersa::test::MockPowerManagement.

◆ setTestCpuFrequencyMHz()

virtual bool ersa::hal::IPowerManagement::setTestCpuFrequencyMHz ( unsigned  mhz)
pure virtual

Queue a development CPU-frequency override for the next controlled restart.

Implemented in ersa::hal::Esp32PowerManagement, and ersa::test::MockPowerManagement.

◆ testCpuFrequencyMHz()

virtual unsigned ersa::hal::IPowerManagement::testCpuFrequencyMHz ( ) const
pure virtual

Return the queued development CPU-frequency override, or zero for automatic mode.

Implemented in ersa::hal::Esp32PowerManagement, and ersa::test::MockPowerManagement.

◆ tick()

virtual void ersa::hal::IPowerManagement::tick ( )
pure virtual

Sample or apply deferred PM work without blocking the application task.

Implemented in ersa::hal::Esp32PowerManagement, and ersa::test::MockPowerManagement.

◆ waitForWake()

virtual void ersa::hal::IPowerManagement::waitForWake ( uint32_t  timeoutMs)
pure virtual

Block the UI task until notifyWake() or timeout to reduce active polling.

Implemented in ersa::hal::Esp32PowerManagement, and ersa::test::MockPowerManagement.


The documentation for this class was generated from the following file: