25#include <idfxx/lcd/color>
29struct esp_lcd_panel_t;
81 [[nodiscard]]
size_t width() const noexcept {
return _width; }
91 [[nodiscard]]
size_t height() const noexcept {
return _height; }
93#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS
110 void draw_bitmap(
int x_start,
int y_start,
int x_end,
int y_end,
const void* color_data) {
164 return do_draw_bitmap(x_start, y_start, x_end, y_end, color_data);
216 [[nodiscard]] virtual
result<
void>
217 do_draw_bitmap(
int x_start,
int y_start,
int x_end,
int y_end, const
void* color_data);
static constexpr gpio nc()
Returns a GPIO representing "not connected".
level
GPIO output/input level.
Abstract base class for LCD panels.
size_t width() const noexcept
Returns the panel's native width in pixels.
result< void > try_display_on(bool on)
Turns the display on or off.
void swap_xy(bool swap)
Swaps the X and Y axes.
virtual result< void > do_display_on(bool on)
Hook for try_display_on.
panel(size_t width, size_t height) noexcept
Constructs a panel reporting the given native dimensions.
void display_on(bool on)
Turns the display on or off.
panel & operator=(const panel &)=delete
void invert_color(bool invert)
Inverts the color of the display.
virtual result< void > do_draw_bitmap(int x_start, int y_start, int x_end, int y_end, const void *color_data)
Hook for try_draw_bitmap.
void mirror(bool mirror_x, bool mirror_y)
Mirrors the display.
void draw_bitmap(int x_start, int y_start, int x_end, int y_end, const void *color_data)
Draws bitmap data to a region of the display.
size_t height() const noexcept
Returns the panel's native height in pixels.
result< void > try_mirror(bool mirror_x, bool mirror_y)
Mirrors the display.
panel(const panel &)=delete
virtual esp_lcd_panel_handle_t do_idf_handle() const =0
Hook for idf_handle.
virtual result< void > do_invert_color(bool invert)
Hook for try_invert_color.
result< void > try_draw_bitmap(int x_start, int y_start, int x_end, int y_end, const void *color_data)
Draws bitmap data to a region of the display.
result< void > try_swap_xy(bool swap)
Swaps the X and Y axes.
virtual result< void > do_mirror(bool mirror_x, bool mirror_y)
Hook for try_mirror.
panel(panel &&) noexcept=default
esp_lcd_panel_handle_t idf_handle() const
Returns the underlying ESP-IDF handle.
result< void > try_invert_color(bool invert)
Inverts the color of the display.
virtual result< void > do_swap_xy(bool swap)
Hook for try_swap_xy.
struct esp_lcd_panel_t * esp_lcd_panel_handle_t
rgb_element_order
RGB element order for LCD panels.
rgb_data_endian
RGB data endian for LCD panels.
@ big
RGB data endian: MSB first.
T unwrap(result< T > result)
Throws a std::system_error if the result is an error.
std::expected< T, std::error_code > result
result type wrapping a value or error code.
Configuration structure for LCD panels.
gpio reset_gpio
GPIO number for hardware reset, or idfxx::gpio::nc() if not used.
uint32_t bits_per_pixel
Color depth, in bpp.
void * vendor_config
vendor specific configuration, optional, left as NULL if not used
rgb_data_endian data_endian
Set the data endian for color data larger than 1 byte.
gpio::level reset_active_level
Active level for the panel reset signal.