idfxx 1.0.0
Modern C++23 components for ESP-IDF
Loading...
Searching...
No Matches
idfxx::epaper::panel Class Referenceabstract

Abstract base class for ePaper display panels. More...

Inheritance diagram for idfxx::epaper::panel:
idfxx::epaper::ssd1680 idfxx::epaper::uc8179

Public Member Functions

virtual ~panel ()=default
 
 panel (const panel &)=delete
 
paneloperator= (const panel &)=delete
 
size_t width () const noexcept
 Returns the panel width in pixels.
 
size_t height () const noexcept
 Returns the panel height in pixels.
 
enum color_mode color_mode () const noexcept
 Returns the panel's current pixel format.
 
bool asleep () const noexcept
 Returns whether the panel is in deep sleep.
 
void write (const mono_framebuffer &fb, size_t x=0, size_t y=0)
 Uploads a monochrome framebuffer to the controller's RAM.
 
void write (const gray4_framebuffer &fb, size_t x=0, size_t y=0)
 Uploads a grayscale framebuffer to the controller's RAM.
 
void write_rows (const mono_framebuffer &fb, size_t row_start, size_t row_end, size_t x=0, size_t y=0)
 Uploads a horizontal band of a monochrome framebuffer.
 
void write_rows (const gray4_framebuffer &fb, size_t row_start, size_t row_end, size_t x=0, size_t y=0)
 Uploads a horizontal band of a grayscale framebuffer.
 
void clear ()
 Clears the controller's RAM to white, without a framebuffer.
 
result< void > try_write (const mono_framebuffer &fb, size_t x=0, size_t y=0)
 Uploads a monochrome framebuffer to the controller's RAM.
 
result< void > try_write (const gray4_framebuffer &fb, size_t x=0, size_t y=0)
 Uploads a grayscale framebuffer to the controller's RAM.
 
result< void > try_write_rows (const mono_framebuffer &fb, size_t row_start, size_t row_end, size_t x=0, size_t y=0)
 Uploads a horizontal band of a monochrome framebuffer.
 
result< void > try_write_rows (const gray4_framebuffer &fb, size_t row_start, size_t row_end, size_t x=0, size_t y=0)
 Uploads a horizontal band of a grayscale framebuffer.
 
result< void > try_clear ()
 Clears the controller's RAM to white, without a framebuffer.
 
void refresh (refresh_mode mode=refresh_mode::full)
 Refreshes the panel from the controller's RAM.
 
void wait ()
 Waits for the controller's BUSY line to release.
 
template<typename Rep , typename Period >
void wait_for (const std::chrono::duration< Rep, Period > &timeout)
 Waits for the controller's BUSY line to release, with a timeout.
 
result< void > try_refresh (refresh_mode mode=refresh_mode::full)
 Refreshes the panel from the controller's RAM.
 
result< void > try_wait ()
 Waits for the controller's BUSY line to release.
 
template<typename Rep , typename Period >
result< void > try_wait_for (const std::chrono::duration< Rep, Period > &timeout)
 Waits for the controller's BUSY line to release, with a timeout.
 
void set_color_mode (enum color_mode mode)
 Switches the panel between monochrome and grayscale operation.
 
result< void > try_set_color_mode (enum color_mode mode)
 Switches the panel between monochrome and grayscale operation.
 
void sleep ()
 Puts the panel controller into deep sleep.
 
void wake ()
 Wakes the panel controller from deep sleep.
 
result< void > try_sleep ()
 Puts the panel controller into deep sleep.
 
result< void > try_wake ()
 Wakes the panel controller from deep sleep.
 

Protected Member Functions

 panel (size_t width, size_t height) noexcept
 Constructs the panel base with the given dimensions and no control lines.
 
 panel (size_t width, size_t height, gpio busy_gpio, enum gpio::level busy_level, std::chrono::milliseconds busy_timeout, gpio reset_gpio) noexcept
 Constructs the panel base with the given dimensions and control lines.
 
 panel (panel &&) noexcept=default
 
