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:
- BlackWhite: 1 bpp, 2 colors, single buffer
- Grayscale4: 2 bpp, 4 gray levels, single buffer
- BWR/BWY: 2 bpp, 3 colors, dual-buffer (black/white + red/yellow)
- Spectra6: 3 bpp, 6 colors, single 3-bit buffer
Mode Selection Guidelines:
- Use BlackWhite for fastest refresh and maximum contrast
- Use Grayscale4 for anti-aliased text or smooth gradients
- Use BWR/BWY for highlights, warnings, or accent colors
- Use Spectra6 for colorful diagrams or illustrations (slower refresh)
- Note
- Not all modes are supported by all drivers. Check driver_traits<Driver>::max_mode and driver_traits<Driver>::supports_grayscale before creating display.
DisplayMode mode = DisplayMode::BWR;
auto bpp = bits_per_pixel(mode);
bool has_color = is_color_mode(mode);
auto planes = num_planes(mode);
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>
};
switch (mode) {
return 1;
return 2;
return 3;
}
return 1;
}
switch (mode) {
return true;
default:
return false;
}
}
switch (mode) {
return 1;
return 2;
return 1;
}
return 1;
}
}
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)