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

bsp: Updated ESP32 S3 LCD EV Board with new LVGL port and LVGL9 (BSP-504) #333

Merged
merged 1 commit into from
May 28, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ description: ESP-BSP SquareLine LVGL Example
targets:
- esp32s3
dependencies:
esp32_s3_lcd_ev_board: "*"
esp32_s3_lcd_ev_board: "^2.1"
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
43 changes: 16 additions & 27 deletions bsp/esp32_s3_lcd_ev_board/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,20 @@

[![Component Registry](https://components.espressif.com/components/espressif/esp32_s3_lcd_ev_board/badge.svg)](https://components.espressif.com/components/espressif/esp32_s3_lcd_ev_board)

### Overview

ESP32-S3-LCD-EV-Board is a development board for evaluating and verifying ESP32-S3 screen interactive applications. It has the functions of touch screen interaction and voice interaction.

* [Hardware reference](https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide.html)
* [User Guide](https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide.html)

<div align=center><img src="https://docs.espressif.com/projects/esp-dev-kits/zh_CN/latest/_images/ESP32-S3-LCD-EV-Board_480x480.png" width=600/></div>

<div align=center><img src="https://docs.espressif.com/projects/esp-dev-kits/zh_CN/latest/_images/ESP32-S3-LCD-EV-Board_800x480.png" width=600/></div>

**The development board has the following characteristics:**
ESP32-S3-LCD-EV-Board is a development board for evaluating and verifying ESP32-S3 screen interactive applications. It has the functions of touch screen interaction and voice interaction. The development board has the following characteristics:

* Onboard ESP32-S3-WROOM-1 module, with built-in 16 MB Flash + 8/16 MB PSRAM
* Onboard audio codec + audio amplifier
* Onboard dual microphone pickup
* USB type-C interface download and debugging
* It can be used with different screen sub boards, and supports `RGB`, `8080`, `SPI`, `I2C` interface screens, as below:



| Board Name | Screen Size (inch) | Resolution | LCD Driver IC (Interface) | Touch Driver IC | Schematic | Support |
| -------------------------- | ------------------ | ---------- | ------------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| ESP32-S3-LCD-EV-Board-SUB1 | 0.9 | 128 x 64 | SSD1315 (I2C) | * | [link](https://docs.espressif.com/projects/esp-dev-kits/zh_CN/latest/_static/esp32-s3-lcd-ev-board/schematics/SCH_ESP32-S3-LCD-Ev-Board-SUB1_V1.0_20220617.pdf) | Not yet |
Expand All @@ -34,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 @@ -61,16 +50,16 @@ Based on the above configurations, there are three different anti-tearing modes
* Enable `BSP_DISPLAY_LVGL_AVOID_TEAR` and `BSP_DISPLAY_LVGL_FULL_REFRESH`

<!-- Autogenerated start: Dependencies -->
### Dependencies
| component | version |
|------------------------------------------------------------------------------------------------------------------------|----------|
| [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 |
| [espressif/esp_lcd_gc9503](https://components.espressif.com/components/espressif/esp_lcd_gc9503) | ^3 |
|[espressif/esp_lcd_panel_io_additions](https://components.espressif.com/components/espressif/esp_lcd_panel_io_additions)| ^1 |
| [espressif/esp_lcd_touch_ft5x06](https://components.espressif.com/components/espressif/esp_lcd_touch_ft5x06) | ^1 |
| [espressif/esp_lcd_touch_gt1151](https://components.espressif.com/components/espressif/esp_lcd_touch_gt1151) | ^1 |
| idf | >=5.0.1 |
| [lvgl/lvgl](https://components.espressif.com/components/lvgl/lvgl) | ^8 |
### Capabilities and dependencies
| Capability | Available | Component | Version |
|-------------|------------------|------------------------------------------------------------------------------------------------------------|----------|
| DISPLAY |:heavy_check_mark:| [espressif/esp_lcd_gc9503](https://components.espressif.com/components/espressif/esp_lcd_gc9503) | ^3 |
| LVGL_PORT |:heavy_check_mark:| [espressif/esp_lvgl_port](https://components.espressif.com/components/espressif/esp_lvgl_port) | ^2 |
| TOUCH |:heavy_check_mark:|[espressif/esp_lcd_touch_ft5x06](https://components.espressif.com/components/espressif/esp_lcd_touch_ft5x06)| ^1 |
| BUTTONS |:heavy_check_mark:| [espressif/button](https://components.espressif.com/components/espressif/button) |>=2.5,<4.0|
| AUDIO |:heavy_check_mark:| [espressif/esp_codec_dev](https://components.espressif.com/components/espressif/esp_codec_dev) | ^1 |
|AUDIO_SPEAKER|:heavy_check_mark:| | |
| AUDIO_MIC |:heavy_check_mark:| | |
| SDCARD | :x: | | |
| IMU | :x: | | |
<!-- Autogenerated end: Dependencies -->
11 changes: 6 additions & 5 deletions bsp/esp32_s3_lcd_ev_board/idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "2.1.0"
version: "2.2.0"
description: Board Support Package (BSP) for ESP32-S3-LCD-EV-Board
url: https://github.com/espressif/esp-bsp/tree/master/bsp/esp32_s3_lcd_ev_board

Expand All @@ -23,10 +23,6 @@ dependencies:
version: "^1"
public: true

lvgl/lvgl:
version: "^8"
public: true

esp_lcd_panel_io_additions:
version: "^1"
public: true
Expand All @@ -47,5 +43,10 @@ dependencies:
version: ">=2.5,<4.0"
public: true

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

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
28 changes: 18 additions & 10 deletions bsp/esp32_s3_lcd_ev_board/include/bsp/esp32_s3_lcd_ev_board.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,21 @@
#include "iot_button.h"
#include "lvgl.h"
#include "bsp/display.h"
#include "esp_lvgl_port.h"

#include "sdkconfig.h"
/**************************************************************************************************
* BSP Capabilities
**************************************************************************************************/

#define BSP_CAPS_DISPLAY 1
#define BSP_CAPS_TOUCH 1
#define BSP_CAPS_BUTTONS 1
#define BSP_CAPS_AUDIO 1
#define BSP_CAPS_AUDIO_SPEAKER 1
#define BSP_CAPS_AUDIO_MIC 1
#define BSP_CAPS_SDCARD 0
#define BSP_CAPS_IMU 0

/**************************************************************************************************
* ESP32-S3-LCD-EV-Board Pinout
Expand Down Expand Up @@ -97,7 +110,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,13 +322,8 @@ 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)
#else
#define LVGL_BUFFER_MALLOC (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT)
#endif


/**
* @brief Initialize display
Expand All @@ -325,7 +333,7 @@ esp_err_t bsp_audio_poweramp_enable(bool enable);
*
* @return Pointer to LVGL display or NULL when error occurred
*/
lv_disp_t *bsp_display_start(void);
lv_display_t *bsp_display_start(void);

/**
* @brief Initialize display
Expand All @@ -337,7 +345,7 @@ lv_disp_t *bsp_display_start(void);
*
* @return Pointer to LVGL display or NULL when error occurred
*/
lv_disp_t *bsp_display_start_with_config(const bsp_display_cfg_t *cfg);
lv_display_t *bsp_display_start_with_config(const bsp_display_cfg_t *cfg);

/**
* @brief Get pointer to input device (touch, buttons, ...)
Expand Down Expand Up @@ -379,7 +387,7 @@ void bsp_display_unlock(void);
* @param[in] disp: Pointer to LVGL display
* @param[in] rotation: Angle of the display rotation
*/
void bsp_display_rotate(lv_disp_t *disp, lv_disp_rot_t rotation);
void bsp_display_rotate(lv_display_t *disp, lv_display_rotation_t rotation);

/**
* @brief Get display horizontal resolution
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