paneloperator= (panel &&) noexcept=default
 
gpio busy_gpio () const noexcept
 Returns the BUSY input pin (may be unconnected).
 
gpio reset_gpio () const noexcept
 Returns the reset output pin (may be unconnected).
 
std::chrono::milliseconds busy_timeout () const noexcept
 Returns the default BUSY timeout.
 
virtual result< void > do_write (const mono_framebuffer &fb, size_t row_start, size_t row_end, size_t x, size_t y)=0
 Hook for try_write / try_write_rows (monochrome).
 
virtual result< void > do_write (const gray4_framebuffer &fb, size_t row_start, size_t row_end, size_t x, size_t y)
 Hook for try_write / try_write_rows (grayscale).
 
virtual result< void > do_clear ()=0
 Hook for try_clear.
 
virtual result< void > do_refresh (refresh_mode mode)=0
 Hook for try_refresh.
 
virtual result< void > do_set_color_mode (enum color_mode mode)
 Hook for try_set_color_mode.
 
virtual result< void > do_sleep ()=0
 Hook for try_sleep. Called only while the panel is awake.
 
virtual result< void > do_wake ()=0
 Hook for try_wake.
 
virtual result< void > do_wait (std::optional< std::chrono::milliseconds > timeout)
 Hook for try_wait / try_wait_for.
 
result< void > wait_busy (std::optional< std::chrono::milliseconds > timeout=std::nullopt)
 Polls the BUSY line until it releases.
 
result< void > hardware_reset ()
 Pulses the reset line and waits for the controller to settle.
 

Static Protected Member Functions

static result< void > configure_control_lines (gpio busy_gpio, gpio reset_gpio)
 Configures the direction of the BUSY and reset pins.
 

Detailed Description

Abstract base class for ePaper display panels.

The public interface is non-virtual; concrete drivers (e.g. idfxx::epaper::ssd1680) customize behaviour by overriding the protected do_* hooks, mirroring the standard library's non-virtual-interface pattern (cf. std::pmr::memory_resource).

The interface follows the ePaper update cycle:

  1. write uploads framebuffer pixels to the controller's RAM at a pixel offset. Nothing changes on the glass yet, and writes may be repeated to compose a frame from multiple buffers. A write does not retain a reference to the framebuffer: it may be redrawn immediately after the call returns.
  2. refresh drives the physical ink update from the controller's RAM and blocks until the panel's BUSY line reports completion.
  3. sleep puts the controller into deep sleep between updates — essential for ePaper longevity and power; wake restores it.
idfxx::epaper::mono_framebuffer fb(display.width(), display.height());
idfxx::gfx::canvas canvas(fb);
canvas.draw_text(idfxx::font::spleen_8x16, 4, 4, "hello", true);
fb.flush(display); // upload to controller RAM
display.refresh(); // make it visible
display.sleep(); // deep sleep until the next update
In-memory framebuffer for monochrome (1 bit per pixel) ePaper displays.
A drawing view bundling a pixel surface with the drawing primitives.
Definition gfx.hpp:393
const mono_font spleen_8x16
Spleen 8x16 — headline text; scale 2 gives 16x32 digits.

Definition at line 116 of file panel.hpp.

Constructor & Destructor Documentation

◆ ~panel()

virtual idfxx::epaper::panel::~panel ( )
virtualdefault

◆ panel() [1/4]

idfxx::epaper::panel::panel ( const panel )
delete

◆ panel() [2/4]

idfxx::epaper::panel::panel ( size_t  width,
size_t  height 
)
inlineprotectednoexcept

Constructs the panel base with the given dimensions and no control lines.

The default do_wait then returns success immediately; drivers managing BUSY themselves should override it.

Parameters
widthPanel width in pixels.
heightPanel height in pixels.

Definition at line 642 of file panel.hpp.

◆ panel() [3/4]

