idfxx 1.0.0
Modern C++23 components for ESP-IDF
Loading...
Searching...
No Matches
panel.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 Chris Leishman
3
4#pragma once
5
13#include <idfxx/error>
14#include <idfxx/gpio>
15#include <idfxx/lcd/color>
16
17struct esp_lcd_panel_t;
18typedef struct esp_lcd_panel_t* esp_lcd_panel_handle_t;
19
24namespace idfxx::lcd {
25
30class panel {
31public:
46
47 virtual ~panel() = default;
48
49 panel(const panel&) = delete;
50 panel& operator=(const panel&) = delete;
51
54
55#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS
63#endif
64
70 [[nodiscard]] virtual result<void> try_swap_xy(bool swap) = 0;
71
72#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS
81#endif
82
89 [[nodiscard]] virtual result<void> try_mirror(bool mirrorX, bool mirrorY) = 0;
90
91#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS
98 void display_on(bool on) { unwrap(try_display_on(on)); }
99#endif
100
106 [[nodiscard]] virtual result<void> try_display_on(bool on) = 0;
107
108protected:
109 panel() = default;
110};
111
112} // namespace idfxx::lcd
Type-safe set of flags from a scoped enum.
Definition flags.hpp:88
A GPIO pin.
Definition gpio.hpp:61
static constexpr gpio nc()
Returns a GPIO representing "not connected".
Definition gpio.hpp:254
level
GPIO output/input level.
Definition gpio.hpp:67
@ low
Logic low (0)
Abstract base class for LCD panels.
Definition panel.hpp:30
void swap_xy(bool swap)
Swaps the X and Y axes.
Definition panel.hpp:62
void display_on(bool on)
Turns the display on or off.
Definition panel.hpp:98
panel & operator=(const panel &)=delete
virtual result< void > try_mirror(bool mirrorX, bool mirrorY)=0
Mirrors the display.
virtual esp_lcd_panel_handle_t idf_handle() const =0
Returns the underlying ESP-IDF handle.
virtual result< void > try_display_on(bool on)=0
Turns the display on or off.
panel(const panel &)=delete
void mirror(bool mirrorX, bool mirrorY)
Mirrors the display.
Definition panel.hpp:80
virtual ~panel()=default
virtual result< void > try_swap_xy(bool swap)=0
Swaps the X and Y axes.
LCD driver classes.
Definition color.hpp:19
rgb_element_order
RGB element order for LCD panels.
Definition color.hpp:25
@ rgb
RGB element order.
rgb_data_endian
RGB data endian for LCD panels.
Definition color.hpp:34
@ big
RGB data endian: MSB first.
T unwrap(result< T > result)
Throws a std::system_error if the result is an error.
Definition error.hpp:307
std::expected< T, std::error_code > result
result type wrapping a value or error code.
Definition error.hpp:120
struct esp_lcd_panel_t * esp_lcd_panel_handle_t
Definition panel.hpp:18
Configuration structure for LCD panels.
Definition panel.hpp:36
gpio reset_gpio
GPIO number for hardware reset, or idfxx::gpio::nc() if not used.
Definition panel.hpp:37
uint32_t bits_per_pixel
Color depth, in bpp.
Definition panel.hpp:40
void * vendor_config
vendor specific configuration, optional, left as NULL if not used
Definition panel.hpp:44
rgb_data_endian data_endian
Set the data endian for color data larger than 1 byte.
Definition panel.hpp:39
gpio::level reset_active_level
Active level for the panel reset signal.
Definition panel.hpp:42