CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
cdc::hal::EpaperDisplay Class Reference
Inheritance diagram for cdc::hal::EpaperDisplay:
cdc::hal::IDisplay cdc::core::IService

Public Member Functions

bool init () override
 Initializes display hardware, backlight, and render task.
bool start () override
 Starts display service and enables backlight.
void stop () override
 Stops display service and disables backlight.
core::ServiceState getState () const override
const char * getName () const override
void clear () override
 Clears framebuffer to white.
void flush (RefreshMode mode) override
 Requests asynchronous display refresh.
void flushSync (RefreshMode mode) override
 Performs synchronous display refresh.
bool isBusy () const override
uint16_t getWidth () const override
uint16_t getHeight () const override
void setBacklight (uint16_t level) override
 Sets current backlight level and applies immediately.
void saveBacklight () override
 Persists current backlight level.
uint16_t getBacklight () const override
bool isBacklightOn () const override
void backlightOn () override
 Enables backlight using current configured level.
void backlightOff () override
 Disables backlight output.
void * getNativeHandle () override
void showSplash (const char *subtitle=nullptr) override
 Renders and displays boot splash screen.
void drawPixel (int16_t x, int16_t y, uint16_t color) override
 Adafruit-GFX method implementations.
void drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color) override
 Draws a line on framebuffer.
void drawRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) override
 Draws rectangle outline on framebuffer.
void fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) override
 Draws filled rectangle on framebuffer.
void setCursor (int16_t x, int16_t y) override
 Sets text cursor position.
void setTextColor (uint16_t color) override
 Sets active text color.
void setTextSize (uint8_t size) override
 Sets active text scale.
void setFont (const void *font) override
 Sets active font pointer.
void print (const char *text) override
 Prints text at current cursor position.
void printf (const char *fmt,...) override
 Formatted print helper for display text output.
Public Member Functions inherited from cdc::hal::IDisplay
virtual ~IDisplay ()=default
Public Member Functions inherited from cdc::core::IService
virtual ~IService ()=default

Detailed Description

Simple display wrapper using static functions

Definition at line 173 of file EpaperDisplay.cpp.

Member Function Documentation

◆ backlightOff()

void cdc::hal::EpaperDisplay::backlightOff ( )
overridevirtual

Disables backlight output.

Implements cdc::hal::IDisplay.

Definition at line 400 of file EpaperDisplay.cpp.

References cdc::hal::applyBacklight(), LOG_I, cdc::hal::s_backlightOn, and TAG.

◆ backlightOn()

void cdc::hal::EpaperDisplay::backlightOn ( )
overridevirtual

Enables backlight using current configured level.

Implements cdc::hal::IDisplay.

Definition at line 391 of file EpaperDisplay.cpp.

References cdc::hal::applyBacklight(), LOG_I, cdc::hal::s_backlightLevel, cdc::hal::s_backlightOn, and TAG.

◆ clear()

void cdc::hal::EpaperDisplay::clear ( )
overridevirtual

Clears framebuffer to white.

Implements cdc::hal::IDisplay.

Definition at line 319 of file EpaperDisplay.cpp.

References cdc::hal::s_epd_display.

◆ drawLine()

void cdc::hal::EpaperDisplay::drawLine ( int16_t x0,
int16_t y0,
int16_t x1,
int16_t y1,
uint16_t color )
overridevirtual

Draws a line on framebuffer.

Parameters
x0Start x.
y0Start y.
x1End x.
y1End y.
colorLine color.

Implements cdc::hal::IDisplay.

Definition at line 476 of file EpaperDisplay.cpp.

References cdc::hal::s_epd_display.

◆ drawPixel()

void cdc::hal::EpaperDisplay::drawPixel ( int16_t x,
int16_t y,
uint16_t color )
overridevirtual

Adafruit-GFX method implementations.

Draws a single pixel on framebuffer.

Parameters
xX coordinate.
yY coordinate.
colorPixel color.

Implements cdc::hal::IDisplay.

Definition at line 464 of file EpaperDisplay.cpp.

References cdc::hal::s_epd_display.

◆ drawRect()