idfxx::epaper::panel::panel ( size_t  width,
size_t  height,
gpio  busy_gpio,
enum gpio::level  busy_level,
std::chrono::milliseconds  busy_timeout,
gpio  reset_gpio 
)
inlineprotectednoexcept

Constructs the panel base with the given dimensions and control lines.

The base then owns the physical control lines: the default do_wait polls busy_gpio, and hardware_reset pulses reset_gpio. Configure the pin directions first (see configure_control_lines).

Parameters
widthPanel width in pixels.
heightPanel height in pixels.
busy_gpioThe BUSY input pin, or gpio::nc().
busy_levelThe level the controller drives while busy.
busy_timeoutDefault maximum time to wait for BUSY to release.
reset_gpioThe reset output pin, or gpio::nc().

Definition at line 662 of file panel.hpp.

◆ panel() [4/4]

idfxx::epaper::panel::panel ( panel &&  )
protecteddefaultnoexcept

Member Function Documentation

◆ asleep()

bool idfxx::epaper::panel::asleep ( ) const
inlinenoexcept

Returns whether the panel is in deep sleep.

True after a successful sleep and until the next successful wake. While asleep, writes and refreshes report errc::invalid_state.

Returns
true if the panel is in deep sleep.

Definition at line 152 of file panel.hpp.

◆ busy_gpio()

gpio idfxx::epaper::panel::busy_gpio ( ) const
inlineprotectednoexcept

Returns the BUSY input pin (may be unconnected).

Definition at line 681 of file panel.hpp.

◆ busy_timeout()

std::chrono::milliseconds idfxx::epaper::panel::busy_timeout ( ) const
inlineprotectednoexcept

Returns the default BUSY timeout.

Definition at line 687 of file panel.hpp.

◆ clear()

void idfxx::epaper::panel::clear ( )
inline

Clears the controller's RAM to white, without a framebuffer.

Fills the entire image RAM with white (blank paper) in the current color mode. Like a write, the cleared frame is invisible until the next refresh — which is promoted to refresh_mode::full, since the cleared RAM no longer matches what a partial refresh would diff against.

Useful for blanking the display, or for erasing previous content before switching to color_mode::gray4, whose waveform erases less aggressively than a monochrome full refresh.

Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron failure, including errc::invalid_state if the panel is asleep.

Definition at line 263 of file panel.hpp.

References try_clear(), and idfxx::unwrap().

◆ color_mode()

enum color_mode idfxx::epaper::panel::color_mode ( ) const
inlinenoexcept

Returns the panel's current pixel format.

Reflects the most recent successful try_set_color_mode / set_color_mode, or color_mode::mono before any call.

Returns
The current color mode.

Definition at line 141 of file panel.hpp.

◆ configure_control_lines()

static result< void > idfxx::epaper::panel::configure_control_lines ( gpio  busy_gpio,
gpio  reset_gpio 
)
staticprotected

Configures the direction of the BUSY and reset pins.

Shared helper for driver factories, run before construction: sets busy_gpio as an input (it is driven by the panel, so no pull is needed) and, when connected, reset_gpio as an output idling high.

Parameters
busy_gpioThe BUSY input pin (required).
reset_gpioThe reset output pin, or gpio::nc().
Returns
Success, or an error.
Return values
invalid_argbusy_gpio is not connected.

◆ do_clear()

virtual result< void > idfxx::epaper::panel::do_clear ( )
protectedpure virtual

Hook for try_clear.

Fills the entire image RAM with white in the current color mode. The panel is awake; the base class invalidates the partial-refresh baseline after a successful clear.

Referenced by try_clear().

◆ do_refresh()

virtual result< void > idfxx::epaper::panel::do_refresh ( refresh_mode  mode)
protectedpure virtual

Hook for try_refresh.

The panel is awake, and a partial request has already been promoted to full when no baseline exists. Must block until the update completes (or times out), and must return errc::not_supported for a mode the driver cannot perform in the current color mode.

Referenced by try_refresh().

◆ do_set_color_mode()

virtual result< void > idfxx::epaper::panel::do_set_color_mode ( enum color_mode  mode)
inlineprotectedvirtual

