|
libepaper 2.0.0
A C++23 library for controlling Waveshare e-paper displays on Raspberry Pi, featuring transparent sleep/wake management and a fluent builder API.
|
Namespaces | |
| namespace | colors |
| namespace | DisplayOps |
| Display operation constants. | |
| namespace | Grayscale |
| Bit manipulation constants for grayscale processing. | |
| namespace | hal |
| namespace | internal |
| namespace | PanelConfig |
| Panel configuration constants. | |
| namespace | pixel_constants |
| namespace | PowerOptimization |
| Power optimization register settings. | |
| namespace | Resolution |
| Resolution setting constants. | |
| namespace | Timing |
| Timing constants for EPD27 operations (in milliseconds). | |
Classes | |
| struct | BoosterConfig |
| Booster soft start configuration. More... | |
| class | CircleBuilder |
| struct | CircleCommand |
| Command for drawing a circle. More... | |
| class | ColorManager |
| class | Device |
| struct | DeviceColor |
| Device-specific color representation (generic template). More... | |
| struct | DeviceColor< DisplayMode::BlackWhite > |
| struct | DeviceColor< DisplayMode::BWR > |
| Specialization for Black/White/Red displays. More... | |
| struct | DeviceColor< DisplayMode::BWY > |
| Specialization for Black/White/Yellow displays. More... | |
| struct | DeviceColor< DisplayMode::Grayscale4 > |
| struct | DeviceColor< DisplayMode::Spectra6 > |
| Specialization for Spectra 6 (6-color) displays. More... | |
| struct | DeviceConfig |
| class | Display |
| struct | driver_traits |
| Driver capabilities trait template. More... | |
| struct | driver_traits< EPD27 > |
| struct | driver_traits< MockDriver > |
| class | EPD27 |
| 2.7 inch e-paper display driver (176x264 pixels). More... | |
| struct | EPD27PinConfig |
| Pin configuration for standard Raspberry Pi HATs. More... | |
| struct | Error |
| class | Font |
| struct | FontMetrics |
| Font dimension metrics. More... | |
| class | Graphics |
| class | ImageIO |
| Utilities for loading/saving images and converting formats. More... | |
| class | LineBuilder |
| struct | LineCommand |
| Command for drawing a line between two points. More... | |
| struct | LineStyleSpec |
| class | MockDriver |
| class | MonoFramebuffer |
| class | MultiPlaneFramebuffer |
| class | Pin |
| struct | PinConfig |
| Pin configuration tracking (internal use). More... | |
| struct | Point |
| class | PointBuilder |
| struct | PointCommand |
| Command for drawing a point (pixel or multi-pixel dot). More... | |
| struct | PowerConfig |
| Power configuration settings for EPD27. More... | |
| class | RectangleBuilder |
| struct | RectangleCommand |
| Command for drawing a rectangle. More... | |
| struct | RGB |
| struct | RGBA |
| struct | ShapeStyleSpec |
| struct | Size |
| class | TextBuilder |
| struct | TextCommand |
| Command for drawing text. More... | |
| struct | TextStyleSpec |
Concepts | |
| concept | FramebufferLike |
| concept | DriverTraits |
| Concept to check if a type is a valid driver with capabilities. | |
| concept | Driver |
Typedefs | |
| using | TwoPlaneFramebuffer = MultiPlaneFramebuffer< internal::PlaneCount::Two > |
| Convenience alias for a two-plane color framebuffer. | |
Enumerations | |
| enum class | TriColor : std::uint8_t { Black = 0 , White = 1 , Third = 2 } |
| Color values for 3-color displays (Black/White/Red or Black/White/Yellow). More... | |
| enum class | Spectra6Color : std::uint8_t { Black = 0 , White = 1 , Red = 2 , Yellow = 3 , Blue = 4 , Green = 5 } |
| Color values for Spectra 6 displays. More... | |
| enum class | ErrorCode { DeviceNotInitialized , DeviceInitFailed , GPIOInitFailed , GPIORequestFailed , SPIInitFailed , SPIDeviceOpenFailed , SPIConfigFailed , InvalidPin , TransferFailed , DriverNotInitialized , DriverInitFailed , InvalidMode , Timeout , DisplayNotReady , RefreshFailed , FileNotFound , InvalidFormat , LoadFailed , InvalidDimensions } |
| Unified error codes for all libepaper operations. More... | |
| enum class | Color : std::uint8_t { White = 0xFF , Black = 0x00 , Gray1 = 0x80 , Gray2 = 0x40 , Red = 0x01 , Yellow = 0x02 , Blue = 0x03 , Green = 0x04 } |
| enum class | Orientation : std::uint8_t { Portrait0 = 0 , Landscape90 = 1 , Portrait180 = 2 , Landscape270 = 3 } |
| enum class | DotPixel : std::uint8_t { Pixel1x1 = 1 , Pixel2x2 = 2 , Pixel3x3 = 3 , Pixel4x4 = 4 , Pixel5x5 = 5 , Pixel6x6 = 6 , Pixel7x7 = 7 , Pixel8x8 = 8 } |
| enum class | LineStyle { Solid , Dotted } |
| enum class | DrawFill { Empty , Full } |
| enum class | TextContent { String , Number , Decimal } |
| Content type for text rendering. More... | |
| enum class | DisplayMode : std::uint8_t { BlackWhite , Grayscale4 , BWR , BWY , Spectra6 } |
| enum class | Command : std::uint8_t { BOOSTER_SOFT_START = 0x06 , DATA_START_TRANSMISSION_1 = 0x10 , DISPLAY_REFRESH = 0x12 , DATA_START_TRANSMISSION_2 = 0x13 , PARTIAL_DISPLAY_REFRESH = 0x16 , LUT_VCOM = 0x20 , LUT_WW = 0x21 , LUT_BW = 0x22 , LUT_WB = 0x23 , LUT_BB = 0x24 , LUT_WW2 = 0x25 , PLL_CONTROL = 0x30 , VCOM_DATA_INTERVAL = 0x50 , RESOLUTION_SETTING = 0x61 , GET_STATUS = 0x71 , VCM_DC_SETTING = 0x82 , POWER_OPTIMIZATION = 0xF8 , PANEL_SETTING = 0x00 , POWER_SETTING = 0x01 , POWER_OFF = 0x02 , POWER_ON = 0x04 , DEEP_SLEEP = 0x07 } |
| E-paper display command codes for EPD27. More... | |
Functions | |
| template<typename DriverType > requires Driver<DriverType> && DriverTraits<DriverType> | |
| auto | create_display (Device &device, DisplayMode mode, Orientation orientation=Orientation::Portrait0, bool auto_sleep=true) -> std::expected< Display< DriverType, MonoFramebuffer >, Error > |
| Convenience factory for mono-plane displays. | |
| template<typename DriverType , FramebufferLike FramebufferT> requires Driver<DriverType> && DriverTraits<DriverType> | |
| auto | create_display (Device &device, DisplayMode mode, Orientation orientation=Orientation::Portrait0, bool auto_sleep=true) -> std::expected< Display< DriverType, FramebufferT >, Error > |
| Primary factory function for creating displays with explicit framebuffer type. | |
| constexpr auto | to_string (ErrorCode code) -> std::string_view |
| Convert error code to string representation. | |
| auto | make_error (ErrorCode code, std::string_view context={}) -> Error |
| template<typename Driver > requires DriverTraits<Driver> | |
| constexpr auto | supports_display_mode (DisplayMode mode) noexcept -> bool |
| constexpr auto | bits_per_pixel (DisplayMode mode) noexcept -> std::uint8_t |
| Get bits per pixel for a display mode. | |
| constexpr auto | is_color_mode (DisplayMode mode) noexcept -> bool |
| Check if mode supports color (non-grayscale). | |
| constexpr auto | num_planes (DisplayMode mode) noexcept -> std::size_t |
| Get number of color planes required for a display mode. | |
| constexpr auto | spectra6_color_to_value (Color color) noexcept -> std::uint8_t |
| Convert a Color to its 3-bit Spectra6 value. | |
| constexpr auto | spectra6_value_to_color (std::uint8_t value) noexcept -> Color |
| Convert a 3-bit Spectra6 value to Color. | |
| constexpr auto | color_to_rgb (Color color) noexcept -> RGB |
| Convert a Color enum to RGB values. | |
| constexpr auto | rgb_to_grayscale (std::uint8_t r, std::uint8_t g, std::uint8_t b) noexcept -> std::uint8_t |
| Convert RGB values to grayscale using standard luminance formula. | |
| constexpr auto | rgb_to_color_bw (std::uint8_t r, std::uint8_t g, std::uint8_t b) noexcept -> Color |
| Convert RGB to Color for black/white mode. | |
| constexpr auto | rgb_to_color_grayscale4 (std::uint8_t r, std::uint8_t g, std::uint8_t b) noexcept -> Color |
| Convert RGB to Color for 4-level grayscale mode. | |
| constexpr auto | rgb_to_color (DisplayMode mode, std::uint8_t r, std::uint8_t g, std::uint8_t b) noexcept -> Color |
| Convert RGB to Color based on display mode. | |
| constexpr auto | calculate_bw_position (std::size_t width, std::size_t x, std::size_t y) noexcept -> std::pair< std::size_t, std::uint8_t > |
| Calculate byte index and bit mask for B/W mode pixel. | |
| constexpr auto | calculate_gray_position (std::size_t width, std::size_t x, std::size_t y) noexcept -> std::pair< std::size_t, std::uint8_t > |
| Calculate byte index and pixel shift for Grayscale4 mode pixel. | |
| constexpr auto | calculate_spectra6_position (std::size_t width, std::size_t x, std::size_t y) noexcept -> std::pair< std::size_t, std::size_t > |
| Calculate byte index and bit offset for Spectra6 (3-bit) mode pixel. | |
| auto | get_pixel_bw (std::span< const std::byte > buffer, std::size_t width, std::size_t x, std::size_t y) noexcept -> Color |
| Read a pixel from a B/W mode buffer. | |
| auto | get_pixel_grayscale4 (std::span< const std::byte > buffer, std::size_t width, std::size_t x, std::size_t y) noexcept -> Color |
| Read a pixel from a Grayscale4 mode buffer. | |
| auto | get_pixel_bwr_bwy (std::span< const std::byte > buffer, std::size_t width, std::size_t height, std::size_t x, std::size_t y, bool is_bwr) noexcept -> Color |
| Read a pixel from a BWR or BWY mode buffer. | |
| auto | get_pixel_spectra6 (std::span< const std::byte > buffer, std::size_t width, std::size_t x, std::size_t y) noexcept -> Color |
| Read a pixel from a Spectra6 mode buffer. | |
| auto | get_pixel_from_buffer (DisplayMode mode, std::span< const std::byte > buffer, std::size_t width, std::size_t height, std::size_t x, std::size_t y) noexcept -> Color |
| Read a pixel from a buffer based on display mode. | |
| auto | set_pixel_bw (std::span< std::byte > buffer, std::size_t width, std::size_t x, std::size_t y, Color color) noexcept -> void |
| Write a pixel to a B/W mode buffer. | |
| auto | set_pixel_grayscale4 (std::span< std::byte > buffer, std::size_t width, std::size_t x, std::size_t y, Color color) noexcept -> void |
| Write a pixel to a Grayscale4 mode buffer. | |
| auto | set_pixel_bwr_bwy (std::span< std::byte > buffer, std::size_t width, std::size_t height, std::size_t x, std::size_t y, Color color, bool is_bwr) noexcept -> void |
| Write a pixel to a BWR or BWY mode buffer. | |
| auto | set_pixel_spectra6 (std::span< std::byte > buffer, std::size_t width, std::size_t x, std::size_t y, Color color) noexcept -> void |
| Write a pixel to a Spectra6 mode buffer. | |
| auto | set_pixel_in_buffer (DisplayMode mode, std::span< std::byte > buffer, std::size_t width, std::size_t height, std::size_t x, std::size_t y, Color color) noexcept -> void |
| Write a pixel to a buffer based on display mode. | |
Variables | |
| constexpr PowerConfig | POWER_CONFIG_BW |
| Power configuration for black/white mode. | |
| constexpr PowerConfig | POWER_CONFIG_GRAYSCALE |
| Power configuration for grayscale mode. | |
| constexpr BoosterConfig | BOOSTER_CONFIG = {.phase1 = 0x07, .phase2 = 0x07, .phase3 = 0x17} |
| Standard booster soft start configuration. | |
| constexpr std::array< Color, 8 > | SPECTRA6_VALUE_TO_COLOR |
| Mapping from 3-bit Spectra6 value to Color enum. | |
| using epaper::TwoPlaneFramebuffer = typedef MultiPlaneFramebuffer<internal::PlaneCount::Two> |
Convenience alias for a two-plane color framebuffer.
|
strong |
|
strong |
E-paper display command codes for EPD27.
| Enumerator | |
|---|---|
| BOOSTER_SOFT_START | Booster soft start control. |
| DATA_START_TRANSMISSION_1 | Start data transmission (old data) |
| DISPLAY_REFRESH | Refresh display. |
| DATA_START_TRANSMISSION_2 | Start data transmission (new data) |
| PARTIAL_DISPLAY_REFRESH | Partial display refresh control. |
| LUT_VCOM | VCOM LUT register. |
| LUT_WW | White-to-White LUT register. |
| LUT_BW | Black-to-White LUT register. |
| LUT_WB | White-to-Black LUT register. |
| LUT_BB | Black-to-Black LUT register. |
| LUT_WW2 | Additional White-to-White LUT register. |
| PLL_CONTROL | PLL control (frame rate) |
| VCOM_DATA_INTERVAL | VCOM and data interval setting. |
| RESOLUTION_SETTING | Resolution setting. |
| GET_STATUS | Get display status. |
| VCM_DC_SETTING | VCM DC setting. |
| POWER_OPTIMIZATION | Power optimization register. |
| PANEL_SETTING | Panel setting register. |
| POWER_SETTING | Power setting. |
| POWER_OFF | Power off command. |
| POWER_ON | Power on command. |
| DEEP_SLEEP | Deep sleep mode. |
|
strong |
|
strong |
|
strong |
|
strong |
Unified error codes for all libepaper operations.
This enum consolidates all error types across the library, providing a consistent error handling interface.
| Enumerator | |
|---|---|
| DeviceNotInitialized | Device has not been initialized. |
| DeviceInitFailed | Device initialization failed. |
| GPIOInitFailed | GPIO initialization failed (libgpiod) |
| GPIORequestFailed | GPIO line request failed. |
| SPIInitFailed | SPI initialization failed. |
| SPIDeviceOpenFailed | SPI device open failed. |
| SPIConfigFailed | SPI configuration failed. |
| InvalidPin | Invalid GPIO pin number. |
| TransferFailed | SPI/data transfer failed. |
| DriverNotInitialized | Driver has not been initialized. |
| DriverInitFailed | Driver initialization failed. |
| InvalidMode | Invalid display mode specified. |
| Timeout | Operation timed out. |
| DisplayNotReady | Display is not ready for operation. |
| RefreshFailed | Display refresh operation failed. |
| FileNotFound | Image file not found. |
| InvalidFormat | Invalid or unsupported image format. |
| LoadFailed | Failed to load image data. |
| InvalidDimensions | Invalid image dimensions. |
|
strong |
|
strong |
|
strong |
Color values for Spectra 6 displays.
6-Color Palette:
Bit Encoding:
| Enumerator | |
|---|---|
| Black | |
| White | |
| Red | |
| Yellow | |
| Blue | |
| Green | |
|
strong |
Content type for text rendering.
Discriminant for TextCommand's internal union-like behavior. Determines which fields are active and how text is populated.
|
strong |
Color values for 3-color displays (Black/White/Red or Black/White/Yellow).
Used by BWR and BWY display modes which employ dual-plane architecture:
Dual-Plane Encoding:
| Enumerator | |
|---|---|
| Black | |
| White | |
| Third | Red for BWR, Yellow for BWY. |
|
constexprnoexcept |
Get bits per pixel for a display mode.
| mode | Display mode |

