Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(LVGL port): Support for RGB screen. (BSP-478) #313

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 0 additions & 73 deletions bsp/esp32_s3_lcd_ev_board/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -87,28 +87,12 @@ menu "Board Support Package"
bool "Auto refresh mode"
help
Refresh the LCD in the most common way.
config BSP_LCD_RGB_REFRESH_MANUALLY
bool "Manually refresh mode"
help
Refresh the LCD in a specific task instead of automatically refreshing.
config BSP_LCD_RGB_BOUNCE_BUFFER_MODE
bool "Bounce buffer mode"
help
Enable bounce buffer mode can achieve higher PCLK frequency at the cost of higher CPU consumption.
endchoice

config BSP_LCD_RGB_REFRESH_TASK_PERIOD
int "Minimum Period(ms) of LCD refreshing task"
depends on BSP_LCD_RGB_REFRESH_MANUALLY
default 10
help
This configuration does not necessarily represent the actual refresh cycle of the RGB interface.

config BSP_LCD_RGB_REFRESH_TASK_PRIORITY
int "Priority of LCD refreshing task"
depends on BSP_LCD_RGB_REFRESH_MANUALLY
default 2

config BSP_LCD_RGB_BOUNCE_BUFFER_HEIGHT
depends on BSP_LCD_RGB_BOUNCE_BUFFER_MODE
int "Bounce buffer height"
Expand All @@ -118,39 +102,6 @@ menu "Board Support Package"
endmenu

menu "Display"
config BSP_DISPLAY_LVGL_TASK_PRIORITY
int "LVGL task priority"
default 2
help
The Board Support Package will create a task that will periodically handle LVGL operation in lv_timer_handler().

config BSP_DISPLAY_LVGL_TASK_CORE_ID
int "LVGL task pinned core ID"
default -1
range -1 1
help
Core to pin LVGL task. -1 means no pinning.

config BSP_DISPLAY_LVGL_TASK_DELAY
int "LVGL task minimum delay time (ms)"
default 10
range 1 100
help
Minimum delay time for LVGL task. It should be larger if the task watchdog is triggered frequently.

config BSP_DISPLAY_LVGL_TASK_STACK_SIZE_KB
int "LVGL task stack size (KB)"
default 4
help
Size(KB) of LVGL task stack.

config BSP_DISPLAY_LVGL_TICK
int "LVGL tick period"
default 5
range 1 100
help
Period of LVGL tick timer.

config BSP_DISPLAY_LVGL_AVOID_TEAR
bool "Avoid tearing effect"
depends on BSP_LCD_RGB_BUFFER_NUMS > 1
Expand All @@ -168,30 +119,6 @@ menu "Board Support Package"
bool "Direct mode"
endchoice

choice BSP_DISPLAY_LVGL_ROTATION
depends on BSP_DISPLAY_LVGL_AVOID_TEAR
depends on BSP_LCD_RGB_BUFFER_NUMS = 3
prompt "Select rotation"
default BSP_DISPLAY_LVGL_ROTATION_NONE
config BSP_DISPLAY_LVGL_ROTATION_NONE
bool "Rotation 0"
config BSP_DISPLAY_LVGL_ROTATION_90
bool "Rotation 90"
config BSP_DISPLAY_LVGL_ROTATION_180
bool "Rotation 180"
config BSP_DISPLAY_LVGL_ROTATION_270
bool "Rotation 270"
help
Rotate screen when avoid tearing effect is enabled. Need to set BSP_LCD_RGB_BUFFER_NUMS to 3.
endchoice

config BSP_DISPLAY_LVGL_ROTATION_DEGREE
int
default 0 if BSP_DISPLAY_LVGL_ROTATION_NONE
default 1 if BSP_DISPLAY_LVGL_ROTATION_90
default 2 if BSP_DISPLAY_LVGL_ROTATION_180
default 3 if BSP_DISPLAY_LVGL_ROTATION_270

