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.
Loading...
Searching...
No Matches
/mnt/nas/libepaper/include/epaper/drivers/driver.hpp

Display mode enumeration.

Display mode enumeration.Defines the color/grayscale mode a display can operate in. Each mode implies specific bits-per-pixel, color capability, and hardware buffer requirements.

Mode Characteristics:

Mode Selection Guidelines:

Note
Not all modes are supported by all drivers. Check driver_traits<Driver>::max_mode and driver_traits<Driver>::supports_grayscale before creating display.
// Query mode capabilities
DisplayMode mode = DisplayMode::BWR;
auto bpp = bits_per_pixel(mode); // Returns 2
bool has_color = is_color_mode(mode); // Returns true
auto planes = num_planes(mode); // Returns 2
// Mode-specific display creation
if (driver_traits<EPD27>::max_mode >= DisplayMode::BWR) {
auto display = create_display<EPD27>(device, DisplayMode::BWR);
}
See also
bits_per_pixel(), is_color_mode(), num_planes(), driver_traits
#pragma once
#include <cstddef>
#include <cstdint>
namespace epaper {
enum class DisplayMode : std::uint8_t {
BWR,
BWY,
};
[[nodiscard]] constexpr auto bits_per_pixel(DisplayMode mode) noexcept -> std::uint8_t {
switch (mode) {
return 1;
return 2;
return 3;
}
return 1; // Default fallback
}
[[nodiscard]] constexpr auto is_color_mode(DisplayMode mode) noexcept -> bool {
switch (mode) {
return true;
default:
return false;
}
}
[[nodiscard]] constexpr auto num_planes(DisplayMode mode) noexcept -> std::size_t {
switch (mode) {
return 1;
return 2;
return 1; // Spectra6 uses single 3-bit buffer
}
return 1;
}
} // namespace epaper
Definition color.hpp:5
constexpr auto num_planes(DisplayMode mode) noexcept -> std::size_t
Get number of color planes required for a display mode.
Definition driver.hpp:97
constexpr auto is_color_mode(DisplayMode mode) noexcept -> bool
Check if mode supports color (non-grayscale).
Definition driver.hpp:80
constexpr auto bits_per_pixel(DisplayMode mode) noexcept -> std::uint8_t
Get bits per pixel for a display mode.
Definition driver.hpp:60
DisplayMode
Definition driver.hpp:46
@ BWY
Black, White, Yellow (3 colors, typically 2-bit)
@ Spectra6
6-color: Black, White, Red, Yellow, Blue, Green (3-bit)
@ BlackWhite
1-bit black and white (2 colors)
@ Grayscale4
2-bit 4-level grayscale
@ BWR
Black, White, Red (3 colors, typically 2-bit)