|
constexprnoexcept |
Calculate byte index and bit mask for B/W mode pixel.
Encoding:
Example (width=10):
| width | Display width in pixels |
| x | X coordinate (0-based, left edge = 0) |
| y | Y coordinate (0-based, top edge = 0) |

|
constexprnoexcept |
Calculate byte index and pixel shift for Grayscale4 mode pixel.
Encoding:
Example (width=6):
Pixel shift values:
| width | Display width in pixels |
| x | X coordinate |
| y | Y coordinate |

|
constexprnoexcept |
Calculate byte index and bit offset for Spectra6 (3-bit) mode pixel.
Encoding:
Example (first 3 pixels = 9 bits):
Cross-byte handling:
| width | Display width in pixels |
| x | X coordinate |
| y | Y coordinate |

| auto epaper::create_display | ( | Device & | device, |
| DisplayMode | mode, | ||
| Orientation | orientation = Orientation::Portrait0, |
||
| bool | auto_sleep = true |
||
| ) | -> std::expected<Display<DriverType, FramebufferT>, Error> |
| auto epaper::create_display | ( | Device & | device, |
| DisplayMode | mode, | ||
| Orientation | orientation = Orientation::Portrait0, |
||
| bool | auto_sleep = true |
||
| ) | -> std::expected<Display<DriverType, MonoFramebuffer>, Error> |
Convenience factory for mono-plane displays.
Defaults to MonoFramebuffer and validates that the requested mode is single-plane.
| DriverType | The driver type to use |
| device | Initialized device |
| mode | Display mode |
| orientation | Display orientation |
| auto_sleep | Enable auto-sleep after refresh |
|
inlinenoexcept |
Read a pixel from a B/W mode buffer.
Bit Transformation:
Safety:
| buffer | Framebuffer data (read-only) |
| width | Display width |
| x | X coordinate |
| y | Y coordinate |


