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

SSD1680 ePaper display controller driver. More...

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

Classes

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

Public Member Functions

 ssd1680 (idfxx::panel_io &panel_io, config config)
 Creates a new SSD1680 panel driver.
 
 ~ssd1680 () override
 
 ssd1680 (const ssd1680 &)=delete
 
ssd1680operator= (const ssd1680 &)=delete
 
 ssd1680 (ssd1680 &&other) noexcept
 
ssd1680operator= (ssd1680 &&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 an SSD1680 over SPI.
 
static result< ssd1680make (idfxx::panel_io &panel_io, config config)
 Creates a new SSD1680 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

SSD1680 ePaper display controller driver.

Driver for SSD1680-based SPI ePaper panels (up to 176x296), such as the 2.13" 122x250 panel on the Seeed Studio XIAO ePaper Display Board EE05. Implements the full @ref idfxx::epaper::panel interface: full, fast, and partial refreshes, 4-level grayscale, deep sleep, and wake. The driver owns the panel's BUSY input and (optional) reset output lines, and communicates through an <tt>idfxx::panel_io</tt> configured with @ref spi_io_config. It keeps a shadow copy of the last-written frame (<tt>(width + 7) / 8 * height</tt> bytes of DRAM, ~4 KB for the 2.13" panel) to maintain the controller's previous-image plane for flicker-free partial refreshes.

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 puts an awake controller into deep sleep.

idfxx::epaper::ssd1680 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.
SSD1680 ePaper display controller driver.
Definition ssd1680.hpp:65
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 an SSD1680 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 65 of file ssd1680.hpp.

Constructor & Destructor Documentation

◆ ssd1680() [1/3]

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

Creates a new SSD1680 panel driver.

Configures the BUSY and reset GPIOs, hardware-resets the controller, and runs the full initialization sequence, 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.

◆ ~ssd1680()

idfxx::epaper::ssd1680::~ssd1680 ( )
override

◆ ssd1680() [2/3]

idfxx::epaper::ssd1680::ssd1680 ( const ssd1680 )
delete

◆ ssd1680() [3/3]

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

Member Function Documentation

◆ make()

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

Creates a new SSD1680 panel driver.

Configures the BUSY and reset GPIOs, hardware-resets the controller, and runs the full initialization sequence, 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 ssd1680, or an error.
Return values
idfxx::errc::invalid_argif busy_gpio is not connected, or the dimensions are zero or exceed the controller's 176x296.
idfxx::errc::timeoutif the controller's BUSY line does not release during initialization.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ spi_io_config()

static panel_io::spi_config idfxx::epaper::ssd1680::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 an SSD1680 over SPI.

Fills in the SPI framing the SSD1680 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 SSD1680 supports up to 20 MHz for writes; 10 MHz is a conservative default.
Returns
A panel_io::spi_config ready to construct a panel_io.
idfxx::epaper::ssd1680 display(io, {.busy_gpio = PIN_BUSY});

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