|
Deki 0.19.0
Modular C++ 2D engine for embedded displays and desktop
|
Device power management (sleep and wake). More...
#include <deki/providers/IPower.h>
Classes | |
| struct | SleepInfo |
Public Types | |
| enum class | State { Awake , Sleeping } |
| enum class | SleepMode { Light , Deep } |
| using | SleepCallback = std::function<void(SleepInfo)> |
Public Member Functions | |
| virtual | ~IPower ()=default |
| virtual bool | Initialize ()=0 |
| virtual void | Shutdown ()=0 |
| virtual State | GetState () const =0 |
| virtual SleepInfo | GetCurrentSleepInfo () const =0 |
| virtual bool | SupportsMode (SleepMode mode) const =0 |
| virtual void | NotifyActivity ()=0 |
| virtual void | SetIdleTimeoutSec (int32_t seconds)=0 |
| virtual void | SetIdleSleepMode (SleepMode mode)=0 |
| virtual void | RequestSleep (SleepMode mode)=0 |
| virtual void | SetWakeGpio (int gpioNum, int level)=0 |
| virtual void | RegisterOnScreenOn (SleepCallback cb)=0 |
| virtual void | RegisterOnBeforeSleep (SleepCallback cb)=0 |
| virtual void | Tick ()=0 |
Device power management (sleep and wake).
The engine uses it through the Power facade; the platform package loaded at runtime registers its driver with Power::SetCurrent at init.
Sleep modes are two platform-neutral tiers, Light and Deep, which each implementation maps to native modes: ESP32: Light -> esp_light_sleep, Deep -> esp_deep_sleep nRF52: Light -> System ON idle, Deep -> System OFF
The main loop calls Tick() once per iteration. Tick() either blocks (real light sleep, returning on wake) or, without hardware support, sets the state to Sleeping; the loop checks GetState() after Tick() and skips Update and Render while sleeping.
Boot counts as an OnScreenOn event, so one callback covers every wake including the cold boot.
| using Deki::IPower::SleepCallback = std::function<void(SleepInfo)> |
|
strong |
|
strong |
|
virtualdefault |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |