Ersa Wearable Platform
Embedded smartwatch firmware and application framework
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ersa::hal::IDisplay Class Referenceabstract

#include <display.h>

Inheritance diagram for ersa::hal::IDisplay:
Inheritance graph
[legend]

Public Member Functions

virtual ~IDisplay ()=default
 
virtual Result< void > init ()=0
 
virtual int16_t width () const =0
 
virtual int16_t height () const =0
 
virtual void clear (Color color=Color::Black)=0
 
virtual void drawPixel (int16_t x, int16_t y, Color color)=0
 
virtual void drawLine (int16_t x1, int16_t y1, int16_t x2, int16_t y2, Color color)=0
 
virtual void fillRect (int16_t x, int16_t y, int16_t w, int16_t h, Color color)=0
 
virtual void drawFastHLine (int16_t x, int16_t y, int16_t w, Color color)=0
 
virtual void drawFastVLine (int16_t x, int16_t y, int16_t h, Color color)=0
 
virtual void drawCircle (int16_t x, int16_t y, int16_t r, Color color)=0
 
virtual void fillCircle (int16_t x, int16_t y, int16_t r, Color color)=0
 
virtual void drawRoundRect (int16_t x, int16_t y, int16_t w, int16_t h, int16_t radius, Color color)=0
 Draw an unfilled rectangle with rounded corners.
 
virtual void fillRoundRect (int16_t x, int16_t y, int16_t w, int16_t h, int16_t radius, Color color)=0
 Draw a filled rectangle with rounded corners.
 
virtual void setFont (FontFace face)=0
 
virtual void setTextSize (uint8_t size)=0
 
virtual void setTextColor (Color color)=0
 
virtual void setTextWrap (bool wrap)=0
 
virtual void setCursor (int16_t x, int16_t y)=0
 
virtual size_t print (const char *text)=0
 
virtual size_t print (uint8_t value)=0
 Draw an unsigned byte value and return the number of characters consumed.
 
virtual size_t print (int32_t value)=0
 Draw a signed 32-bit value and return the number of characters consumed.
 
virtual size_t print (uint32_t value)=0
 Draw an unsigned 32-bit value and return the number of characters consumed.
 
virtual void getTextBounds (const char *text, int16_t x, int16_t y, int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h)=0
 
void fillScreen (uint16_t color)
 Clear the framebuffer using the legacy 0=black, nonzero=white mapping.
 
void setTextColor (uint16_t color)
 Set legacy monochrome text color; nonzero maps to white.
 
