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

UC8179 ePaper display controller driver. More...

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

Classes

struct  config
 Configuration structure for UC8179 panels. More...
 

Public Member Functions

 uc8179 (idfxx::panel_io &panel_io, config config)
 Creates a new UC8179 panel driver.
 
 ~uc8179 () override
 
 uc8179 (const uc8179 &)=delete
 
uc8179operator= (const uc8179 &)=delete
 
 uc8179 (uc8179 &&other) noexcept
 
uc8179operator= (uc8179 &&other) noexcept
 
- Public Member Functions inherited from idfxx::epaper::panel
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.
 

Static Public Member Functions

static panel_io::spi_config spi_io_config (gpio cs, gpio dc, freq::hertz pclk=freq::hertz{10 '000 '000}) noexcept
 Returns a panel I/O configuration for communicating with a UC8179 over SPI.
 
static result< uc8179make (idfxx::panel_io &panel_io, config config)
 Creates a new UC8179 panel driver.
 

Additional Inherited Members

- Protected Member Functions inherited from idfxx::epaper::panel
 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_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 inherited from idfxx::epaper::panel
static result< void > configure_control_lines (gpio busy_gpio, gpio reset_gpio)
 Configures the direction of the BUSY and reset pins.
 

Detailed Description

UC8179 ePaper display controller driver.

Driver for UC8179-based SPI ePaper panels (up to 800x600), such as the 7.5" 800x480 panel (GooDisplay GDEY075T7 glass) on the Seeed Studio XIAO ePaper Display Board EE05. Implements the full idfxx::epaper::panel interface: full, fast, and partial refreshes, 4-level grayscale, deep sleep, and wake.

The driver owns the panel's BUSY input (active low on this controller) and (optional) reset output lines, and communicates through an idfxx::panel_io configured with spi_io_config. Unlike controllers that need the previous frame re-sent by the host, the UC8179 copies the new-image RAM to the previous-image RAM when a refresh completes, so the driver keeps no shadow frame — full-frame writes stream the framebuffer's 48 KB (at 800x480) straight to the controller.

This type is non-copyable and move-only. A moved-from object must not be used: any operation other than destruction or assignment is undefined behavior. The destructor powers off an awake controller and puts it into deep sleep.

idfxx::epaper::uc8179 display(io, {.reset_gpio = PIN_RST, .busy_gpio = PIN_BUSY});
idfxx::epaper::mono_framebuffer fb(display.width(), display.height());
fb.set_pixel(10, 20, true);
fb.flush(display);
display.refresh();
display.sleep();
In-memory framebuffer for monochrome (1 bit per pixel) ePaper displays.
UC8179 ePaper display controller driver.
Definition uc8179.hpp:66
static panel_io::spi_config spi_io_config(gpio cs, gpio dc, freq::hertz pclk=freq::hertz{10 '000 '000}) noexcept
Returns a panel I/O configuration for communicating with a UC8179 over SPI.
Panel I/O interface for SPI- and I2C-connected displays.
Definition panel_io.hpp:42
A SPI master bus.
Definition master.hpp:256
@ ch_auto
Auto select DMA channel.

Definition at line 66 of file uc8179.hpp.

Constructor & Destructor Documentation

◆ uc8179() [1/3]

idfxx::epaper::uc8179::uc8179 ( idfxx::panel_io panel_io,
config  config 
)
explicit

Creates a new UC8179 panel driver.

Configures the BUSY and reset GPIOs, hardware-resets the controller, runs the full initialization sequence, and clears both image planes to white, leaving the panel awake in color_mode::mono and ready for writes.

Does not take ownership of panel_io. It is the caller's responsibility to ensure that this panel does not outlive the panel I/O interface.

Parameters
panel_ioThe panel I/O interface.
configPanel configuration; busy_gpio is required.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled in menuconfig.
Exceptions
std::system_erroron failure, including errc::invalid_arg for out-of-range dimensions or an unconnected busy_gpio.

◆ ~uc8179()

idfxx::epaper::uc8179::~uc8179 ( )
override

◆ uc8179() [2/3]

idfxx::epaper::uc8179::uc8179 ( const uc8179 )
delete

◆ uc8179() [3/3]

idfxx::epaper::uc8179::uc8179 ( uc8179 &&  other)
noexcept

Member Function Documentation

◆ make()

static result< uc8179 > idfxx::epaper::uc8179::make ( idfxx::panel_io panel_io,
config  config 
)
static

Creates a new UC8179 panel driver.

Configures the BUSY and reset GPIOs, hardware-resets the controller, runs the full initialization sequence, and clears both image planes to white, leaving the panel awake in color_mode::mono and ready for writes.

Does not take ownership of panel_io. It is the caller's responsibility to ensure that this panel does not outlive the panel I/O interface.

Parameters
panel_ioThe panel I/O interface.
configPanel configuration; busy_gpio is required.
Returns
The new uc8179, or an error.
Return values
idfxx::errc::invalid_argif busy_gpio is not connected, the width is zero, not a multiple of 8, or over 800, or the height is zero or over 600.
idfxx::errc::timeoutif the controller's BUSY line does not release during initialization.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

uc8179 & idfxx::epaper::uc8179::operator= ( uc8179 &&  other)
noexcept

◆ spi_io_config()

static panel_io::spi_config idfxx::epaper::uc8179::spi_io_config ( gpio  cs,
gpio  dc,
freq::hertz  pclk = freq::hertz{10 '000 '000} 
)
staticnoexcept

Returns a panel I/O configuration for communicating with a UC8179 over SPI.

Fills in the SPI framing the UC8179 controller requires (mode 0, 8-bit commands and parameters, a dedicated D/C line), so only the wiring-specific values are parameters.

Parameters
csGPIO wired to the panel's chip-select line.
dcGPIO wired to the panel's data/command line.
pclkSPI clock frequency. The UC8179 supports up to 10 MHz for writes.
Returns
A panel_io::spi_config ready to construct a panel_io.
idfxx::epaper::uc8179 display(io, {.busy_gpio = PIN_BUSY});

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