void cdc::hal::EpaperDisplay::drawRect ( int16_t x,
int16_t y,
int16_t w,
int16_t h,
uint16_t color )
overridevirtual

Draws rectangle outline on framebuffer.

Parameters
xLeft coordinate.
yTop coordinate.
wWidth.
hHeight.
colorOutline color.

Implements cdc::hal::IDisplay.

Definition at line 488 of file EpaperDisplay.cpp.

References cdc::hal::s_epd_display.

◆ fillRect()

void cdc::hal::EpaperDisplay::fillRect ( int16_t x,
int16_t y,
int16_t w,
int16_t h,
uint16_t color )
overridevirtual

Draws filled rectangle on framebuffer.

Parameters
xLeft coordinate.
yTop coordinate.
wWidth.
hHeight.
colorFill color.

Implements cdc::hal::IDisplay.

Definition at line 500 of file EpaperDisplay.cpp.

References cdc::hal::s_epd_display.

◆ flush()

void cdc::hal::EpaperDisplay::flush ( RefreshMode mode)
overridevirtual

Requests asynchronous display refresh.

Parameters
modeRefresh mode.

Implements cdc::hal::IDisplay.

Definition at line 329 of file EpaperDisplay.cpp.

References flushSync(), cdc::hal::refreshStrength(), cdc::hal::s_renderMode, cdc::hal::s_renderMutex, cdc::hal::s_renderPending, and cdc::hal::s_renderTask.

◆ flushSync()

void cdc::hal::EpaperDisplay::flushSync ( RefreshMode mode)
overridevirtual

Performs synchronous display refresh.

Parameters
modeRefresh mode.

Implements cdc::hal::IDisplay.

Definition at line 354 of file EpaperDisplay.cpp.

References cdc::hal::HEIGHT, cdc::hal::resolveFullRefresh(), cdc::hal::s_epd_display, cdc::hal::s_panelMutex, and cdc::hal::WIDTH.

Referenced by flush().

◆ getBacklight()

uint16_t cdc::hal::EpaperDisplay::getBacklight ( ) const
inlineoverridevirtual

Get current backlight level

Implements cdc::hal::IDisplay.

Definition at line 189 of file EpaperDisplay.cpp.

References cdc::hal::s_backlightLevel.

◆ getHeight()

uint16_t cdc::hal::EpaperDisplay::getHeight ( ) const
inlineoverridevirtual

Implements cdc::hal::IDisplay.

Definition at line 186 of file EpaperDisplay.cpp.

References cdc::hal::HEIGHT.

◆ getName()

const char * cdc::hal::EpaperDisplay::getName ( ) const
inlineoverridevirtual

Get service name (for logging/debugging)

Implements cdc::core::IService.

Definition at line 179 of file EpaperDisplay.cpp.

◆ getNativeHandle()

void * cdc::hal::EpaperDisplay::getNativeHandle ( )
inlineoverridevirtual

Get native display handle (for direct GFX access) Returns Gdey029T94* for the CDC Badge

Implements cdc::hal::IDisplay.

Definition at line 193 of file EpaperDisplay.cpp.

References cdc::hal::s_epd_display.

◆ getState()

core::ServiceState cdc::hal::EpaperDisplay::getState ( ) const
inlineoverridevirtual

Get current service state

Implements cdc::core::IService.

Definition at line 178 of file EpaperDisplay.cpp.

◆ getWidth()

uint16_t cdc::hal::EpaperDisplay::getWidth ( ) const
inlineoverridevirtual

Get display dimensions

Implements cdc::hal::IDisplay.

Definition at line 185 of file EpaperDisplay.cpp.

References cdc::hal::WIDTH.

◆ init()

◆ isBacklightOn()

bool cdc::hal::EpaperDisplay::isBacklightOn ( ) const
inlineoverridevirtual

Check if backlight is on (level > 0)

Implements cdc::hal::IDisplay.

Definition at line 190 of file EpaperDisplay.cpp.

References cdc::hal::s_backlightLevel, and cdc::hal::s_backlightOn.

◆ isBusy()

bool cdc::hal::EpaperDisplay::isBusy ( ) const
inlineoverridevirtual

Check if display is busy (refreshing)

Implements cdc::hal::IDisplay.