|
inlinenoexcept |
Read a pixel from a BWR or BWY mode buffer.
Dual-Plane Encoding:
Bit Transformation:
Active-Low Color Plane: E-paper color planes typically use inverted logic where 0 = "apply color ink". This allows white to be the default (all 1s).
Safety:
| buffer | Framebuffer data (two planes: B/W + color) |
| width | Display width |
| height | Display height (needed to calculate plane_size) |
| x | X coordinate |
| y | Y coordinate |
| is_bwr | True for BWR mode (Red), false for BWY mode (Yellow) |


|
inlinenoexcept |
Read a pixel from a buffer based on display mode.
Dispatches to the appropriate mode-specific function.
| mode | Display mode |
| buffer | Framebuffer data |
| width | Display width |
| height | Display height (needed for multi-plane modes) |
| x | X coordinate |
| y | Y coordinate |

|
inlinenoexcept |
Read a pixel from a Grayscale4 mode buffer.
Bit Transformation:
Safety:
| buffer | Framebuffer data (read-only) |
| width | Display width |
| x | X coordinate |
| y | Y coordinate |


|
inlinenoexcept |
Read a pixel from a Spectra6 mode buffer.
3-Bit Cross-Byte Decoding:
Case 1: Single-byte (bit_offset ≤ 5):
Case 2: Cross-byte (bit_offset = 6 or 7):
Color Mapping: 0=Black, 1=White, 2=Red, 3=Yellow, 4=Blue, 5=Green, 6-7=Fallback to Black
Safety:
| buffer | Framebuffer data (read-only) |
| width | Display width |
| x | X coordinate |
| y | Y coordinate |


