Ersa Wearable Platform
Embedded smartwatch firmware and application framework
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
ersa::test::MockPowerManagement Class Referencefinal

#include <mock_power_management.h>

Inheritance diagram for ersa::test::MockPowerManagement:
Inheritance graph
[legend]
Collaboration diagram for ersa::test::MockPowerManagement:
Collaboration graph
[legend]

Public Member Functions

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

Public Attributes

bool wakeSourcesInitialized {false}
 
bool sleepAllowed {false}
 
uint32_t lastWaitMs {0}
 
uint32_t wakeNotifications {0}
 
uint64_t lastDeepSleepUs {0}
 
uint32_t performanceAcquires {0}
 
uint32_t performanceReleases {0}
 
unsigned testMHz {0}
 

Member Function Documentation

◆ acquirePerformance()

bool ersa::test::MockPowerManagement::acquirePerformance ( hal::PerformanceProfile  profile,
const char *  reason 
)
inlineoverridevirtual

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.

Implements ersa::hal::IPowerManagement.

◆ allowAutomaticSleep()

void ersa::test::MockPowerManagement::allowAutomaticSleep ( bool  allow)
inlineoverridevirtual

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

Implements ersa::hal::IPowerManagement.

◆ enterDeepSleep()

void ersa::test::MockPowerManagement::enterDeepSleep ( uint64_t  timerUs)
inlineoverridevirtual

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

Implements ersa::hal::IPowerManagement.

◆ getPowerModeReport()

bool ersa::test::MockPowerManagement::getPowerModeReport ( char *  buffer,
size_t  capacity 
)
inlineoverridevirtual

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

Implements ersa::hal::IPowerManagement.

◆ initialize()

bool ersa::test::MockPowerManagement::initialize ( )
inlineoverridevirtual

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

Implements ersa::hal::IPowerManagement.

◆ initializeWakeSources()

bool ersa::test::MockPowerManagement::initializeWakeSources ( const board::Pins &  pins)
inlineoverridevirtual

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

Implements ersa::hal::IPowerManagement.

◆ notifyWake()

void ersa::test::MockPowerManagement::notifyWake ( )
inlineoverridevirtual

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

Implements ersa::hal::IPowerManagement.

◆ releasePerformance()

void ersa::test::MockPowerManagement::releasePerformance ( hal::PerformanceProfile  profile,
const char *  reason 
)
inlineoverridevirtual

Release a performance profile acquired earlier.

Implements ersa::hal::IPowerManagement.

◆ reportPowerModes()

void ersa::test::MockPowerManagement::reportPowerModes ( )
inlineoverridevirtual

Emit a one-time power-mode diagnostic report.

Implements ersa::hal::IPowerManagement.

◆ setTestCpuFrequencyMHz()

bool ersa::test::MockPowerManagement::setTestCpuFrequencyMHz ( unsigned  mhz)
inlineoverridevirtual

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

Implements ersa::hal::IPowerManagement.

◆ testCpuFrequencyMHz()

unsigned ersa::test::MockPowerManagement::testCpuFrequencyMHz ( ) const
inlineoverridevirtual

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

Implements ersa::hal::IPowerManagement.

◆ tick()

void ersa::test::MockPowerManagement::tick ( )
inlineoverridevirtual

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

Implements ersa::hal::IPowerManagement.

◆ waitForWake()

void ersa::test::MockPowerManagement::waitForWake ( uint32_t  timeoutMs)
inlineoverridevirtual

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

Implements ersa::hal::IPowerManagement.

Member Data Documentation

◆ lastDeepSleepUs

uint64_t ersa::test::MockPowerManagement::lastDeepSleepUs {0}

◆ lastWaitMs

uint32_t ersa::test::MockPowerManagement::lastWaitMs {0}

◆ performanceAcquires

uint32_t ersa::test::MockPowerManagement::performanceAcquires {0}

◆ performanceReleases

uint32_t ersa::test::MockPowerManagement::performanceReleases {0}

◆ sleepAllowed

bool ersa::test::MockPowerManagement::sleepAllowed {false}

◆ testMHz

unsigned ersa::test::MockPowerManagement::testMHz {0}

◆ wakeNotifications

uint32_t ersa::test::MockPowerManagement::wakeNotifications {0}

◆ wakeSourcesInitialized

bool ersa::test::MockPowerManagement::wakeSourcesInitialized {false}

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