Hook for try_set_color_mode.

Called only for an actual mode change while the panel is awake. The default returns errc::not_supported: drivers with grayscale support override it.

Definition at line 741 of file panel.hpp.

References idfxx::error(), and idfxx::not_supported.

Referenced by try_set_color_mode().

◆ do_sleep()

virtual result< void > idfxx::epaper::panel::do_sleep ( )
protectedpure virtual

Hook for try_sleep. Called only while the panel is awake.

Referenced by try_sleep().

◆ do_wait()

virtual result< void > idfxx::epaper::panel::do_wait ( std::optional< std::chrono::milliseconds >  timeout)
inlineprotectedvirtual

Hook for try_wait / try_wait_for.

A std::nullopt timeout selects the driver's configured default. The default implementation polls the BUSY line configured at construction (see wait_busy).

Definition at line 755 of file panel.hpp.

References idfxx::timeout, and wait_busy().

Referenced by try_wait(), and try_wait_for().

◆ do_wake()

virtual result< void > idfxx::epaper::panel::do_wake ( )
protectedpure virtual

Hook for try_wake.

Must hardware-reset the controller, re-initialize it, and restore the current color mode.

Referenced by try_wake().

◆ do_write() [1/2]

virtual result< void > idfxx::epaper::panel::do_write ( const gray4_framebuffer fb,
size_t  row_start,
size_t  row_end,
size_t  x,
size_t  y 
)
inlineprotectedvirtual

Hook for try_write / try_write_rows (grayscale).

Uploads rows [row_start, row_end) of fb with its origin at (x, y). The placement is aligned and in-bounds, the row range is valid, and the panel is awake and in color_mode::gray4. Must not reference fb's storage after returning: callers may mutate the framebuffer immediately. The default returns errc::not_supported; drivers with grayscale support override it alongside do_set_color_mode (without that override the panel never enters color_mode::gray4, so this hook is never reached).

Definition at line 717 of file panel.hpp.

References idfxx::error(), and idfxx::not_supported.

◆ do_write() [2/2]

virtual result< void > idfxx::epaper::panel::do_write ( const mono_framebuffer fb,
size_t  row_start,
size_t  row_end,
size_t  x,
size_t  y 
)
protectedpure virtual

Hook for try_write / try_write_rows (monochrome).

Uploads rows [row_start, row_end) of fb with its origin at (x, y). The placement is aligned and in-bounds, the row range is valid, and the panel is awake and in color_mode::mono. Must not reference fb's storage after returning: callers may mutate the framebuffer immediately.

◆ hardware_reset()

result< void > idfxx::epaper::panel::hardware_reset ( )
protected

Pulses the reset line and waits for the controller to settle.

Drives the reset pin configured at construction low for 10 ms, back high for 10 ms, then waits for the BUSY line to release.

Returns
Success, or an error.
Return values
invalid_stateNo reset pin is configured.
timeoutThe BUSY line did not release after the reset.

◆ height()

size_t idfxx::epaper::panel::height ( ) const
inlinenoexcept

Returns the panel height in pixels.

Definition at line 131 of file panel.hpp.

◆ operator=() [1/2]

panel & idfxx::epaper::panel::operator= ( const panel )
delete

◆ operator=() [2/2]

panel & idfxx::epaper::panel::operator= ( panel &&  )
protecteddefaultnoexcept

◆ refresh()

void idfxx::epaper::panel::refresh ( refresh_mode  mode = refresh_mode::full)
inline

Refreshes the panel from the controller's RAM.

Drives the physical ink update, making previously written pixel data visible, and blocks until the controller's BUSY line reports completion. Full refreshes take on the order of seconds; partial refreshes well under a second, depending on the panel.

A refresh_mode::partial refresh needs a baseline image from a previous refresh to diff against; the first refresh after construction, wake, or a color-mode change is silently promoted to refresh_mode::full.

