Ersa Wearable Platform
Embedded smartwatch firmware and application framework
Loading...
Searching...
No Matches
mock_power_management.h
Go to the documentation of this file.
1#pragma once
2
4
5namespace ersa::test {
7public:
8 bool initialize() override { return true; }
9 void tick() override {}
10 bool initializeWakeSources(const board::Pins&) override { wakeSourcesInitialized = true; return true; }
11 void allowAutomaticSleep(bool allow) override { sleepAllowed = allow; }
12 void waitForWake(uint32_t timeoutMs) override { lastWaitMs = timeoutMs; }
13 void notifyWake() override { ++wakeNotifications; }
14 void enterDeepSleep(uint64_t timerUs) override { lastDeepSleepUs = timerUs; }
15 bool acquirePerformance(hal::PerformanceProfile, const char*) override { ++performanceAcquires; return true; }
17 void reportPowerModes() override {}
18 bool getPowerModeReport(char*, size_t) override { return false; }
19 bool setTestCpuFrequencyMHz(unsigned mhz) override { testMHz = mhz; return true; }
20 unsigned testCpuFrequencyMHz() const override { return testMHz; }
21
23 bool sleepAllowed{false};
24 uint32_t lastWaitMs{0};
25 uint32_t wakeNotifications{0};
26 uint64_t lastDeepSleepUs{0};
29 unsigned testMHz{0};
30};
31} // namespace ersa::test
Definition pins.h:57
Definition power_management.h:27
Definition mock_power_management.h:6
unsigned testCpuFrequencyMHz() const override
Return the queued development CPU-frequency override, or zero for automatic mode.
Definition mock_power_management.h:20
uint32_t performanceAcquires
Definition mock_power_management.h:27
bool wakeSourcesInitialized
Definition mock_power_management.h:22
uint32_t performanceReleases
Definition mock_power_management.h:28
bool initializeWakeSources(const board::Pins &) override
Configure GPIO/button wake sources from the selected board's pin map.
Definition mock_power_management.h:10
void enterDeepSleep(uint64_t timerUs) override
Definition mock_power_management.h:14
uint32_t wakeNotifications
Definition mock_power_management.h:25
uint32_t lastWaitMs
Definition mock_power_management.h:24
bool sleepAllowed
Definition mock_power_management.h:23
bool acquirePerformance(hal::PerformanceProfile, const char *) override
Definition mock_power_management.h:15
unsigned testMHz
Definition mock_power_management.h:29
bool initialize() override
Definition mock_power_management.h:8
void waitForWake(uint32_t timeoutMs) override
Definition mock_power_management.h:12
void notifyWake() override
Definition mock_power_management.h:13
uint64_t lastDeepSleepUs
Definition mock_power_management.h:26
void reportPowerModes() override
Emit a one-time power-mode diagnostic report.
Definition mock_power_management.h:17
bool getPowerModeReport(char *, size_t) override
Copy a power-mode report into a caller-owned buffer.
Definition mock_power_management.h:18
void tick() override
Definition mock_power_management.h:9
void releasePerformance(hal::PerformanceProfile, const char *) override
Release a performance profile acquired earlier.
Definition mock_power_management.h:16
bool setTestCpuFrequencyMHz(unsigned mhz) override
Queue a development CPU-frequency override for the next controlled restart.
Definition mock_power_management.h:19
void allowAutomaticSleep(bool allow) override
Definition mock_power_management.h:11
PerformanceProfile
Definition power_management.h:11
Definition mock_battery.h:6