|
constexprnoexcept |
Check if mode supports color (non-grayscale).
| mode | Display mode |

|
constexprnoexcept |
Get number of color planes required for a display mode.
| mode | Display mode |

|
constexprnoexcept |
Convert RGB to Color based on display mode.
| mode | Current display mode |
| r | Red component |
| g | Green component |
| b | Blue component |

|
constexprnoexcept |
Convert RGB to Color for black/white mode.
Uses threshold of 128 for binarization.
| r | Red component |
| g | Green component |
| b | Blue component |


|
constexprnoexcept |
Convert RGB to Color for 4-level grayscale mode.
Quantizes to 4 levels: White, Gray1, Gray2, Black.
| r | Red component |
| g | Green component |
| b | Blue component |


|
constexprnoexcept |
|
inlinenoexcept |
Write a pixel to a B/W mode buffer.
Bit Transformation:
Read-Modify-Write: Must preserve other 7 bits in the byte. Using bitwise operations ensures atomic semantics on single-threaded systems.
Safety:
| buffer | Framebuffer data (mutable) |
| width | Display width |
| x | X coordinate |
| y | Y coordinate |
| color | Pixel color (White or Black) |


|
inlinenoexcept |
Write a pixel to a BWR or BWY mode buffer.
Dual-Plane Encoding Logic:
Bit Transformation:
Active-Low Color Logic: The Color plane bit is INVERTED:
Safety:
| buffer | Framebuffer data (mutable, two planes) |
| width | Display width |
| height | Display height (for plane_size calculation) |
| x | X coordinate |
| y | Y coordinate |
| color | Pixel color |
| is_bwr | True for BWR mode (Red), false for BWY mode (Yellow) |


