Ersa Wearable Platform
Embedded smartwatch firmware and application framework
Loading...
Searching...
No Matches
display_manager.h
Go to the documentation of this file.
1#pragma once
2
3#include "ersa/common/types.h"
4#include "ersa/hal/display.h"
5#include <stdint.h>
6
7namespace ersa {
8namespace services {
9
20public:
22 static constexpr uint32_t MIN_REFRESH_INTERVAL_MS = 500;
24 static constexpr uint16_t FULL_REFRESH_FRAME_COUNT = 360;
25
27 explicit DisplayManager(hal::IDisplay& display);
28
32 void tick(uint32_t currentUptimeMs);
33
38 void markDirty(bool fullRefresh = false);
40 bool isDirty() const;
41
42 // Trigger a refresh if dirty and interval has elapsed
47 bool updateIfDirty(uint32_t currentUptimeMs);
48
49 // Explicit force refresh
51 void refresh(bool full = false, uint32_t currentUptimeMs = 0);
52
59 void refreshRect(const Rect& bounds, bool forceFull, uint32_t currentUptimeMs);
60
62 uint16_t getPartialFrameCount() const;
65
68
70 static DisplayManager& instance();
73
74private:
76 bool dirty_{true};
77 bool fullNeeded_{true};
78 uint16_t partialFrames_{0};
79 uint32_t lastRefreshTime_{0};
80};
81
82} // namespace services
83} // namespace ersa
Definition types.h:52
Definition display.h:40
Definition display_manager.h:19
Result< void > init()
Definition display_manager.cpp:19
void tick(uint32_t currentUptimeMs)
Definition display_manager.cpp:66
hal::IDisplay & getDisplay()
Definition display_manager.cpp:80
bool updateIfDirty(uint32_t currentUptimeMs)
Definition display_manager.cpp:57
uint32_t lastRefreshTime_
Definition display_manager.h:79
uint16_t partialFrames_
Definition display_manager.h:78
uint16_t getPartialFrameCount() const
Definition display_manager.cpp:72
static DisplayManager & instance()
Return the installed process-wide display manager.
Definition display_manager.cpp:8
bool isDirty() const
Return whether the panel needs a refresh.
Definition display_manager.cpp:33
void resetPartialFrameCount()
Reset the partial-frame refresh counter.
Definition display_manager.cpp:76
static void setInstance(DisplayManager *instance)
Install a process-wide display manager for legacy service accessors.
Definition display_manager.cpp:12
void refresh(bool full=false, uint32_t currentUptimeMs=0)
Definition display_manager.cpp:37
static constexpr uint32_t MIN_REFRESH_INTERVAL_MS
Definition display_manager.h:22
static constexpr uint16_t FULL_REFRESH_FRAME_COUNT
Definition display_manager.h:24
void markDirty(bool fullRefresh=false)
Definition display_manager.cpp:26
bool fullNeeded_
Definition display_manager.h:77
bool dirty_
Definition display_manager.h:76
hal::IDisplay & display_
Definition display_manager.h:75
void refreshRect(const Rect &bounds, bool forceFull, uint32_t currentUptimeMs)
Definition display_manager.cpp:41
Definition application.h:10
Definition types.h:121