Ersa Wearable Platform
Embedded smartwatch firmware and application framework
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | List of all members
ersa::services::DisplayManager Class Reference

#include <display_manager.h>

Collaboration diagram for ersa::services::DisplayManager:
Collaboration graph
[legend]

Public Member Functions

 DisplayManager (hal::IDisplay &display)
 
Result< void > init ()
 
void tick (uint32_t currentUptimeMs)
 
void markDirty (bool fullRefresh=false)
 
bool isDirty () const
 Return whether the panel needs a refresh.
 
bool updateIfDirty (uint32_t currentUptimeMs)
 
void refresh (bool full=false, uint32_t currentUptimeMs=0)
 
void refreshRect (const Rect &bounds, bool forceFull, uint32_t currentUptimeMs)
 
uint16_t getPartialFrameCount () const
 
void resetPartialFrameCount ()
 Reset the partial-frame refresh counter.
 
hal::IDisplay & getDisplay ()
 

Static Public Member Functions

static DisplayManager & instance ()
 Return the installed process-wide display manager.
 
static void setInstance (DisplayManager *instance)
 Install a process-wide display manager for legacy service accessors.
 

Static Public Attributes

static constexpr uint32_t MIN_REFRESH_INTERVAL_MS = 500
 
static constexpr uint16_t FULL_REFRESH_FRAME_COUNT = 360
 

Private Attributes

hal::IDisplay & display_
 
bool dirty_ {true}
 
bool fullNeeded_ {true}
 
uint16_t partialFrames_ {0}
 
uint32_t lastRefreshTime_ {0}
 

Detailed Description

Coalesces drawing changes and applies panel-specific refresh policy.

Apps only mark content dirty; this manager rate-limits physical refreshes and tracks partial-frame counts. E-paper drivers disable panel drive voltage after each refresh while retaining the visible image. Keeping those decisions here prevents fast UI events from causing excessive e-paper flashing or shortening panel lifetime.

Constructor & Destructor Documentation

◆ DisplayManager()

ersa::services::DisplayManager::DisplayManager ( hal::IDisplay &  display)
explicit

Bind the generic display; manager does not own the driver object.

Member Function Documentation

◆ getDisplay()

hal::IDisplay & ersa::services::DisplayManager::getDisplay ( )

Return the borrowed display HAL so coordinated services share one panel.

◆ getPartialFrameCount()

uint16_t ersa::services::DisplayManager::getPartialFrameCount ( ) const

Read the ghosting-policy counter used to decide when to full-refresh.

◆ init()

Result< void > ersa::services::DisplayManager::init ( )

Initialize the panel and seed refresh/idle bookkeeping.

◆ instance()

DisplayManager & ersa::services::DisplayManager::instance ( )
static

Return the installed process-wide display manager.

◆ isDirty()

bool ersa::services::DisplayManager::isDirty ( ) const

Return whether the panel needs a refresh.

◆ markDirty()

void ersa::services::DisplayManager::markDirty ( bool  fullRefresh = false)

Record invalidated framebuffer content; repeated marks coalesce into one future refresh. A full request is sticky until serviced.

◆ refresh()

void ersa::services::DisplayManager::refresh ( bool  full = false,
uint32_t  currentUptimeMs = 0 
)

Bypass dirty scheduling for explicit refresh requests, such as redraw.

◆ refreshRect()

void ersa::services::DisplayManager::refreshRect ( const Rect &  bounds,
bool  forceFull,
uint32_t  currentUptimeMs 
)

Refresh an invalidated region and centralize full-waveform cadence.

Parameters
boundsChanged framebuffer area; ignored for a full waveform.
forceFullRequest a full waveform for first frame or known day change.
currentUptimeMsMonotonic time used to update panel bookkeeping.

◆ resetPartialFrameCount()

void ersa::services::DisplayManager::resetPartialFrameCount ( )

Reset the partial-frame refresh counter.

◆ setInstance()

void ersa::services::DisplayManager::setInstance ( DisplayManager *  instance)
static

Install a process-wide display manager for legacy service accessors.

◆ tick()

void ersa::services::DisplayManager::tick ( uint32_t  currentUptimeMs)

Apply deferred display policy for the current uptime.

◆ updateIfDirty()

bool ersa::services::DisplayManager::updateIfDirty ( uint32_t  currentUptimeMs)

Submit one pending update only after the minimum refresh interval.

Returns
True when a panel refresh was submitted this call.

Member Data Documentation

◆ dirty_

bool ersa::services::DisplayManager::dirty_ {true}
private

◆ display_

hal::IDisplay& ersa::services::DisplayManager::display_
private

◆ FULL_REFRESH_FRAME_COUNT

constexpr uint16_t ersa::services::DisplayManager::FULL_REFRESH_FRAME_COUNT = 360
staticconstexpr

Partial frames before policy requests a full ghost-clearing waveform.

◆ fullNeeded_

bool ersa::services::DisplayManager::fullNeeded_ {true}
private

◆ lastRefreshTime_

uint32_t ersa::services::DisplayManager::lastRefreshTime_ {0}
private

◆ MIN_REFRESH_INTERVAL_MS

constexpr uint32_t ersa::services::DisplayManager::MIN_REFRESH_INTERVAL_MS = 500
staticconstexpr

Minimum delay between refresh submissions, protecting panel timing.

◆ partialFrames_

uint16_t ersa::services::DisplayManager::partialFrames_ {0}
private

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