|
inlinenoexcept |
Write a pixel to a Grayscale4 mode buffer.
Bit Transformation:
Color Encoding:
Safety:
| buffer | Framebuffer data (mutable) |
| width | Display width |
| x | X coordinate |
| y | Y coordinate |
| color | Pixel color (one of 4 grayscale levels) |


|
inlinenoexcept |
Write a pixel to a buffer based on display mode.
Dispatches to the appropriate mode-specific function.
| mode | Display mode |
| buffer | Framebuffer data (mutable) |
| width | Display width |
| height | Display height (needed for multi-plane modes) |
| x | X coordinate |
| y | Y coordinate |
| color | Pixel color |

|
inlinenoexcept |
Write a pixel to a Spectra6 mode buffer.
| buffer | Framebuffer data (mutable) |
| width | Display width |
| x | X coordinate |
| y | Y coordinate |
| color | Pixel color |


|
constexprnoexcept |
Convert a Color to its 3-bit Spectra6 value.
| color | The color to convert |

|
constexprnoexcept |
Convert a 3-bit Spectra6 value to Color.
| value | 3-bit value (0-7) |

|
constexprnoexcept |
|
constexpr |
Convert error code to string representation.
| code | Error code to convert |

|
constexpr |
Standard booster soft start configuration.
|
constexpr |
Power configuration for black/white mode.
|
constexpr |
Power configuration for grayscale mode.
|
constexpr |
Mapping from 3-bit Spectra6 value to Color enum.