Parameters
modeThe refresh style to use.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron failure, including errc::timeout if the BUSY line does not release in time, errc::invalid_state if the panel is asleep, and errc::not_supported if the driver does not support mode in the current color mode.

Definition at line 403 of file panel.hpp.

References try_refresh(), and idfxx::unwrap().

◆ reset_gpio()

gpio idfxx::epaper::panel::reset_gpio ( ) const
inlineprotectednoexcept

Returns the reset output pin (may be unconnected).

Definition at line 684 of file panel.hpp.

◆ set_color_mode()

void idfxx::epaper::panel::set_color_mode ( enum color_mode  mode)
inline

Switches the panel between monochrome and grayscale operation.

Reconfigures the controller's waveforms for the new pixel format and invalidates the partial-refresh baseline: the next refresh is promoted to refresh_mode::full. A no-op if the panel is already in the requested mode.

Parameters
modeThe pixel format to operate in.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron failure, including errc::invalid_state if the panel is asleep, and errc::not_supported if the driver has no grayscale support.

Definition at line 520 of file panel.hpp.

References try_set_color_mode(), and idfxx::unwrap().

◆ sleep()

void idfxx::epaper::panel::sleep ( )
inline

Puts the panel controller into deep sleep.

ePaper retains its image without power, so sleeping between updates costs nothing visually and is strongly recommended — both for power and for panel longevity (controllers left active can degrade the glass). While asleep, writes and refreshes report errc::invalid_state; call wake to resume. A no-op if the panel is already asleep.

Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron failure.

Definition at line 569 of file panel.hpp.

References try_sleep(), and idfxx::unwrap().

◆ try_clear()

result< void > idfxx::epaper::panel::try_clear ( )
inline

Clears the controller's RAM to white, without a framebuffer.

Fills the entire image RAM with white (blank paper) in the current color mode. Like a write, the cleared frame is invisible until the next try_refresh — which is promoted to refresh_mode::full, since the cleared RAM no longer matches what a partial refresh would diff against.

Useful for blanking the display, or for erasing previous content before switching to color_mode::gray4, whose waveform erases less aggressively than a monochrome full refresh.

Returns
Success, or an error.
Return values
invalid_stateThe panel is asleep.

Definition at line 367 of file panel.hpp.

References do_clear(), idfxx::error(), and idfxx::invalid_state.

Referenced by clear().

◆ try_refresh()

result< void > idfxx::epaper::panel::try_refresh ( refresh_mode  mode = refresh_mode::full)
inline

Refreshes the panel from the controller's RAM.

Drives the physical ink update, making previously written pixel data visible, and blocks until the controller's BUSY line reports completion. Full refreshes take on the order of seconds; partial refreshes well under a second, depending on the panel.

A refresh_mode::partial refresh needs a baseline image from a previous refresh to diff against; the first refresh after construction, try_wake, or a color-mode change is silently promoted to refresh_mode::full.

Parameters
modeThe refresh style to use.
Returns
Success, or an error.
Return values
timeoutThe BUSY line did not release in time.
invalid_stateThe panel is asleep.
not_supportedThe driver does not support mode in the current color mode (e.g. fast/partial in color_mode::gray4 on current drivers).

Definition at line 458 of file panel.hpp.

References do_refresh(), idfxx::error(), idfxx::epaper::full, idfxx::invalid_state, and idfxx::epaper::partial.

Referenced by refresh().

◆ try_set_color_mode()

result< void > idfxx::epaper::panel::try_set_color_mode ( enum color_mode  mode)
inline

Switches the panel between monochrome and grayscale operation.

Reconfigures the controller's waveforms for the new pixel format and invalidates the partial-refresh baseline: the next refresh is promoted to refresh_mode::full. A no-op if the panel is already in the requested mode.

Parameters
modeThe pixel format to operate in.
Returns
Success, or an error.
Return values
invalid_stateThe panel is asleep.
not_supportedThe driver has no grayscale support.

Definition at line 536 of file panel.hpp.

References do_set_color_mode(), idfxx::error(), and idfxx::invalid_state.

