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
driver.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <cstdint>
5
6namespace epaper {
7
46enum class DisplayMode : std::uint8_t {
49 BWR,
50 BWY,
52};
53
60[[nodiscard]] constexpr auto bits_per_pixel(DisplayMode mode) noexcept -> std::uint8_t {
61 switch (mode) {
63 return 1;
67 return 2;
69 return 3;
70 }
71 return 1; // Default fallback
72}
73
80[[nodiscard]] constexpr auto is_color_mode(DisplayMode mode) noexcept -> bool {
81 switch (mode) {
85 return true;
86 default:
87 return false;
88 }
89}
90
97[[nodiscard]] constexpr auto num_planes(DisplayMode mode) noexcept -> std::size_t {
98 switch (mode) {
101 return 1;
102 case DisplayMode::BWR:
103 case DisplayMode::BWY:
104 return 2;
106 return 1; // Spectra6 uses single 3-bit buffer
107 }
108 return 1;
109}
110
111} // 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)