choice BSP_DISPLAY_LVGL_BUF_CAPS
depends on !BSP_DISPLAY_LVGL_AVOID_TEAR
prompt "Select LVGL buffer memory capability"
Expand Down
9 changes: 2 additions & 7 deletions bsp/esp32_s3_lcd_ev_board/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,13 @@ Here are some useful configurations in menuconfig that can be customed by user:
* `BSP_LCD_RGB_BUFFER_NUMS`: Configure the number of frame buffers. The anti-tearing function can be activated only when set to a value greater than one.
* `BSP_LCD_RGB_REFRESH_MODE`: Choose the refresh mode for the RGB LCD.
* `BSP_LCD_RGB_REFRESH_AUTO`: Use the most common method to refresh the LCD.
* `BSP_LCD_RGB_REFRESH_MANUALLY`: Refresh the LCD within a dedicated task. This can help manage PSRAM bandwidth.
* `BSP_LCD_RGB_BOUNCE_BUFFER_MODE`: Enabling bounce buffer mode can lead to a higher PCLK frequency at the expense of increased CPU consumption. **This mode is particularly useful when dealing with [screen drift](https://docs.espressif.com/projects/esp-faq/en/latest/software-framework/peripherals/lcd.html#why-do-i-get-drift-overall-drift-of-the-display-when-esp32-s3-is-driving-an-rgb-lcd-screen), especially in scenarios involving Wi-Fi usage or writing to Flash memory.** This feature should be used in conjunction with `ESP32S3_DATA_CACHE_LINE_64B` configuration. For more detailed information, refer to the [documentation](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/lcd.html#bounce-buffer-with-single-psram-frame-buffer).
* `BSP_DISPLAY_LVGL_BUF_CAPS`: Select the memory type for the LVGL buffer. Internal memory offers better performance.
* `BSP_DISPLAY_LVGL_BUF_HEIGHT`: Set the height of the LVGL buffer, with its width aligning with the LCD's width. The default value is 100, decreasing it can lower memory consumption.
* `BSP_DISPLAY_LVGL_AVOID_TEAR`: Avoid tearing effect by using multiple buffers. This requires setting `BSP_LCD_RGB_BUFFER_NUMS` to a value greater than 1.
* `BSP_DISPLAY_LVGL_MODE`:
* `BSP_DISPLAY_LVGL_FULL_REFRESH`: Use LVGL full-refresh mode. Set `BSP_LCD_RGB_BUFFER_NUMS` to `3` will get higher FPS when enable `BSP_DISPLAY_LVGL_ROTATION_NONE`.
* `BSP_DISPLAY_LVGL_FULL_REFRESH`: Use LVGL full-refresh mode. Set `BSP_LCD_RGB_BUFFER_NUMS` to `3` will get higher FPS`.
* `BSP_DISPLAY_LVGL_DIRECT_MODE`: Use LVGL's direct mode.
* `BSP_DISPLAY_LVGL_ROTATION`: Rotate the screen clockwise. This requires setting `BSP_LCD_RGB_BUFFER_NUMS` to `3`. **The rotation is software-based and will substantially reduce FPS if enabled.**
* `BSP_DISPLAY_LVGL_ROTATION_NONE`: No rotation.
* `BSP_DISPLAY_LVGL_ROTATION_90`: 90-degree rotation.
* `BSP_DISPLAY_LVGL_ROTATION_180`: 180-degree rotation.
* `BSP_DISPLAY_LVGL_ROTATION_270`: 270-degree rotation.

Based on the above configurations, there are three different anti-tearing modes can be used:

Expand All @@ -59,6 +53,7 @@ Based on the above configurations, there are three different anti-tearing modes
### Dependencies
| component | version |
|------------------------------------------------------------------------------------------------------------------------|----------|
| [esp_lvgl_port](https://components.espressif.com/components/esp_lvgl_port) | ^2 |
| [espressif/button](https://components.espressif.com/components/espressif/button) |>=2.5,<4.0|
| [espressif/esp_codec_dev](https://components.espressif.com/components/espressif/esp_codec_dev) | ^1 |
| [espressif/esp_io_expander_tca9554](https://components.espressif.com/components/espressif/esp_io_expander_tca9554) | ^1 |
Expand Down
5 changes: 5 additions & 0 deletions bsp/esp32_s3_lcd_ev_board/idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,10 @@ dependencies:
version: ">=2.5,<4.0"
public: true

esp_lvgl_port:
version: "^2"
override_path: '../../components/esp_lvgl_port'
public: true

examples:
- path: ../../examples/display_lvgl_demos
17 changes: 0 additions & 17 deletions bsp/esp32_s3_lcd_ev_board/include/bsp/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ typedef struct {
int max_transfer_sz; /*!< Maximum transfer size, in bytes. */
} bsp_display_config_t;

/**
* @brief LCD transmit done callback function type
*
*/
typedef bool (*bsp_display_trans_done_cb_t)(esp_lcd_panel_handle_t handle);

/**
* @brief Create new display panel
*
Expand All @@ -62,17 +56,6 @@ typedef bool (*bsp_display_trans_done_cb_t)(esp_lcd_panel_handle_t handle);
*/
esp_err_t bsp_display_new(const bsp_display_config_t *config, esp_lcd_panel_handle_t *ret_panel, esp_lcd_panel_io_handle_t *ret_io);

/**
* @brief Register a callback function which will be called when finish refreshing
*
* @param[in] callback The function to be registered. It should return true if need to yield, otherwise return false
*
* @return
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG Callback function should be placed in IRAM, use `IRAM_ATTR` to define it
*/
esp_err_t bsp_display_register_trans_done_callback(bsp_display_trans_done_cb_t callback);

/**
* @brief Set display's brightness (Useless, just for compatibility)
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "iot_button.h"
#include "lvgl.h"
#include "bsp/display.h"
#include "esp_lvgl_port.h"

#include "sdkconfig.h"

Expand Down Expand Up @@ -98,6 +99,7 @@ extern "C" {
*/
typedef struct {
void *dummy; /*!< Prepared for future use. */
lvgl_port_cfg_t lvgl_port_cfg;
} bsp_display_cfg_t;

/**************************************************************************************************
Expand Down Expand Up @@ -309,7 +311,6 @@ esp_err_t bsp_audio_poweramp_enable(bool enable);
#define BSP_LCD_V_RES bsp_display_get_v_res()

/* LVGL related parameters */
#define LVGL_TICK_PERIOD_MS (CONFIG_BSP_DISPLAY_LVGL_TICK)
#define LVGL_BUFFER_HEIGHT (CONFIG_BSP_DISPLAY_LVGL_BUF_HEIGHT)
#if CONFIG_BSP_DISPLAY_LVGL_PSRAM
#define LVGL_BUFFER_MALLOC (MALLOC_CAP_SPIRAM)
Expand Down
1 change: 0 additions & 1 deletion bsp/esp32_s3_lcd_ev_board/include/bsp/touch.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#pragma once

#include "esp_err.h"
#include "esp_lcd_types.h"
#include "esp_lcd_touch.h"

#ifdef __cplusplus
Expand Down
54 changes: 0 additions & 54 deletions bsp/esp32_s3_lcd_ev_board/priv_include/bsp_lvgl_port.h

This file was deleted.

Loading
Loading