Referenced by set_color_mode().

◆ try_sleep()

result< void > idfxx::epaper::panel::try_sleep ( )
inline

Puts the panel controller into deep sleep.

ePaper retains its image without power, so sleeping between updates costs nothing visually and is strongly recommended — both for power and for panel longevity (controllers left active can degrade the glass). While asleep, writes and refreshes report errc::invalid_state; call try_wake to resume. A no-op if the panel is already asleep.

Returns
Success, or an error.

Definition at line 599 of file panel.hpp.

References do_sleep().

Referenced by sleep().

◆ try_wait()

result< void > idfxx::epaper::panel::try_wait ( )
inline

Waits for the controller's BUSY line to release.

Blocks while the controller reports it is busy, up to the driver's configured default timeout. try_refresh already waits for completion; this is useful before driver-specific raw operations or after recovering from an error.

Returns
Success, or an error.
Return values
timeoutThe BUSY line did not release in time.

Definition at line 483 of file panel.hpp.

References do_wait().

Referenced by wait().

◆ try_wait_for()

template<typename Rep , typename Period >
result< void > idfxx::epaper::panel::try_wait_for ( const std::chrono::duration< Rep, Period > &  timeout)
inline

Waits for the controller's BUSY line to release, with a timeout.

Blocks while the controller reports it is busy, up to timeout.

Template Parameters
RepDuration arithmetic type.
PeriodDuration period type.
Parameters
timeoutMaximum time to wait.
Returns
Success, or an error.
Return values
timeoutThe BUSY line did not release within timeout.

Definition at line 497 of file panel.hpp.

References do_wait(), and idfxx::timeout.

Referenced by wait_for().

◆ try_wake()

result< void > idfxx::epaper::panel::try_wake ( )
inline

Wakes the panel controller from deep sleep.

ePaper controllers require a hardware reset to leave deep sleep, so this pulses the driver's reset line and re-runs the full controller initialization, restoring the configured color mode. The partial-refresh baseline is lost: the next refresh is promoted to refresh_mode::full.

Returns
Success, or an error.
Return values
invalid_stateNo reset line is configured.

Definition at line 622 of file panel.hpp.

References do_wake().

Referenced by wake().

◆ try_write() [1/2]

result< void > idfxx::epaper::panel::try_write ( const gray4_framebuffer fb,
size_t  x = 0,
size_t  y = 0 
)

Uploads a grayscale framebuffer to the controller's RAM.

Places the framebuffer's origin at pixel (x, y). The upload is invisible until the next try_refresh. The panel must be operating in color_mode::gray4.

Parameters
fbThe framebuffer to upload.
xDestination column; must be a multiple of 8 (controller RAM is byte-packed along the row).
yDestination row.
Returns
Success, or an error.
Return values
invalid_argx is not a multiple of 8, or the framebuffer does not fit within the panel at (x, y).
invalid_stateThe panel is asleep, or is operating in color_mode::mono.

◆ try_write() [2/2]

result< void > idfxx::epaper::panel::try_write ( const mono_framebuffer fb,
size_t  x = 0,
size_t  y = 0 
)

Uploads a monochrome framebuffer to the controller's RAM.

Places the framebuffer's origin at pixel (x, y). The upload is invisible until the next try_refresh. The panel must be operating in color_mode::mono.

Parameters
fbThe framebuffer to upload.
xDestination column; must be a multiple of 8 (controller RAM is byte-packed along the row).
yDestination row.
Returns
Success, or an error.
Return values
invalid_argx is not a multiple of 8, or the framebuffer does not fit within the panel at (x, y).
invalid_stateThe panel is asleep, or is operating in color_mode::gray4.

Referenced by idfxx::epaper::gray4_framebuffer::try_flush(), idfxx::epaper::mono_framebuffer::try_flush(), write(), and write().

◆ try_write_rows() [1/2]