Definition at line 184 of file EpaperDisplay.cpp.

References cdc::hal::s_renderPending.

◆ print()

void cdc::hal::EpaperDisplay::print ( const char * text)
overridevirtual

Prints text at current cursor position.

Parameters
textNull-terminated string.

Implements cdc::hal::IDisplay.

Definition at line 541 of file EpaperDisplay.cpp.

References cdc::hal::s_epd_display.

◆ printf()

void cdc::hal::EpaperDisplay::printf ( const char * fmt,
... )
overridevirtual

Formatted print helper for display text output.

Parameters
fmtPrintf-style format string.

Implements cdc::hal::IDisplay.

Definition at line 549 of file EpaperDisplay.cpp.

References cdc::hal::s_epd_display.

◆ saveBacklight()

void cdc::hal::EpaperDisplay::saveBacklight ( )
overridevirtual

Persists current backlight level.

Implements cdc::hal::IDisplay.

Definition at line 384 of file EpaperDisplay.cpp.

References cdc::hal::persistBacklight(), and cdc::hal::s_backlightLevel.

◆ setBacklight()

void cdc::hal::EpaperDisplay::setBacklight ( uint16_t level)
overridevirtual

Sets current backlight level and applies immediately.

Parameters
levelNew backlight level.

Implements cdc::hal::IDisplay.

Definition at line 370 of file EpaperDisplay.cpp.

References cdc::hal::applyBacklight(), cdc::hal::BACKLIGHT_MAX, cdc::hal::s_backlightLevel, and cdc::hal::s_backlightOn.

◆ setCursor()

void cdc::hal::EpaperDisplay::setCursor ( int16_t x,
int16_t y )
overridevirtual

Sets text cursor position.

Parameters
xCursor x.
yCursor y.

Implements cdc::hal::IDisplay.

Definition at line 509 of file EpaperDisplay.cpp.

References cdc::hal::s_epd_display.

◆ setFont()

void cdc::hal::EpaperDisplay::setFont ( const void * font)
overridevirtual

Sets active font pointer.

Parameters
fontFont pointer cast-compatible with GFXfont.

Implements cdc::hal::IDisplay.

Definition at line 533 of file EpaperDisplay.cpp.

References cdc::hal::s_epd_display.

◆ setTextColor()

void cdc::hal::EpaperDisplay::setTextColor ( uint16_t color)
overridevirtual

Sets active text color.

Parameters
colorText color.

Implements cdc::hal::IDisplay.

Definition at line 517 of file EpaperDisplay.cpp.

References cdc::hal::s_epd_display.

◆ setTextSize()

void cdc::hal::EpaperDisplay::setTextSize ( uint8_t size)
overridevirtual

Sets active text scale.

Parameters
sizeText size factor.

Implements cdc::hal::IDisplay.

Definition at line 525 of file EpaperDisplay.cpp.

References cdc::hal::s_epd_display.

◆ showSplash()

void cdc::hal::EpaperDisplay::showSplash ( const char * subtitle = nullptr)
overridevirtual

Renders and displays boot splash screen.

Parameters
subtitleOptional subtitle override.

Implements cdc::hal::IDisplay.

Definition at line 410 of file EpaperDisplay.cpp.

References LOG_I, cdc::hal::s_epd_display, SPLASH_TITLE, SPLASH_VERSION, and TAG.

◆ start()

bool cdc::hal::EpaperDisplay::start ( )
overridevirtual

Starts display service and enables backlight.

Returns
true if display is started after the call.

Implements cdc::core::IService.

Definition at line 295 of file EpaperDisplay.cpp.

References cdc::hal::applyBacklight(), cdc::core::INITIALIZED, cdc::hal::s_backlightLevel, cdc::hal::s_backlightOn, and cdc::core::STARTED.

◆ stop()

void cdc::hal::EpaperDisplay::stop ( )
overridevirtual

Stops display service and disables backlight.

Implements cdc::core::IService.

Definition at line 308 of file EpaperDisplay.cpp.

References cdc::hal::applyBacklight(), cdc::hal::s_backlightOn, cdc::core::STARTED, and cdc::core::STOPPED.


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