void drawLine (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 Draw a line using the legacy monochrome color convention.
 
void drawFastHLine (int16_t x, int16_t y, int16_t w, uint16_t color)
 
void drawFastVLine (int16_t x, int16_t y, int16_t h, uint16_t color)
 
void fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 
void drawCircle (int16_t x, int16_t y, int16_t r, uint16_t color)
 
void fillCircle (int16_t x, int16_t y, int16_t r, uint16_t color)
 
void drawRoundRect (int16_t x, int16_t y, int16_t w, int16_t h, int16_t r, uint16_t color)
 
void fillRoundRect (int16_t x, int16_t y, int16_t w, int16_t h, int16_t r, uint16_t color)
 
virtual void refresh (bool full=false)=0
 
virtual void refreshRect (const Rect &rect)=0
 
virtual bool isBusy () const =0
 Return whether the panel is still processing a refresh.
 
virtual void setBusyCallback (DisplayBusyCallback cb, void *userData=nullptr)=0
 
virtual void powerOff ()=0
 
virtual void powerOn ()=0
 
virtual bool isPowered () const =0
 
virtual const uint8_t * getBuffer () const =0
 
virtual uint8_t * getBuffer ()=0
 

Detailed Description

Graphics, text, refresh, and power contract consumed by watch UI code.

This is the stable renderer-facing surface for every board. Applications draw using logical colors, fonts, and coordinates; the selected driver maps those operations to e-paper, OLED, or another panel. Keeping vendor drawing types out of this interface lets a different panel driver be substituted without rewriting app code. Drawing mutates a framebuffer; refresh methods are the separate operation that transmits that buffer to the physical panel.

Constructor & Destructor Documentation

◆ ~IDisplay()

virtual ersa::hal::IDisplay::~IDisplay ( )
virtualdefault

Allow a concrete panel driver to be destroyed through this contract.

Member Function Documentation

◆ clear()

virtual void ersa::hal::IDisplay::clear ( Color  color = Color::Black)
pure virtual

Fill the drawing buffer with one logical color; this does not itself trigger a physical panel refresh.

Implemented in ersa::test::MockDisplay.

◆ drawCircle() [1/2]

virtual void ersa::hal::IDisplay::drawCircle ( int16_t  x,
int16_t  y,
int16_t  r,
Color  color 
)
pure virtual

Draw a circle outline centered at (x, y) with the given radius.

Implemented in ersa::test::MockDisplay.

◆ drawCircle() [2/2]

void ersa::hal::IDisplay::drawCircle ( int16_t  x,
int16_t  y,
int16_t  r,
uint16_t  color 
)
inline

◆ drawFastHLine() [1/2]

virtual void ersa::hal::IDisplay::drawFastHLine ( int16_t  x,
int16_t  y,
int16_t  w,
Color  color 
)
pure virtual

Draw a horizontal line, allowing the backend to optimize row access.

Implemented in ersa::test::MockDisplay.

◆ drawFastHLine() [2/2]

void ersa::hal::IDisplay::drawFastHLine ( int16_t  x,
int16_t  y,
int16_t  w,
uint16_t  color 
)
inline

◆ drawFastVLine() [1/2]

virtual void ersa::hal::IDisplay::drawFastVLine ( int16_t  x,
int16_t  y,
int16_t  h,
Color  color 
)
pure virtual

Draw a vertical line, allowing the backend to optimize column access.

Implemented in ersa::test::MockDisplay.

◆ drawFastVLine() [2/2]

void ersa::hal::IDisplay::drawFastVLine ( int16_t  x,
int16_t  y,
int16_t  h,
uint16_t  color 
)
inline

◆ drawLine() [1/2]

virtual void ersa::hal::IDisplay::drawLine ( int16_t  x1,
int16_t  y1,
int16_t  x2,
int16_t  y2,
Color  color 
)
pure virtual

Rasterize a line from (x1, y1) to (x2, y2) in the framebuffer.

Implemented in ersa::test::MockDisplay.

◆ drawLine() [2/2]

void ersa::hal::IDisplay::drawLine ( int16_t  x1,
int16_t  y1,
int16_t  x2,
int16_t  y2,
uint16_t  color 
)
inline

Draw a line using the legacy monochrome color convention.

◆ drawPixel()

virtual void ersa::hal::IDisplay::drawPixel ( int16_t  x,
int16_t  y,
Color  color 
)
pure virtual

Set the framebuffer pixel at (x, y), clipping unsupported coordinates.

Implemented in ersa::test::MockDisplay.

◆ drawRoundRect() [1/2]

void ersa::hal::IDisplay::drawRoundRect ( int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h,
int16_t  r,
uint16_t  color 
)
inline

◆ drawRoundRect() [2/2]

virtual void ersa::hal::IDisplay::drawRoundRect ( int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h,
int16_t  radius,
Color  color 
)
pure virtual

Draw an unfilled rectangle with rounded corners.

Implemented in ersa::test::MockDisplay.

◆ fillCircle() [1/2]

virtual void ersa::hal::IDisplay::fillCircle ( int16_t  x,
int16_t  y,
int16_t  r,
Color  color 
)
pure virtual

Fill a circle centered at (x, y) with the given radius.

Implemented in ersa::test::MockDisplay.

◆ fillCircle() [2/2]

void ersa::hal::IDisplay::fillCircle ( int16_t  x,
int16_t  y,
int16_t  r,
uint16_t  color 
)
inline

◆ fillRect() [1/2]

virtual void ersa::hal::IDisplay::fillRect ( int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h,
Color  color 
)
pure virtual

Fill a rectangle with its top-left corner at (x, y).

Implemented in ersa::test::MockDisplay.

◆ fillRect() [2/2]

void ersa::hal::IDisplay::fillRect ( int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h,
uint16_t  color 
)
inline

◆ fillRoundRect() [1/2]

void ersa::hal::IDisplay::fillRoundRect ( int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h,
int16_t  r,
uint16_t  color 
)
inline

◆ fillRoundRect() [2/2]

virtual void ersa::hal::IDisplay::fillRoundRect ( int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h,
int16_t  radius,
Color  color 
)
pure virtual

Draw a filled rectangle with rounded corners.

Implemented in ersa::test::MockDisplay.

◆ fillScreen()

void ersa::hal::IDisplay::fillScreen ( uint16_t  color)
inline

Clear the framebuffer using the legacy 0=black, nonzero=white mapping.

◆ getBuffer() [1/2]

virtual const uint8_t * ersa::hal::IDisplay::getBuffer ( ) const
pure virtual

Return a non-owning read-only framebuffer view, or null if unavailable.

Implemented in ersa::test::MockDisplay.

◆ getBuffer() [2/2]

virtual uint8_t * ersa::hal::IDisplay::getBuffer ( )
pure virtual

Return a non-owning mutable framebuffer view, or null if unavailable. Direct access is an optimization; callers must still schedule refresh().

Implemented in ersa::test::MockDisplay.

◆ getTextBounds()

virtual void ersa::hal::IDisplay::getTextBounds ( const char *  text,
int16_t  x,
int16_t  y,
int16_t *  x1,
int16_t *  y1,
uint16_t *  w,
uint16_t *  h 
)
pure virtual

Measure text using the current font/size without drawing it.

Parameters
textNull-terminated string to measure.
xBaseline origin x coordinate.
yBaseline origin y coordinate.
x1Receives the left edge relative to the supplied origin.
y1Receives the top edge relative to the supplied baseline.
wReceives measured width in pixels.
hReceives measured height in pixels. Callers should provide non-null output pointers supported by the driver.

Implemented in ersa::test::MockDisplay.

◆ height()

virtual int16_t ersa::hal::IDisplay::height ( ) const
pure virtual

Return vertical logical resolution used by app coordinates.

Implemented in ersa::test::MockDisplay.

◆ init()

virtual Result< void > ersa::hal::IDisplay::init ( )
pure virtual

Initialize the panel and its drawing buffer.

Returns
An error when the controller or required buffer is unavailable.

Implemented in ersa::test::MockDisplay.

◆ isBusy()

virtual bool ersa::hal::IDisplay::isBusy ( ) const
pure virtual

Return whether the panel is still processing a refresh.

Implemented in ersa::test::MockDisplay.

◆ isPowered()

virtual bool ersa::hal::IDisplay::isPowered ( ) const
pure virtual

Return the driver's current powered state; this does not imply the image is visible.

Implemented in ersa::test::MockDisplay.

◆ powerOff()

virtual void ersa::hal::IDisplay::powerOff ( )
pure virtual

Put the panel or driver into its supported low-power state. Visible-image retention and controller-state retention are device-specific.

Implemented in ersa::test::MockDisplay.

◆ powerOn()

virtual void ersa::hal::IDisplay::powerOn ( )
pure virtual

Restore a state usable for drawing or refresh; implementations may reinitialize hardware.

Implemented in ersa::test::MockDisplay.

◆ print() [1/4]

virtual size_t ersa::hal::IDisplay::print ( const char *  text)
pure virtual

Draw a null-terminated string at the current cursor and return its consumed character count. The pointer is borrowed for this call only.

Implemented in ersa::test::MockDisplay.

◆ print() [2/4]

virtual size_t ersa::hal::IDisplay::print ( int32_t  value)
pure virtual

Draw a signed 32-bit value and return the number of characters consumed.

Implemented in ersa::test::MockDisplay.

◆ print() [3/4]

virtual size_t ersa::hal::IDisplay::print ( uint32_t  value)
pure virtual

Draw an unsigned 32-bit value and return the number of characters consumed.

Implemented in ersa::test::MockDisplay.

◆ print() [4/4]

virtual size_t ersa::hal::IDisplay::print ( uint8_t  value)
pure virtual

Draw an unsigned byte value and return the number of characters consumed.

Implemented in ersa::test::MockDisplay.

◆ refresh()

virtual void ersa::hal::IDisplay::refresh ( bool  full = false)
pure virtual

Transmit the framebuffer to the panel.

Parameters
fullRequest a full waveform when true; partial waveform otherwise.

Implemented in ersa::test::MockDisplay.

◆ refreshRect()

virtual void ersa::hal::IDisplay::refreshRect ( const Rect &  rect)
pure virtual

Update only the specified region when the panel supports partial refresh. Drivers without region updates may safely promote this to a full refresh.

Implemented in ersa::test::MockDisplay.

◆ setBusyCallback()

virtual void ersa::hal::IDisplay::setBusyCallback ( DisplayBusyCallback  cb,
void *  userData = nullptr 
)
pure virtual

Register a completion/wait callback for panel busy handling.

Parameters
cbCallback invoked by the driver, or null to clear it.
userDataOpaque context passed back unchanged to cb.

Implemented in ersa::test::MockDisplay.

◆ setCursor()

virtual void ersa::hal::IDisplay::setCursor ( int16_t  x,
int16_t  y 
)
pure virtual

Set the text baseline origin used by subsequent print() calls.

Implemented in ersa::test::MockDisplay.

◆ setFont()

virtual void ersa::hal::IDisplay::setFont ( FontFace  face)
pure virtual

Select an asset-level font name; drivers map it to their own font data.

Implemented in ersa::test::MockDisplay.

◆ setTextColor() [1/2]

virtual void ersa::hal::IDisplay::setTextColor ( Color  color)
pure virtual

Set the color used by subsequent print() calls.

Implemented in ersa::test::MockDisplay.

◆ setTextColor() [2/2]

void ersa::hal::IDisplay::setTextColor ( uint16_t  color)
inline

Set legacy monochrome text color; nonzero maps to white.

◆ setTextSize()

virtual void ersa::hal::IDisplay::setTextSize ( uint8_t  size)
pure virtual

Set text scaling; size 1 is the backend's normal scale.

Implemented in ersa::test::MockDisplay.

◆ setTextWrap()

virtual void ersa::hal::IDisplay::setTextWrap ( bool  wrap)
pure virtual

Control whether subsequent text wraps when it reaches the canvas edge.

Implemented in ersa::test::MockDisplay.

◆ width()

virtual int16_t ersa::hal::IDisplay::width ( ) const
pure virtual

Return horizontal logical resolution used by app coordinates.

Implemented in ersa::test::MockDisplay.


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