result< void > idfxx::epaper::panel::try_write_rows ( const gray4_framebuffer fb,
size_t  row_start,
size_t  row_end,
size_t  x = 0,
size_t  y = 0 
)

Uploads a horizontal band of a grayscale framebuffer.

Uploads rows [row_start, row_end) of fb, with the framebuffer's origin at pixel (x, y) — row r of the framebuffer lands at panel row y + r.

Parameters
fbThe framebuffer to upload from.
row_startFirst framebuffer row of the band, inclusive.
row_endEnd framebuffer row, exclusive; must satisfy row_start < row_end <= fb.height().
xDestination column of the framebuffer origin; must be a multiple of 8.
yDestination row of the framebuffer origin.
Returns
Success, or an error.
Return values
invalid_argThe row range is invalid, x is not a multiple of 8, or the band does not fit within the panel.
invalid_stateThe panel is asleep, or is operating in color_mode::mono.

◆ try_write_rows() [2/2]

result< void > idfxx::epaper::panel::try_write_rows ( const mono_framebuffer fb,
size_t  row_start,
size_t  row_end,
size_t  x = 0,
size_t  y = 0 
)

Uploads a horizontal band of a monochrome framebuffer.

Uploads rows [row_start, row_end) of fb, with the framebuffer's origin at pixel (x, y) — row r of the framebuffer lands at panel row y + r, so a band flushed from a full-frame framebuffer lands exactly where the full upload would place it.

Parameters
fbThe framebuffer to upload from.
row_startFirst framebuffer row of the band, inclusive.
row_endEnd framebuffer row, exclusive; must satisfy row_start < row_end <= fb.height().
xDestination column of the framebuffer origin; must be a multiple of 8.
yDestination row of the framebuffer origin.
Returns
Success, or an error.
Return values
invalid_argThe row range is invalid, x is not a multiple of 8, or the band does not fit within the panel.
invalid_stateThe panel is asleep, or is operating in color_mode::gray4.

Referenced by idfxx::epaper::gray4_framebuffer::try_flush_rows(), idfxx::epaper::mono_framebuffer::try_flush_rows(), write_rows(), and write_rows().

◆ wait()

void idfxx::epaper::panel::wait ( )
inline

Waits for the controller's BUSY line to release.

Blocks while the controller reports it is busy, up to the driver's configured default timeout. refresh already waits for completion; this is useful before driver-specific raw operations or after recovering from an error.

Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron failure, including errc::timeout if the BUSY line does not release in time.

Definition at line 417 of file panel.hpp.

References try_wait(), and idfxx::unwrap().

◆ wait_busy()

result< void > idfxx::epaper::panel::wait_busy ( std::optional< std::chrono::milliseconds >  timeout = std::nullopt)
protected

Polls the BUSY line until it releases.

Polls the BUSY pin configured at construction once per RTOS tick until it leaves the busy level, reporting errc::timeout if it does not release in time. Returns success immediately if no BUSY pin is configured.

Parameters
timeoutMaximum time to wait, or std::nullopt for the default configured at construction.
Returns
Success, or an error.
Return values
timeoutThe BUSY line did not release in time.

Referenced by do_wait().

◆ wait_for()

template<typename Rep , typename Period >
void idfxx::epaper::panel::wait_for ( const std::chrono::duration< Rep, Period > &  timeout)
inline

Waits for the controller's BUSY line to release, with a timeout.

Blocks while the controller reports it is busy, up to timeout.

Template Parameters
RepDuration arithmetic type.
PeriodDuration period type.
Parameters
timeoutMaximum time to wait.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron failure, including errc::timeout if the BUSY line does not release in time.

Definition at line 432 of file panel.hpp.

References idfxx::timeout, try_wait_for(), and idfxx::unwrap().

◆ wake()

void idfxx::epaper::panel::wake ( )
inline

Wakes the panel controller from deep sleep.

ePaper controllers require a hardware reset to leave deep sleep, so this pulses the driver's reset line and re-runs the full controller initialization, restoring the configured color mode. The partial-refresh baseline is lost: the next refresh is promoted to refresh_mode::full.

Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron failure, including errc::invalid_state if no reset line is configured.

