|
Ersa Wearable Platform
Embedded smartwatch firmware and application framework
|
#include <mock_display.h>


Public Member Functions | |
| MockDisplay () | |
| Result< void > | init () override |
| int16_t | width () const override |
| int16_t | height () const override |
| void | clear (hal::Color color=hal::Color::Black) override |
| void | drawPixel (int16_t x, int16_t y, hal::Color color) override |
| void | drawLine (int16_t x1, int16_t y1, int16_t x2, int16_t y2, hal::Color color) override |
| void | fillRect (int16_t x, int16_t y, int16_t w, int16_t h, hal::Color color) override |
| void | drawFastHLine (int16_t x, int16_t y, int16_t w, hal::Color color) override |
| void | drawFastVLine (int16_t x, int16_t y, int16_t h, hal::Color color) override |
| void | drawCircle (int16_t x, int16_t y, int16_t r, hal::Color color) override |
| void | fillCircle (int16_t x, int16_t y, int16_t r, hal::Color color) override |
| void | drawRoundRect (int16_t x, int16_t y, int16_t w, int16_t h, int16_t r, hal::Color color) override |
| Draw an unfilled rectangle with rounded corners. | |
| void | fillRoundRect (int16_t x, int16_t y, int16_t w, int16_t h, int16_t r, hal::Color color) override |
| Draw a filled rectangle with rounded corners. | |
| void | setFont (hal::FontFace face) override |
| void | setTextSize (uint8_t size) override |
| void | setTextColor (hal::Color color) override |
| void | setTextWrap (bool wrap) override |
| void | setCursor (int16_t x, int16_t y) override |
| size_t | print (const char *text) override |
| size_t | print (uint8_t value) override |
| Draw an unsigned byte value and return the number of characters consumed. | |
| size_t | print (int32_t value) override |
| Draw a signed 32-bit value and return the number of characters consumed. | |
| size_t | print (uint32_t value) override |
| Draw an unsigned 32-bit value and return the number of characters consumed. | |
| void | getTextBounds (const char *text, int16_t x, int16_t y, int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h) override |
| void | refresh (bool full=false) override |
| void | refreshRect (const Rect &rect) override |
| bool | isBusy () const override |
| Return whether the panel is still processing a refresh. | |
| void | setBusyCallback (hal::DisplayBusyCallback cb, void *userData=nullptr) override |
| void | powerOff () override |
| void | powerOn () override |
| bool | isPowered () const override |
| const uint8_t * | getBuffer () const override |
| uint8_t * | getBuffer () override |
| hal::Color | getPixel (int16_t x, int16_t y) const |
Public Member Functions inherited from ersa::hal::IDisplay | |
| virtual | ~IDisplay ()=default |
| 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) |
Public Attributes | |
| uint32_t | fullRefreshes_ {0} |
| uint32_t | partialRefreshes_ {0} |
| bool | powered_ {true} |
| uint32_t | drawLineCalls_ {0} |
| hal::FontFace | font_ {hal::FontFace::MiSansRegular8} |
| hal::Color | textColor_ {hal::Color::White} |
| uint8_t | textSize_ {1} |
| bool | textWrap_ {true} |
| int16_t | cursorX_ {0} |
| int16_t | cursorY_ {0} |
| std::string | lastText_ |
| int32_t | lastNumber_ {0} |
Static Public Attributes | |
| static constexpr int16_t | W = 200 |
| static constexpr int16_t | H = 200 |
Private Attributes | |
| std::vector< uint8_t > | buffer_ |
|
inline |
|
inlineoverridevirtual |
Fill the drawing buffer with one logical color; this does not itself trigger a physical panel refresh.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Draw a circle outline centered at (x, y) with the given radius.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Draw a horizontal line, allowing the backend to optimize row access.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Draw a vertical line, allowing the backend to optimize column access.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Rasterize a line from (x1, y1) to (x2, y2) in the framebuffer.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Set the framebuffer pixel at (x, y), clipping unsupported coordinates.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Draw an unfilled rectangle with rounded corners.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Fill a circle centered at (x, y) with the given radius.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Fill a rectangle with its top-left corner at (x, y).
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Draw a filled rectangle with rounded corners.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Return a non-owning read-only framebuffer view, or null if unavailable.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Return a non-owning mutable framebuffer view, or null if unavailable. Direct access is an optimization; callers must still schedule refresh().
Implements ersa::hal::IDisplay.
|
inline |
|
inlineoverridevirtual |
Measure text using the current font/size without drawing it.
| text | Null-terminated string to measure. |
| x | Baseline origin x coordinate. |
| y | Baseline origin y coordinate. |
| x1 | Receives the left edge relative to the supplied origin. |
| y1 | Receives the top edge relative to the supplied baseline. |
| w | Receives measured width in pixels. |
| h | Receives measured height in pixels. Callers should provide non-null output pointers supported by the driver. |
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Return vertical logical resolution used by app coordinates.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Initialize the panel and its drawing buffer.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Return whether the panel is still processing a refresh.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Return the driver's current powered state; this does not imply the image is visible.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Put the panel or driver into its supported low-power state. Visible-image retention and controller-state retention are device-specific.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Restore a state usable for drawing or refresh; implementations may reinitialize hardware.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Draw a null-terminated string at the current cursor and return its consumed character count. The pointer is borrowed for this call only.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Draw a signed 32-bit value and return the number of characters consumed.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Draw an unsigned 32-bit value and return the number of characters consumed.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Draw an unsigned byte value and return the number of characters consumed.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Transmit the framebuffer to the panel.
| full | Request a full waveform when true; partial waveform otherwise. |
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Update only the specified region when the panel supports partial refresh. Drivers without region updates may safely promote this to a full refresh.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Register a completion/wait callback for panel busy handling.
| cb | Callback invoked by the driver, or null to clear it. |
| userData | Opaque context passed back unchanged to cb. |
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Set the text baseline origin used by subsequent print() calls.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Select an asset-level font name; drivers map it to their own font data.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Set the color used by subsequent print() calls.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Set text scaling; size 1 is the backend's normal scale.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Control whether subsequent text wraps when it reaches the canvas edge.
Implements ersa::hal::IDisplay.
|
inlineoverridevirtual |
Return horizontal logical resolution used by app coordinates.
Implements ersa::hal::IDisplay.
|
private |
| int16_t ersa::test::MockDisplay::cursorX_ {0} |
| int16_t ersa::test::MockDisplay::cursorY_ {0} |
| uint32_t ersa::test::MockDisplay::drawLineCalls_ {0} |
| hal::FontFace ersa::test::MockDisplay::font_ {hal::FontFace::MiSansRegular8} |
| uint32_t ersa::test::MockDisplay::fullRefreshes_ {0} |
|
staticconstexpr |
| int32_t ersa::test::MockDisplay::lastNumber_ {0} |
| std::string ersa::test::MockDisplay::lastText_ |
| uint32_t ersa::test::MockDisplay::partialRefreshes_ {0} |
| bool ersa::test::MockDisplay::powered_ {true} |
| hal::Color ersa::test::MockDisplay::textColor_ {hal::Color::White} |
| uint8_t ersa::test::MockDisplay::textSize_ {1} |
| bool ersa::test::MockDisplay::textWrap_ {true} |
|
staticconstexpr |