|
|
3 jaren geleden | |
|---|---|---|
| .. | ||
| main | 3 jaren geleden | |
| CMakeLists.txt | 3 jaren geleden | |
| README.md | 3 jaren geleden | |
| pytest_rgb_panel_lvgl.py | 3 jaren geleden | |
| sdkconfig.ci.double_fb | 3 jaren geleden | |
| sdkconfig.ci.single_fb_no_bb | 3 jaren geleden | |
| sdkconfig.ci.single_fb_with_bb | 3 jaren geleden | |
| sdkconfig.defaults | 3 jaren geleden | |
| sdkconfig.defaults.esp32s3 | 3 jaren geleden | |
| Supported Targets | ESP32-S3 |
|---|
esp_lcd supports RGB interfaced LCD panel, with one or two frame buffer(s) managed by the driver itself.
This example shows the general process of installing an RGB panel driver, and displays a scatter chart on the screen based on the LVGL library. For more information about porting the LVGL library, please refer to official porting guide. This example uses two kinds of buffering mode based on the number of frame buffers:
| Number of Frame Buffers | LVGL buffering mode | Way to avoid tear effect |
|---|---|---|
| 1 | Two buffers | Extra synchronization mechanism is needed, e.g. using semaphore. |
| 2 | Full refresh | There's no intersection between writing to an offline frame buffer and reading from an online frame buffer. |
The connection between ESP Board and the LCD is as follows:
ESP Board RGB Panel
+-----------------------+ +-------------------+
| GND +--------------+GND |
| | | |
| 3V3 +--------------+VCC |
| | | |
| PCLK+--------------+PCLK |
| | | |
| DATA[15:0]+--------------+DATA[15:0] |
| | | |
| HSYNC+--------------+HSYNC |
| | | |
| VSYNC+--------------+VSYNC |
| | | |
| DE+--------------+DE |
| | | |
| BK_LIGHT+--------------+BLK |
+-----------------------+ | |
3V3-----+DISP_EN |
| |
+-------------------+
The GPIO number used by this example can be changed in lvgl_example_main.c.
Especially, please pay attention to the level used to turn on the LCD backlight, some LCD module needs a low level to turn it on, while others take a high level. You can change the backlight level macro EXAMPLE_LCD_BK_LIGHT_ON_LEVEL in lvgl_example_main.c.
If the RGB LCD panel only supports DE mode, you can even bypass the HSYNC and VSYNC signals, by assigning EXAMPLE_PIN_NUM_HSYNC and EXAMPLE_PIN_NUM_VSYNC with -1.
Run idf.py menuconfig and go to Example Configuration:
Use double Frame BufferAvoid tearing effect (available only when step 1 was chosen to false)Use bounce buffer (available only when step 1 was chosen to false)Run idf.py -p PORT build flash monitor to build, flash and monitor the project. A scatter chart will show up on the LCD as expected.
The first time you run idf.py for the example will cost extra time as the build system needs to address the component dependencies and downloads the missing components from registry into managed_components folder.
(To exit the serial monitor, type Ctrl-].)
See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.
...
I (0) cpu_start: Starting scheduler on APP CPU.
I (856) esp_psram: Reserving pool of 32K of internal memory for DMA/internal allocations
I (856) example: Create semaphores
I (866) example: Turn off LCD backlight
I (866) gpio: GPIO[4]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (876) example: Install RGB LCD panel driver
I (906) example: Register event callbacks
I (906) example: Initialize RGB LCD panel
I (906) example: Turn on LCD backlight
I (906) example: Initialize LVGL library
I (916) example: Allocate separate LVGL draw buffers from PSRAM
I (916) example: Register display driver to LVGL
I (926) example: Install LVGL tick timer
I (926) example: Display LVGL Scatter Chart
...
EXAMPLE_LCD_BK_LIGHT_ON_LEVELpclk_active_neg), sync porches like VBP (by vsync_back_porch) according to your LCD specCONFIG_SPIRAM_FETCH_INSTRUCTIONS and CONFIG_SPIRAM_RODATA, which can saves some bandwidth of SPI0 from being consumed by ICache.CONFIG_EXAMPLE_USE_BOUNCE_BUFFER, which will make the LCD controller fetch data from internal SRAM (instead of the PSRAM), but at the cost of increasing CPU usage.CONFIG_SPIRAM_FETCH_INSTRUCTIONS and CONFIG_SPIRAM_RODATA can also help if the you're not using the bounce buffer mode. These two configurations can save some SPI0 bandwidth from being consumed by ICache.For any technical queries, please open an issue on GitHub. We will get back to you soon.