Definition at line 584 of file panel.hpp.

References try_wake(), and idfxx::unwrap().

◆ width()

size_t idfxx::epaper::panel::width ( ) const
inlinenoexcept

Returns the panel width in pixels.

Definition at line 128 of file panel.hpp.

◆ write() [1/2]

void idfxx::epaper::panel::write ( const gray4_framebuffer fb,
size_t  x = 0,
size_t  y = 0 
)
inline

Uploads a grayscale framebuffer to the controller's RAM.

Places the framebuffer's origin at pixel (x, y). The upload is invisible until the next refresh. The panel must be operating in color_mode::gray4.

Parameters
fbThe framebuffer to upload.
xDestination column; must be a multiple of 8 (controller RAM is byte-packed along the row).
yDestination row.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron failure, including errc::invalid_arg for an unaligned x or an out-of-bounds placement, and errc::invalid_state if the panel is asleep or in color_mode::mono.

Definition at line 195 of file panel.hpp.

References try_write(), and idfxx::unwrap().

◆ write() [2/2]

void idfxx::epaper::panel::write ( const mono_framebuffer fb,
size_t  x = 0,
size_t  y = 0 
)
inline

Uploads a monochrome framebuffer to the controller's RAM.

Places the framebuffer's origin at pixel (x, y). The upload is invisible until the next refresh. The panel must be operating in color_mode::mono.

Parameters
fbThe framebuffer to upload.
xDestination column; must be a multiple of 8 (controller RAM is byte-packed along the row).
yDestination row.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron failure, including errc::invalid_arg for an unaligned x or an out-of-bounds placement, and errc::invalid_state if the panel is asleep or in color_mode::gray4.

Definition at line 176 of file panel.hpp.

References try_write(), and idfxx::unwrap().

◆ write_rows() [1/2]

void idfxx::epaper::panel::write_rows ( const gray4_framebuffer fb,
size_t  row_start,
size_t  row_end,
size_t  x = 0,
size_t  y = 0 
)
inline

Uploads a horizontal band of a grayscale framebuffer.

Uploads rows [row_start, row_end) of fb, with the framebuffer's origin at pixel (x, y) — row r of the framebuffer lands at panel row y + r.

Parameters
fbThe framebuffer to upload from.
row_startFirst framebuffer row of the band, inclusive.
row_endEnd framebuffer row, exclusive; must satisfy row_start < row_end <= fb.height().
xDestination column of the framebuffer origin; must be a multiple of 8.
yDestination row of the framebuffer origin.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron failure, including errc::invalid_arg for an invalid row range, an unaligned x, or an out-of-bounds placement, and errc::invalid_state if the panel is asleep or in color_mode::mono.

Definition at line 242 of file panel.hpp.

References try_write_rows(), and idfxx::unwrap().

◆ write_rows() [2/2]

void idfxx::epaper::panel::write_rows ( const mono_framebuffer fb,
size_t  row_start,
size_t  row_end,
size_t  x = 0,
size_t  y = 0 
)
inline

Uploads a horizontal band of a monochrome framebuffer.

Uploads rows [row_start, row_end) of fb, with the framebuffer's origin at pixel (x, y) — row r of the framebuffer lands at panel row y + r, so a band flushed from a full-frame framebuffer lands exactly where the full upload would place it.

Parameters
fbThe framebuffer to upload from.
row_startFirst framebuffer row of the band, inclusive.
row_endEnd framebuffer row, exclusive; must satisfy row_start < row_end <= fb.height().
xDestination column of the framebuffer origin; must be a multiple of 8.
yDestination row of the framebuffer origin.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron failure, including errc::invalid_arg for an invalid row range, an unaligned x, or an out-of-bounds placement, and errc::invalid_state if the panel is asleep or in color_mode::gray4.

Definition at line 218 of file panel.hpp.

References try_write_rows(), and idfxx::unwrap().


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