3D Graphics Engine for ESP32
 
Loading...
Searching...
No Matches
driver_lcd.hpp
Go to the documentation of this file.
1
35
36#pragma once
37
38#include "esp_lcd_panel_ops.h"
39#include "esp_ldo_regulator.h"
40#include "esp_lcd_panel_vendor.h"
41#include "esp_lcd_panel_interface.h"
42#include "esp_lcd_panel_commands.h"
43#include "esp_timer.h"
44#include "esp_err.h"
45#include "esp_log.h"
46#include "freertos/FreeRTOS.h"
47#include "freertos/task.h"
48#include "freertos/queue.h"
49#include "freertos/semphr.h"
50#include "driver/gpio.h"
51#ifdef CONFIG_IDF_TARGET_ESP32P4
52#include "esp_lcd_mipi_dsi.h"
53#endif
54
55namespace Ragot
56{
66 {
67 public:
68
74 DriverLCD() = default;
75
81 virtual ~DriverLCD() = default;
82
92 virtual esp_err_t init(gpio_num_t reset_pin, gpio_num_t bk_pin) = 0;
93
101 virtual esp_err_t deinit() = 0;
102
113 virtual esp_err_t set_pixel(uint32_t x, uint32_t y, uint32_t color) = 0;
114
123 virtual esp_err_t send_frame_buffer( const void * frame_buffer) = 0;
124
130 const size_t get_width() const { return width; }
131
137 size_t get_width() { return width; }
138
144 const size_t get_height() const { return height; }
145
151 size_t get_height() { return height; }
152
153
159 const lcd_color_rgb_pixel_format_t get_pixel_format() const { return pixel_format; }
160
166 lcd_color_rgb_pixel_format_t get_pixel_format() { return pixel_format; }
167
173 const esp_lcd_panel_handle_t get_handler() const { return handler; }
174
180 esp_lcd_panel_handle_t get_handler() { return handler; }
181
188 const bool is_initialized() const { return initialized; }
189
196 bool is_initialized() { return initialized; }
197
198 protected:
199 bool initialized = false;
200 size_t width;
201 size_t height;
202 lcd_color_rgb_pixel_format_t pixel_format;
203 esp_lcd_panel_handle_t handler;
204 };
205}
virtual esp_err_t send_frame_buffer(const void *frame_buffer)=0
Sends a frame buffer to the LCD panel.
const size_t get_height() const
Gets the height of the LCD panel.
Definition driver_lcd.hpp:144
virtual esp_err_t set_pixel(uint32_t x, uint32_t y, uint32_t color)=0
Sets a pixel at the specified coordinates to the given color.
virtual esp_err_t deinit()=0
Deinitializes the LCD driver.
size_t get_height()
Gets the height of the LCD panel.
Definition driver_lcd.hpp:151
DriverLCD()=default
Default constructor for the DriverLCD class.
bool initialized
Flag indicating if the LCD driver is initialized.
Definition driver_lcd.hpp:199
const bool is_initialized() const
Checks if the LCD driver is initialized.
Definition driver_lcd.hpp:188
const size_t get_width() const
Gets the width of the LCD panel.
Definition driver_lcd.hpp:130
const esp_lcd_panel_handle_t get_handler() const
Get the handler object.
Definition driver_lcd.hpp:173
virtual ~DriverLCD()=default
Default virtual destructor for the DriverLCD class.
bool is_initialized()
Checks if the LCD driver is initialized.
Definition driver_lcd.hpp:196
esp_lcd_panel_handle_t get_handler()
Get the handler object.
Definition driver_lcd.hpp:180
const lcd_color_rgb_pixel_format_t get_pixel_format() const
Get the pixel format object.
Definition driver_lcd.hpp:159
size_t get_width()
Gets the height of the LCD panel.
Definition driver_lcd.hpp:137
size_t width
Width of the LCD panel in pixels.
Definition driver_lcd.hpp:200
esp_lcd_panel_handle_t handler
Handle to the LCD panel.
Definition driver_lcd.hpp:203
lcd_color_rgb_pixel_format_t get_pixel_format()
Get the pixel format object.
Definition driver_lcd.hpp:166
virtual esp_err_t init(gpio_num_t reset_pin, gpio_num_t bk_pin)=0
Initializes the LCD driver with the specified reset and backlight GPIO pins.
lcd_color_rgb_pixel_format_t pixel_format
Pixel format of the LCD panel.
Definition driver_lcd.hpp:202
size_t height
Height of the LCD panel in pixels.
Definition driver_lcd.hpp:201
Definition Assets.cpp:39