diff --git a/.github/ci/bsp_noglib.py b/.github/ci/bsp_noglib.py
index 51e67d5a0..57cac0e37 100644
--- a/.github/ci/bsp_noglib.py
+++ b/.github/ci/bsp_noglib.py
@@ -40,7 +40,6 @@ def remove_esp_lvgl_port(bsp_path):
del deps["espressif/esp_lvgl_port"]
except KeyError:
print("{}: could not remove esp_lvgl_port".format(str(bsp_path)))
- return 1
try:
del deps["lvgl/lvgl"]
except KeyError:
diff --git a/.github/ci/update_readme_dependencies.py b/.github/ci/update_readme_dependencies.py
index ff5fe872b..2c4718870 100755
--- a/.github/ci/update_readme_dependencies.py
+++ b/.github/ci/update_readme_dependencies.py
@@ -222,14 +222,15 @@ def get_capabilities_table(header_path, bsp_path, bsp_name, manifest):
if component_versions is not None:
components = [c for c, _ in component_versions]
versions = [v for _, v in component_versions]
- table_data.append(
- {
- "Available": ":heavy_check_mark:",
- "Capability": ":black_circle: " + 'LVGL_PORT',
- "Controller/Codec": "",
- "Component": "
".join(components),
- "Version": "
".join(versions),
- })
+ if versions:
+ table_data.append(
+ {
+ "Available": ":heavy_check_mark:",
+ "Capability": ":black_circle: " + 'LVGL_PORT',
+ "Controller/Codec": "",
+ "Component": "
".join(components),
+ "Version": "
".join(versions),
+ })
return table_data
diff --git a/bsp/m5stack_tab5/API.md b/bsp/m5stack_tab5/API.md
index 51fd230ec..5c13b20ca 100644
--- a/bsp/m5stack_tab5/API.md
+++ b/bsp/m5stack_tab5/API.md
@@ -882,7 +882,6 @@ Below are some of the most relevant predefined constants:
| Type | Name |
| ---: | :--- |
-| struct | [**bsp\_display\_cfg\_t**](#struct-bsp_display_cfg_t)
_BSP display (LVGL) configuration structure._ |
| struct | [**bsp\_display\_config\_t**](#struct-bsp_display_config_t)
_BSP display low level configuration structure._ |
| struct | [**bsp\_lcd\_handles\_t**](#struct-bsp_lcd_handles_t)
_BSP display return handles._ |
| struct | [**bsp\_touch\_config\_t**](#struct-bsp_touch_config_t)
_BSP touch configuration structure._ |
@@ -899,14 +898,8 @@ Below are some of the most relevant predefined constants:
| void | [**bsp\_display\_delete**](#function-bsp_display_delete) (void)
_Delete display panel._ |
| esp\_err\_t | [**bsp\_display\_enter\_sleep**](#function-bsp_display_enter_sleep) (void)
_Set display enter sleep mode._ |
| esp\_err\_t | [**bsp\_display\_exit\_sleep**](#function-bsp_display_exit_sleep) (void)
_Set display exit sleep mode._ |
-| lv\_indev\_t \* | [**bsp\_display\_get\_input\_dev**](#function-bsp_display_get_input_dev) (void)
_Get pointer to input device (touch, buttons, ...)_ |
-| bool | [**bsp\_display\_lock**](#function-bsp_display_lock) (uint32\_t timeout\_ms)
_Take LVGL mutex._ |
| esp\_err\_t | [**bsp\_display\_new**](#function-bsp_display_new) (const [**bsp\_display\_config\_t**](#struct-bsp_display_config_t) \*config, esp\_lcd\_panel\_handle\_t \*ret\_panel, esp\_lcd\_panel\_io\_handle\_t \*ret\_io)
_Create new display panel._ |
| esp\_err\_t | [**bsp\_display\_new\_with\_handles**](#function-bsp_display_new_with_handles) (const [**bsp\_display\_config\_t**](#struct-bsp_display_config_t) \*config, [**bsp\_lcd\_handles\_t**](#struct-bsp_lcd_handles_t) \*ret\_handles)
_Create new display panel._ |
-| void | [**bsp\_display\_rotate**](#function-bsp_display_rotate) (lv\_display\_t \*disp, lv\_disp\_rotation\_t rotation)
_Rotate screen._ |
-| lv\_display\_t \* | [**bsp\_display\_start**](#function-bsp_display_start) (void)
_Initialize display._ |
-| lv\_display\_t \* | [**bsp\_display\_start\_with\_config**](#function-bsp_display_start_with_config) (const [**bsp\_display\_cfg\_t**](#struct-bsp_display_cfg_t) \*cfg)
_Initialize display._ |
-| void | [**bsp\_display\_unlock**](#function-bsp_display_unlock) (void)
_Give LVGL mutex._ |
| esp\_err\_t | [**bsp\_touch\_new**](#function-bsp_touch_new) (const [**bsp\_touch\_config\_t**](#struct-bsp_touch_config_t) \*config, esp\_lcd\_touch\_handle\_t \*ret\_touch)
_Create new touchscreen._ |
## Macros
@@ -934,26 +927,6 @@ Below are some of the most relevant predefined constants:
## Structures and Types Documentation
-### struct `bsp_display_cfg_t`
-
-_BSP display (LVGL) configuration structure._
-
-Variables:
-
-- unsigned int buff_dma
Allocated LVGL buffer will be DMA capable
-
-- unsigned int buff_spiram
Allocated LVGL buffer will be in PSRAM
-
-- uint32\_t buffer_size
Size of the buffer for the screen in pixels
-
-- bool double_buffer
True, if should be allocated two buffers
-
-- struct [**bsp\_display\_cfg\_t**](#struct-bsp_display_cfg_t) flags
-
-- lvgl\_port\_cfg\_t lvgl_port_cfg
LVGL port configuration
-
-- unsigned int sw_rotate
Use software rotation (slower), The feature is unavailable under avoid-tear mode
-
### struct `bsp_display_config_t`
_BSP display low level configuration structure._
@@ -1147,50 +1120,6 @@ All the display (LCD, backlight, touch) will exit sleep mode.
* ESP\_OK on success
* ESP\_ERR\_NOT\_SUPPORTED if this function is not supported by the panel
-### function `bsp_display_get_input_dev`
-
-_Get pointer to input device (touch, buttons, ...)_
-```c
-lv_indev_t * bsp_display_get_input_dev (
- void
-)
-```
-
-
-**Note:**
-
-The LVGL input device is initialized in [**bsp\_display\_start()**](#function-bsp_display_start) function.
-
-
-
-**Returns:**
-
-Pointer to LVGL input device or NULL when not initialized
-### function `bsp_display_lock`
-
-_Take LVGL mutex._
-```c
-bool bsp_display_lock (
- uint32_t timeout_ms
-)
-```
-
-
-**Parameters:**
-
-
-* `timeout_ms` Timeout in [ms]. 0 will block indefinitely.
-
-
-**Returns:**
-
-true Mutex was taken
-
-
-
-**Returns:**
-
-false Mutex was NOT taken
### function `bsp_display_new`
_Create new display panel._
@@ -1269,75 +1198,6 @@ bsp_display_delete();
* ESP\_OK On success
* Other errors from underlying esp\_lcd driver
-### function `bsp_display_rotate`
-
-_Rotate screen._
-```c
-void bsp_display_rotate (
- lv_display_t *disp,
- lv_disp_rotation_t rotation
-)
-```
-
-
-Display must be already initialized by calling [**bsp\_display\_start()**](#function-bsp_display_start)
-
-
-
-**Parameters:**
-
-
-* `disp` Pointer to LVGL display
-* `rotation` Angle of the display rotation
-### function `bsp_display_start`
-
-_Initialize display._
-```c
-lv_display_t * bsp_display_start (
- void
-)
-```
-
-
-This function initializes SPI, display controller and starts LVGL handling task. LCD backlight must be enabled separately by calling [**bsp\_display\_brightness\_set()**](#function-bsp_display_brightness_set)
-
-
-
-**Returns:**
-
-Pointer to LVGL display or NULL when error occurred
-### function `bsp_display_start_with_config`
-
-_Initialize display._
-```c
-lv_display_t * bsp_display_start_with_config (
- const bsp_display_cfg_t *cfg
-)
-```
-
-
-This function initializes SPI, display controller and starts LVGL handling task. LCD backlight must be enabled separately by calling [**bsp\_display\_brightness\_set()**](#function-bsp_display_brightness_set)
-
-
-
-**Parameters:**
-
-
-* `cfg` display configuration
-
-
-**Returns:**
-
-Pointer to LVGL display or NULL when error occurred
-### function `bsp_display_unlock`
-
-_Give LVGL mutex._
-```c
-void bsp_display_unlock (
- void
-)
-```
-
### function `bsp_touch_new`
_Create new touchscreen._
diff --git a/bsp/m5stack_tab5/CMakeLists.txt b/bsp/m5stack_tab5/CMakeLists.txt
index 3f959fb08..fd12f657f 100644
--- a/bsp/m5stack_tab5/CMakeLists.txt
+++ b/bsp/m5stack_tab5/CMakeLists.txt
@@ -11,3 +11,6 @@ idf_component_register(
REQUIRES ${REQ}
PRIV_REQUIRES esp_psram ${PRIV_REQ}
)
+
+# BSP Name Alias
+add_library(esp_bsp::core ALIAS ${COMPONENT_LIB})
diff --git a/bsp/m5stack_tab5/README.md b/bsp/m5stack_tab5/README.md
index 84e771b4c..ed1fb3b3e 100644
--- a/bsp/m5stack_tab5/README.md
+++ b/bsp/m5stack_tab5/README.md
@@ -30,27 +30,30 @@ Tab5 is suitable for smart home control, remote monitoring, industrial automatio

+## Graphics
+
+This BSP includes only the low-level drivers and initialization for the LCD display and touch controller, and does not bundle any graphical library. For integration with LVGL or other graphics frameworks, see [Graphical Components](../components/bsp_graphics/).
+
## Capabilities and dependencies
-| Available | Capability |Controller/Codec| Component | Version |
-|------------------|------------------------|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------|
-|:heavy_check_mark:| :pager: DISPLAY |ili9881c, st7123| idf
[espressif/esp_lcd_st7123](https://components.espressif.com/components/espressif/esp_lcd_st7123)
[espressif/esp_lcd_ili9881c](https://components.espressif.com/components/espressif/esp_lcd_ili9881c) |>=5.4
*
*|
-|:heavy_check_mark:|:black_circle: LVGL_PORT| | [espressif/esp_lvgl_port](https://components.espressif.com/components/espressif/esp_lvgl_port) | ^2 |
-|:heavy_check_mark:| :point_up: TOUCH | gt911, st7123 |[espressif/esp_lcd_touch_st7123](https://components.espressif.com/components/espressif/esp_lcd_touch_st7123)
[espressif/esp_lcd_touch_gt911](https://components.espressif.com/components/espressif/esp_lcd_touch_gt911)| *
* |
-| :x: | :radio_button: BUTTONS | | | |
-| :x: | :white_circle: KNOB | | | |
-|:heavy_check_mark:| :musical_note: AUDIO | | [espressif/esp_codec_dev](https://components.espressif.com/components/espressif/esp_codec_dev) | ~1.5 |
-|:heavy_check_mark:| :speaker: AUDIO_SPEAKER| es8388 | | |
-|:heavy_check_mark:| :microphone: AUDIO_MIC | es7210 | | |
-|:heavy_check_mark:| :floppy_disk: SDCARD | | idf | >=5.4 |
-| :x: | :bulb: LED | | | |
-|:heavy_check_mark:| :camera: CAMERA | SC202CS | [espressif/esp_video](https://components.espressif.com/components/espressif/esp_video) | ~2.0 |
-| :x: | :battery: BAT | | | |
-|:heavy_check_mark:| :video_game: IMU | | | |
-| :x: | :thermometer: HUMITURE | | | |
+| Available | Capability |Controller/Codec| Component | Version |
+|------------------|-----------------------|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------|
+|:heavy_check_mark:| :pager: DISPLAY |ili9881c, st7123| idf
[espressif/esp_lcd_st7123](https://components.espressif.com/components/espressif/esp_lcd_st7123)
[espressif/esp_lcd_ili9881c](https://components.espressif.com/components/espressif/esp_lcd_ili9881c) |>=5.4
*
*|
+|:heavy_check_mark:| :point_up: TOUCH | gt911, st7123 |[espressif/esp_lcd_touch_st7123](https://components.espressif.com/components/espressif/esp_lcd_touch_st7123)
[espressif/esp_lcd_touch_gt911](https://components.espressif.com/components/espressif/esp_lcd_touch_gt911)| *
* |
+| :x: | :radio_button: BUTTONS| | | |
+| :x: | :white_circle: KNOB | | | |
+|:heavy_check_mark:| :musical_note: AUDIO | | [espressif/esp_codec_dev](https://components.espressif.com/components/espressif/esp_codec_dev) | ~1.5 |
+|:heavy_check_mark:|:speaker: AUDIO_SPEAKER| es8388 | | |
+|:heavy_check_mark:| :microphone: AUDIO_MIC| es7210 | | |
+|:heavy_check_mark:| :floppy_disk: SDCARD | | idf | >=5.4 |
+| :x: | :bulb: LED | | | |
+|:heavy_check_mark:| :camera: CAMERA | SC202CS | [espressif/esp_video](https://components.espressif.com/components/espressif/esp_video) | ~2.0 |
+| :x: | :battery: BAT | | | |
+|:heavy_check_mark:| :video_game: IMU | | | |
+| :x: | :thermometer: HUMITURE| | | |
diff --git a/bsp/m5stack_tab5/idf_component.yml b/bsp/m5stack_tab5/idf_component.yml
index 4c1c9d0c4..945034044 100644
--- a/bsp/m5stack_tab5/idf_component.yml
+++ b/bsp/m5stack_tab5/idf_component.yml
@@ -1,5 +1,5 @@
-version: "1.2.0~1"
+version: "2.0.0"
description: Board Support Package (BSP) for M5Stack Tab5
url: https://github.com/espressif/esp-bsp/tree/master/bsp/m5stack_tab5
@@ -27,11 +27,6 @@ dependencies:
public: true
override_path: "../../components/io_expander/esp_io_expander_pi4ioe5v6408"
- espressif/esp_lvgl_port:
- version: "^2"
- public: true
- override_path: "../../components/esp_lvgl_port"
-
espressif/esp_lcd_st7123:
version: "*"
public: false
@@ -43,11 +38,11 @@ dependencies:
espressif/esp_lcd_touch_st7123:
version: "*"
- public: false
+ public: true
espressif/esp_lcd_touch_gt911:
version: "*"
- public: false
+ public: true
# Here cannot be override_path, because we are using two touch comonents.
# The ST7123 is not owned by BSP and loading another version of esp_lcd_touch
diff --git a/bsp/m5stack_tab5/include/bsp/display.h b/bsp/m5stack_tab5/include/bsp/display.h
index fd215364d..ff7d0344b 100644
--- a/bsp/m5stack_tab5/include/bsp/display.h
+++ b/bsp/m5stack_tab5/include/bsp/display.h
@@ -192,6 +192,28 @@ esp_err_t bsp_display_backlight_on(void);
*/
esp_err_t bsp_display_backlight_off(void);
+/**
+ * @brief Set display enter sleep mode
+ *
+ * All the display (LCD, backlight, touch) will enter sleep mode.
+ *
+ * @return
+ * - ESP_OK on success
+ * - ESP_ERR_NOT_SUPPORTED if this function is not supported by the panel
+ */
+esp_err_t bsp_display_enter_sleep(void);
+
+/**
+ * @brief Set display exit sleep mode
+ *
+ * All the display (LCD, backlight, touch) will exit sleep mode.
+ *
+ * @return
+ * - ESP_OK on success
+ * - ESP_ERR_NOT_SUPPORTED if this function is not supported by the panel
+ */
+esp_err_t bsp_display_exit_sleep(void);
+
#ifdef __cplusplus
}
#endif
diff --git a/bsp/m5stack_tab5/include/bsp/m5stack_tab5.h b/bsp/m5stack_tab5/include/bsp/m5stack_tab5.h
index 72bd4d370..72b544c27 100644
--- a/bsp/m5stack_tab5/include/bsp/m5stack_tab5.h
+++ b/bsp/m5stack_tab5/include/bsp/m5stack_tab5.h
@@ -24,11 +24,6 @@
#include "esp_io_expander.h"
#include "iot_sensor_hub.h"
-
-#if (BSP_CONFIG_NO_GRAPHIC_LIB == 0)
-#include "lvgl.h"
-#include "esp_lvgl_port.h"
-#endif // BSP_CONFIG_NO_GRAPHIC_LIB == 0
/**************************************************************************************************
* BSP Board Name
**************************************************************************************************/
@@ -403,118 +398,6 @@ esp_err_t bsp_sdcard_sdspi_mount(bsp_sdcard_cfg_t *cfg);
/** @} */ // end of storage
-/** \addtogroup g04_display
- * @{
- */
-
-/**************************************************************************************************
- *
- * LCD interface
- *
- * LVGL is used as graphics library. LVGL is NOT thread safe, therefore the user must take LVGL mutex
- * by calling bsp_display_lock() before calling any LVGL API (lv_...) and then give the mutex with
- * bsp_display_unlock().
- *
- * Display's backlight must be enabled explicitly by calling bsp_display_backlight_on()
- **************************************************************************************************/
-
-#if (BSP_CONFIG_NO_GRAPHIC_LIB == 0)
-
-/**
- * @brief BSP display (LVGL) configuration structure
- */
-typedef struct {
- lvgl_port_cfg_t lvgl_port_cfg; /*!< LVGL port configuration */
- uint32_t buffer_size; /*!< Size of the buffer for the screen in pixels */
- bool double_buffer; /*!< True, if should be allocated two buffers */
- struct {
- unsigned int buff_dma: 1; /*!< Allocated LVGL buffer will be DMA capable */
- unsigned int buff_spiram: 1; /*!< Allocated LVGL buffer will be in PSRAM */
- unsigned int sw_rotate: 1; /*!< Use software rotation (slower), The feature is unavailable under avoid-tear mode */
- } flags;
-} bsp_display_cfg_t;
-
-/**
- * @brief Initialize display
- *
- * This function initializes SPI, display controller and starts LVGL handling task.
- * LCD backlight must be enabled separately by calling bsp_display_brightness_set()
- *
- * @return Pointer to LVGL display or NULL when error occurred
- */
-lv_display_t *bsp_display_start(void);
-
-/**
- * @brief Initialize display
- *
- * This function initializes SPI, display controller and starts LVGL handling task.
- * LCD backlight must be enabled separately by calling bsp_display_brightness_set()
- *
- * @param cfg display configuration
- *
- * @return Pointer to LVGL display or NULL when error occurred
- */
-lv_display_t *bsp_display_start_with_config(const bsp_display_cfg_t *cfg);
-
-/**
- * @brief Get pointer to input device (touch, buttons, ...)
- *
- * @note The LVGL input device is initialized in bsp_display_start() function.
- *
- * @return Pointer to LVGL input device or NULL when not initialized
- */
-lv_indev_t *bsp_display_get_input_dev(void);
-
-/**
- * @brief Take LVGL mutex
- *
- * @param timeout_ms Timeout in [ms]. 0 will block indefinitely.
- * @return true Mutex was taken
- * @return false Mutex was NOT taken
- */
-bool bsp_display_lock(uint32_t timeout_ms);
-
-/**
- * @brief Give LVGL mutex
- *
- */
-void bsp_display_unlock(void);
-
-/**
- * @brief Set display enter sleep mode
- *
- * All the display (LCD, backlight, touch) will enter sleep mode.
- *
- * @return
- * - ESP_OK on success
- * - ESP_ERR_NOT_SUPPORTED if this function is not supported by the panel
- */
-esp_err_t bsp_display_enter_sleep(void);
-
-/**
- * @brief Set display exit sleep mode
- *
- * All the display (LCD, backlight, touch) will exit sleep mode.
- *
- * @return
- * - ESP_OK on success
- * - ESP_ERR_NOT_SUPPORTED if this function is not supported by the panel
- */
-esp_err_t bsp_display_exit_sleep(void);
-
-/**
- * @brief Rotate screen
- *
- * Display must be already initialized by calling bsp_display_start()
- *
- * @param[in] disp Pointer to LVGL display
- * @param[in] rotation Angle of the display rotation
- */
-void bsp_display_rotate(lv_display_t *disp, lv_disp_rotation_t rotation);
-#endif // BSP_CONFIG_NO_GRAPHIC_LIB == 0
-
-/** @} */ // end of display
-
/** \addtogroup g12_camera
* @{
*/
diff --git a/bsp/m5stack_tab5/src/bsp_display.c b/bsp/m5stack_tab5/src/bsp_display.c
index 6790e15b9..0a31fff4f 100644
--- a/bsp/m5stack_tab5/src/bsp_display.c
+++ b/bsp/m5stack_tab5/src/bsp_display.c
@@ -28,14 +28,9 @@
static const char *TAG = "M5Stack Tab5";
-
-#if (BSP_CONFIG_NO_GRAPHIC_LIB == 0)
-static lv_display_t *disp;
-static lv_indev_t *disp_indev_touch = NULL;
-#endif // (BSP_CONFIG_NO_GRAPHIC_LIB == 0)
static bsp_lcd_handles_t disp_handles;
+static esp_lcd_touch_handle_t tp;
static esp_ldo_channel_handle_t disp_phy_pwr_chan = NULL;
-static esp_lcd_touch_handle_t tp; // LCD touch handle
// Bit number used to represent command and parameter
#define LCD_CMD_BITS 8
@@ -323,69 +318,6 @@ void bsp_display_delete(void)
bsp_display_brightness_deinit();
}
-#if (BSP_CONFIG_NO_GRAPHIC_LIB == 0)
-static lv_display_t *bsp_display_lcd_init(const bsp_display_cfg_t *cfg)
-{
- assert(cfg != NULL);
- esp_lcd_panel_io_handle_t io_handle = NULL;
- const bsp_display_config_t bsp_disp_cfg = {
- .dsi_bus = {
- .phy_clk_src = 0, // let the driver to choose the default clock source
- .lane_bit_rate_mbps = BSP_LCD_MIPI_DSI_LANE_BITRATE_MBPS,
- }
- };
- BSP_ERROR_CHECK_RETURN_NULL(bsp_display_new(&bsp_disp_cfg, &disp_handles.panel, &io_handle));
-
- esp_lcd_panel_disp_on_off(disp_handles.panel, true);
-
- /* Add LCD screen */
- ESP_LOGD(TAG, "Add LCD screen");
- const lvgl_port_display_cfg_t disp_cfg = {
- .io_handle = io_handle,
- .panel_handle = disp_handles.panel,
- .buffer_size = cfg->buffer_size,
- .double_buffer = cfg->double_buffer,
- .hres = BSP_LCD_H_RES,
- .vres = BSP_LCD_V_RES,
- .monochrome = false,
- /* Rotation values must be same as used in esp_lcd for initial settings of the screen */
- .rotation = {
- .swap_xy = false,
- .mirror_x = false,
- .mirror_y = false,
- },
- .flags = {
- .buff_dma = cfg->flags.buff_dma,
- .buff_spiram = cfg->flags.buff_spiram,
-#if LVGL_VERSION_MAJOR >= 9
- .swap_bytes = (BSP_LCD_BIGENDIAN ? true : false),
-#endif
-#if CONFIG_BSP_DISPLAY_LVGL_AVOID_TEAR
- .sw_rotate = false, /* Avoid tearing is not supported for SW rotation */
-#else
- .sw_rotate = cfg->flags.sw_rotate,
-#endif
-#if CONFIG_BSP_DISPLAY_LVGL_FULL_REFRESH
- .full_refresh = true,
-#elif CONFIG_BSP_DISPLAY_LVGL_DIRECT_MODE
- .direct_mode = true,
-#endif
- }
- };
- const lvgl_port_display_dsi_cfg_t dpi_cfg = {
- .flags = {
-#if CONFIG_BSP_DISPLAY_LVGL_AVOID_TEAR
- .avoid_tearing = true,
-#else
- .avoid_tearing = false,
-#endif
- }
- };
-
- return lvgl_port_add_disp_dsi(&disp_cfg, &dpi_cfg);
-}
-#endif // (BSP_CONFIG_NO_GRAPHIC_LIB == 0)
-
esp_err_t bsp_touch_new(const bsp_touch_config_t *config, esp_lcd_touch_handle_t *ret_touch)
{
/* Initilize I2C */
@@ -442,22 +374,9 @@ esp_err_t bsp_touch_new(const bsp_touch_config_t *config, esp_lcd_touch_handle_t
TAG, "New touch driver initialization failed");
}
- return ESP_OK;
-}
-
-#if (BSP_CONFIG_NO_GRAPHIC_LIB == 0)
-static lv_indev_t *bsp_display_indev_touch_init(lv_display_t *disp)
-{
- BSP_ERROR_CHECK_RETURN_NULL(bsp_touch_new(NULL, &tp));
- assert(tp);
-
- /* Add touch input (for selected screen) */
- const lvgl_port_touch_cfg_t touch_cfg = {
- .disp = disp,
- .handle = tp,
- };
+ tp = *ret_touch;
- return lvgl_port_add_touch(&touch_cfg);
+ return ESP_OK;
}
static esp_err_t bsp_touch_enter_sleep(void)
@@ -471,57 +390,6 @@ static esp_err_t bsp_touch_exit_sleep(void)
assert(tp);
return esp_lcd_touch_exit_sleep(tp);
}
-#endif // (BSP_CONFIG_NO_GRAPHIC_LIB == 0)
-
-#if (BSP_CONFIG_NO_GRAPHIC_LIB == 0)
-lv_display_t *bsp_display_start(void)
-{
- bsp_display_cfg_t cfg = {
- .lvgl_port_cfg = ESP_LVGL_PORT_INIT_CONFIG(),
- .buffer_size = BSP_LCD_H_RES * CONFIG_BSP_LCD_DRAW_BUF_HEIGHT,
-#if CONFIG_BSP_LCD_DRAW_BUF_DOUBLE
- .double_buffer = 1,
-#else
- .double_buffer = 0,
-#endif
- .flags = {
- .buff_dma = true,
- .buff_spiram = false,
- .sw_rotate = true,
- }
- };
- return bsp_display_start_with_config(&cfg);
-}
-
-lv_display_t *bsp_display_start_with_config(const bsp_display_cfg_t *cfg)
-{
- assert(cfg != NULL);
- BSP_ERROR_CHECK_RETURN_NULL(lvgl_port_init(&cfg->lvgl_port_cfg));
- BSP_NULL_CHECK(disp = bsp_display_lcd_init(cfg), NULL);
- BSP_NULL_CHECK(disp_indev_touch = bsp_display_indev_touch_init(disp), NULL);
-
- return disp;
-}
-
-lv_indev_t *bsp_display_get_input_dev(void)
-{
- return disp_indev_touch;
-}
-
-void bsp_display_rotate(lv_display_t *disp, lv_disp_rotation_t rotation)
-{
- lv_disp_set_rotation(disp, rotation);
-}
-
-bool bsp_display_lock(uint32_t timeout_ms)
-{
- return lvgl_port_lock(timeout_ms);
-}
-
-void bsp_display_unlock(void)
-{
- lvgl_port_unlock();
-}
static esp_err_t bsp_lcd_enter_sleep(void)
{
@@ -550,4 +418,3 @@ esp_err_t bsp_display_exit_sleep(void)
BSP_ERROR_CHECK_RETURN_ERR(bsp_touch_exit_sleep());
return ESP_OK;
}
-#endif // (BSP_CONFIG_NO_GRAPHIC_LIB == 0)
diff --git a/components/bsp_graphics/README.md b/components/bsp_graphics/README.md
new file mode 100644
index 000000000..a65e56173
--- /dev/null
+++ b/components/bsp_graphics/README.md
@@ -0,0 +1,3 @@
+# BSP Graphics
+
+This folder contains graphics components (LVGL, ...). All these components can be found in [IDF Component Registry](https://components.espressif.com/).
diff --git a/components/bsp_graphics/bsp_graphics_lvgl/CMakeLists.txt b/components/bsp_graphics/bsp_graphics_lvgl/CMakeLists.txt
new file mode 100644
index 000000000..07668fa24
--- /dev/null
+++ b/components/bsp_graphics/bsp_graphics_lvgl/CMakeLists.txt
@@ -0,0 +1,10 @@
+idf_component_register(
+ SRCS "src/bsp_graphics_lvgl.c"
+ INCLUDE_DIRS "include"
+ PRIV_INCLUDE_DIRS "priv_include"
+)
+
+# Add BSP from project YML
+target_link_libraries(${COMPONENT_LIB} PUBLIC esp_bsp::core)
+target_compile_definitions(${COMPONENT_LIB} PUBLIC BSP_GRAPHICS)
+target_compile_definitions(${COMPONENT_LIB} PUBLIC BSP_GRAPHICS_LVGL)
diff --git a/components/bsp_graphics/bsp_graphics_lvgl/README.md b/components/bsp_graphics/bsp_graphics_lvgl/README.md
new file mode 100644
index 000000000..86e7f3618
--- /dev/null
+++ b/components/bsp_graphics/bsp_graphics_lvgl/README.md
@@ -0,0 +1,124 @@
+# BSP Graphics LVGL
+
+This component provides an LVGL-based graphics layer for ESP-BSP. It is intentionally separated from the BSP to keep the base BSP lightweight and free of any graphical library dependencies.
+
+If you want to use LVGL with a BSP, add this component alongside the BSP.
+
+## Overview
+
+The component integrates LVGL with the BSP display and input drivers and is built on top of esp_lvgl_port.
+
+It handles:
+- LVGL initialization and port configuration
+- Display buffer allocation and management
+- Input device registration (touch, buttons, etc.)
+- LVGL task handling
+
+The BSP itself only provides low-level display and touch initialization. This component builds on top of it and exposes a ready-to-use LVGL environment.
+
+## Usage
+
+There are two main ways to use this component:
+
+### 1. Using BSP Selector
+
+You can use the BSP selector tool to choose:
+
+- your target BSP
+- a graphical library (LVGL)
+
+The required components (BSP + LVGL graphics layer) will be added automatically.
+
+```yaml
+dependencies:
+ espressif/bsp_selector:
+ version: "*"
+```
+
+### 2. Manual dependency (idf_component.yml)
+
+Add both the BSP and this component to your project:
+
+```yaml
+dependencies:
+ espressif/:
+ version: "*"
+ espressif/bsp_graphics_lvgl:
+ version: "*"
+```
+
+### Basic example
+
+```c
+lv_display_t *disp = bsp_display_start();
+
+bsp_display_lock(portMAX_DELAY);
+
+/* Create simple UI */
+lv_obj_t *label = lv_label_create(lv_screen_active());
+lv_label_set_text(label, "Hello LVGL");
+lv_obj_center(label);
+
+bsp_display_unlock();
+```
+
+## Thread Safety
+
+LVGL is not thread-safe. All calls to LVGL APIs (lv_...) must be protected by a mutex:
+
+```c
+bsp_display_lock(portMAX_DELAY);
+
+/* LVGL calls ... */
+
+bsp_display_unlock();
+```
+
+Failure to lock the display before calling LVGL APIs may lead to race conditions or crashes.
+
+## Initialization
+
+To start the display with default settings:
+
+```c
+lv_display_t *disp = bsp_display_start();
+```
+
+For custom configuration:
+```c
+bsp_display_cfg_t cfg = {
+ .buffer_size = ...,
+ .double_buffer = true,
+ .flags = {
+ .buff_dma = 1,
+ .buff_spiram = 1,
+ },
+};
+
+lv_display_t *disp = bsp_display_start_with_config(&cfg);
+```
+
+This initializes:
+- display bus (SPI, RGB, MIPI, etc.)
+- display controller
+- LVGL core and internal task
+
+Note: The LCD backlight is not enabled automatically. Use BSP function `bsp_display_brightness_set()` if available.
+
+## Input Devices
+
+The input device (e.g. touch) is automatically initialized during display startup:
+
+```c
+lv_indev_t *indev = bsp_display_get_input_dev();
+```
+
+Returns NULL if the display has not been initialized.
+
+## Display Control
+
+Rotation:
+
+```c
+bsp_display_rotate(disp, LV_DISP_ROT_90);
+```
diff --git a/components/bsp_graphics/bsp_graphics_lvgl/idf_component.yml b/components/bsp_graphics/bsp_graphics_lvgl/idf_component.yml
new file mode 100644
index 000000000..7ea4d1138
--- /dev/null
+++ b/components/bsp_graphics/bsp_graphics_lvgl/idf_component.yml
@@ -0,0 +1,14 @@
+version: "1.0.0"
+description: BSP Graphics LVGL
+url: https://github.com/espressif/esp-bsp/tree/master/components/bsp_graphics_lvgl
+
+tags:
+ - bsp
+
+dependencies:
+ idf : ">=5.3"
+
+ espressif/esp_lvgl_port:
+ version: "^2"
+ public: true
+ override_path: "../../../components/esp_lvgl_port"
diff --git a/components/bsp_graphics/bsp_graphics_lvgl/include/esp_bsp_graphics.h b/components/bsp_graphics/bsp_graphics_lvgl/include/esp_bsp_graphics.h
new file mode 100644
index 000000000..1dc25a7e4
--- /dev/null
+++ b/components/bsp_graphics/bsp_graphics_lvgl/include/esp_bsp_graphics.h
@@ -0,0 +1,96 @@
+/*
+ * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/**
+ * @file
+ * @brief ESP BSP Graphics LVGL layer
+ */
+
+#pragma once
+#include "lvgl.h"
+#include "esp_lvgl_port.h"
+
+/**************************************************************************************************
+ *
+ * Graphic interface (LVGL)
+ *
+ * LVGL is used as graphics library. LVGL is NOT thread safe, therefore the user must take LVGL mutex
+ * by calling bsp_display_lock() before calling any LVGL API (lv_...) and then give the mutex with
+ * bsp_display_unlock().
+ *
+ **************************************************************************************************/
+
+/**
+ * @brief BSP LVGL graphic configuration structure
+ */
+typedef struct {
+ lvgl_port_cfg_t lvgl_port_cfg; /*!< LVGL port configuration */
+ uint32_t buffer_size; /*!< Size of the buffer for the screen in pixels */
+ bool double_buffer; /*!< True, if should be allocated two buffers */
+ struct {
+ unsigned int buff_dma: 1; /*!< Allocated LVGL buffer will be DMA capable */
+ unsigned int buff_spiram: 1; /*!< Allocated LVGL buffer will be in PSRAM */
+ unsigned int sw_rotate: 1; /*!< Use software rotation (slower), The feature is unavailable under avoid-tear mode */
+ } flags;
+} bsp_display_cfg_t;
+
+/**
+ * @brief Initialize display
+ *
+ * This function initializes SPI, display controller and starts LVGL handling task.
+ * LCD backlight must be enabled separately by calling bsp_display_brightness_set()
+ *
+ * @return Pointer to LVGL display or NULL when error occurred
+ */
+lv_display_t *bsp_display_start(void);
+
+/**
+ * @brief Initialize display
+ *
+ * This function initializes SPI, display controller and starts LVGL handling task.
+ * LCD backlight must be enabled separately by calling bsp_display_brightness_set()
+ *
+ * @param cfg display configuration
+ *
+ * @return Pointer to LVGL display or NULL when error occurred
+ */
+lv_display_t *bsp_display_start_with_config(const bsp_display_cfg_t *cfg);
+
+/**
+ * @brief Get pointer to input device (touch, buttons, ...)
+ *
+ * @note The LVGL input device is initialized in bsp_display_start() function.
+ *
+ * @return Pointer to LVGL input device or NULL when not initialized
+ */
+lv_indev_t *bsp_display_get_input_dev(void);
+
+/**
+ * @brief Take LVGL mutex
+ *
+ * @param timeout_ms Timeout in [ms]. 0 will block indefinitely.
+ * @return true Mutex was taken
+ * @return false Mutex was NOT taken
+ */
+bool bsp_display_lock(uint32_t timeout_ms);
+
+/**
+ * @brief Give LVGL mutex
+ *
+ */
+void bsp_display_unlock(void);
+
+/**
+ * @brief Rotate screen
+ *
+ * Display must be already initialized by calling bsp_display_start()
+ *
+ * @param[in] disp Pointer to LVGL display
+ * @param[in] rotation Angle of the display rotation
+ */
+void bsp_display_rotate(lv_display_t *disp, lv_disp_rotation_t rotation);
+
+/** @} */ // end of display
diff --git a/components/bsp_graphics/bsp_graphics_lvgl/license.txt b/components/bsp_graphics/bsp_graphics_lvgl/license.txt
new file mode 100644
index 000000000..d64569567
--- /dev/null
+++ b/components/bsp_graphics/bsp_graphics_lvgl/license.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/components/bsp_graphics/bsp_graphics_lvgl/priv_include/bsp_err_check.h b/components/bsp_graphics/bsp_graphics_lvgl/priv_include/bsp_err_check.h
new file mode 100644
index 000000000..5e977a5f5
--- /dev/null
+++ b/components/bsp_graphics/bsp_graphics_lvgl/priv_include/bsp_err_check.h
@@ -0,0 +1,58 @@
+/*
+ * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#pragma once
+
+#include "esp_check.h"
+#include "sdkconfig.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Assert on error, if selected in menuconfig. Otherwise return error code. */
+#if CONFIG_BSP_ERROR_CHECK
+#define BSP_ERROR_CHECK_RETURN_ERR(x) ESP_ERROR_CHECK(x)
+#define BSP_ERROR_CHECK_RETURN_NULL(x) ESP_ERROR_CHECK(x)
+#define BSP_ERROR_CHECK(x, ret) ESP_ERROR_CHECK(x)
+#define BSP_NULL_CHECK(x, ret) assert(x)
+#define BSP_NULL_CHECK_GOTO(x, goto_tag) assert(x)
+#else
+#define BSP_ERROR_CHECK_RETURN_ERR(x) do { \
+ esp_err_t err_rc_ = (x); \
+ if (unlikely(err_rc_ != ESP_OK)) { \
+ return err_rc_; \
+ } \
+ } while(0)
+
+#define BSP_ERROR_CHECK_RETURN_NULL(x) do { \
+ if (unlikely((x) != ESP_OK)) { \
+ return NULL; \
+ } \
+ } while(0)
+
+#define BSP_NULL_CHECK(x, ret) do { \
+ if ((x) == NULL) { \
+ return ret; \
+ } \
+ } while(0)
+
+#define BSP_ERROR_CHECK(x, ret) do { \
+ if (unlikely((x) != ESP_OK)) { \
+ return ret; \
+ } \
+ } while(0)
+
+#define BSP_NULL_CHECK_GOTO(x, goto_tag) do { \
+ if ((x) == NULL) { \
+ goto goto_tag; \
+ } \
+ } while(0)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/components/bsp_graphics/bsp_graphics_lvgl/src/bsp_graphics_lvgl.c b/components/bsp_graphics/bsp_graphics_lvgl/src/bsp_graphics_lvgl.c
new file mode 100644
index 000000000..d91f91be3
--- /dev/null
+++ b/components/bsp_graphics/bsp_graphics_lvgl/src/bsp_graphics_lvgl.c
@@ -0,0 +1,159 @@
+/*
+ * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+
+/*******************************************************************************
+* Includes
+*******************************************************************************/
+#include "esp_err.h"
+#include "esp_log.h"
+#include "esp_check.h"
+#include "bsp_err_check.h"
+#include "esp_lcd_panel_io.h"
+#include "bsp/display.h"
+#include "bsp/touch.h"
+#include "bsp/esp-bsp.h"
+#include "esp_bsp_graphics.h"
+
+/*******************************************************************************
+* Local variables
+*******************************************************************************/
+static const char *TAG = "BSP Graphics";
+static lv_display_t *disp;
+static lv_indev_t *disp_indev_touch = NULL;
+
+/*******************************************************************************
+* Private functions
+*******************************************************************************/
+static lv_display_t *bsp_display_lcd_init(const bsp_display_cfg_t *cfg)
+{
+ bsp_lcd_handles_t disp_handles;
+ assert(cfg != NULL);
+ esp_lcd_panel_io_handle_t io_handle = NULL;
+ const bsp_display_config_t bsp_disp_cfg = {
+ .dsi_bus = {
+ .phy_clk_src = 0, // let the driver to choose the default clock source
+ .lane_bit_rate_mbps = BSP_LCD_MIPI_DSI_LANE_BITRATE_MBPS,
+ }
+ };
+ BSP_ERROR_CHECK_RETURN_NULL(bsp_display_new(&bsp_disp_cfg, &disp_handles.panel, &io_handle));
+
+ esp_lcd_panel_disp_on_off(disp_handles.panel, true);
+
+ /* Add LCD screen */
+ ESP_LOGD(TAG, "Add LCD screen");
+ const lvgl_port_display_cfg_t disp_cfg = {
+ .io_handle = io_handle,
+ .panel_handle = disp_handles.panel,
+ .buffer_size = cfg->buffer_size,
+ .double_buffer = cfg->double_buffer,
+ .hres = BSP_LCD_H_RES,
+ .vres = BSP_LCD_V_RES,
+ .monochrome = false,
+ /* Rotation values must be same as used in esp_lcd for initial settings of the screen */
+ .rotation = {
+ .swap_xy = false,
+ .mirror_x = false,
+ .mirror_y = false,
+ },
+ .flags = {
+ .buff_dma = cfg->flags.buff_dma,
+ .buff_spiram = cfg->flags.buff_spiram,
+#if LVGL_VERSION_MAJOR >= 9
+ .swap_bytes = (BSP_LCD_BIGENDIAN ? true : false),
+#endif
+#if CONFIG_BSP_DISPLAY_LVGL_AVOID_TEAR
+ .sw_rotate = false, /* Avoid tearing is not supported for SW rotation */
+#else
+ .sw_rotate = cfg->flags.sw_rotate,
+#endif
+#if CONFIG_BSP_DISPLAY_LVGL_FULL_REFRESH
+ .full_refresh = true,
+#elif CONFIG_BSP_DISPLAY_LVGL_DIRECT_MODE
+ .direct_mode = true,
+#endif
+ }
+ };
+ const lvgl_port_display_dsi_cfg_t dpi_cfg = {
+ .flags = {
+#if CONFIG_BSP_DISPLAY_LVGL_AVOID_TEAR
+ .avoid_tearing = true,
+#else
+ .avoid_tearing = false,
+#endif
+ }
+ };
+
+ return lvgl_port_add_disp_dsi(&disp_cfg, &dpi_cfg);
+}
+
+static lv_indev_t *bsp_display_indev_touch_init(lv_display_t *disp)
+{
+ esp_lcd_touch_handle_t tp;
+ BSP_ERROR_CHECK_RETURN_NULL(bsp_touch_new(NULL, &tp));
+ assert(tp);
+
+ /* Add touch input (for selected screen) */
+ const lvgl_port_touch_cfg_t touch_cfg = {
+ .disp = disp,
+ .handle = tp,
+ };
+
+ return lvgl_port_add_touch(&touch_cfg);
+}
+
+/*******************************************************************************
+* Public API functions
+*******************************************************************************/
+
+lv_display_t *bsp_display_start(void)
+{
+ bsp_display_cfg_t cfg = {
+ .lvgl_port_cfg = ESP_LVGL_PORT_INIT_CONFIG(),
+ .buffer_size = BSP_LCD_H_RES * CONFIG_BSP_LCD_DRAW_BUF_HEIGHT,
+#if CONFIG_BSP_LCD_DRAW_BUF_DOUBLE
+ .double_buffer = 1,
+#else
+ .double_buffer = 0,
+#endif
+ .flags = {
+ .buff_dma = true,
+ .buff_spiram = false,
+ .sw_rotate = true,
+ }
+ };
+ return bsp_display_start_with_config(&cfg);
+}
+
+lv_display_t *bsp_display_start_with_config(const bsp_display_cfg_t *cfg)
+{
+ assert(cfg != NULL);
+ BSP_ERROR_CHECK_RETURN_NULL(lvgl_port_init(&cfg->lvgl_port_cfg));
+ BSP_NULL_CHECK(disp = bsp_display_lcd_init(cfg), NULL);
+ BSP_NULL_CHECK(disp_indev_touch = bsp_display_indev_touch_init(disp), NULL);
+
+ return disp;
+}
+
+lv_indev_t *bsp_display_get_input_dev(void)
+{
+ return disp_indev_touch;
+}
+
+void bsp_display_rotate(lv_display_t *disp, lv_disp_rotation_t rotation)
+{
+ lv_disp_set_rotation(disp, rotation);
+}
+
+bool bsp_display_lock(uint32_t timeout_ms)
+{
+ return lvgl_port_lock(timeout_ms);
+}
+
+void bsp_display_unlock(void)
+{
+ lvgl_port_unlock();
+}
diff --git a/components/bsp_selector/Kconfig b/components/bsp_selector/Kconfig
index bdcbb3b64..512798c0e 100644
--- a/components/bsp_selector/Kconfig
+++ b/components/bsp_selector/Kconfig
@@ -104,14 +104,25 @@ menu "BSP Selector"
config BSP_SELECT_GLIB_SEL
int
- default 1 if BSP_SELECT_GLIB
+ default 0 if BSP_SELECT_GLIB_NONE
+ default 1
+
+ config BSP_SELECT_GLIB_SEL_LVGL
+ int
+ default 1 if BSP_SELECT_GLIB_LVGL
default 0
- config BSP_SELECT_GLIB
- bool "Use GLIB version (with LVGL)"
- default y
- help
- Yes, for use standard BSP. No, for use NoGLIB version of BSP.
+ choice BSP_SELECT_GLIB
+ prompt "Select Graphical Library"
+ default BSP_SELECT_GLIB_LVGL
+
+ config BSP_SELECT_GLIB_NONE
+ bool "NONE (NoGLIB)"
+
+ config BSP_SELECT_GLIB_LVGL
+ bool "LVGL"
+
+ endchoice
choice BSP_SELECT
prompt "Select BSP"
diff --git a/components/bsp_selector/idf_component.yml b/components/bsp_selector/idf_component.yml
index 8970462b1..d802ffaf5 100644
--- a/components/bsp_selector/idf_component.yml
+++ b/components/bsp_selector/idf_component.yml
@@ -8,6 +8,13 @@ tags:
dependencies:
idf : ">=5.3"
+ bsp_graphics_lvgl:
+ version: "*"
+ public: true
+ override_path: "../../components/bsp_graphics/bsp_graphics_lvgl"
+ matches:
+ - if: $CONFIG{BSP_SELECT_GLIB_SEL_LVGL} == 1 && $CONFIG{M5STACK_TAB5} == 1
+
esp_bsp_devkit:
version: "*"
public: true
@@ -211,13 +218,7 @@ dependencies:
public: true
override_path: "../../bsp/m5stack_tab5"
matches:
- - if: $CONFIG{M5STACK_TAB5} == 1 && $CONFIG{BSP_SELECT_GLIB_SEL} == 1
-
- m5stack_tab5_noglib:
- version: "*"
- public: true
- matches:
- - if: $CONFIG{M5STACK_TAB5} == 1 && $CONFIG{BSP_SELECT_GLIB_SEL} != 1
+ - if: $CONFIG{M5STACK_TAB5} == 1
esp_vocat:
version: "*"
diff --git a/examples/bsp_ext.py b/examples/bsp_ext.py
index 1373be084..55ae22d1b 100644
--- a/examples/bsp_ext.py
+++ b/examples/bsp_ext.py
@@ -68,10 +68,21 @@ def set_bsp_callback(action: str, ctx: Context, args: PropertyDict, **kwargs: st
if bsp_short_name(dep) in bsps:
del manifest['dependencies'][dep]
+ # Try to remove BSP Graphics LVGL
+ try:
+ del manifest['dependencies']["bsp_graphics_lvgl"]
+ except KeyError:
+ print("Could not remove bsp_graphics_lvgl")
+
# Add the one we need
manifest['dependencies'].insert(0, bsp, {'version': '*', 'override_path': ('../../../bsp/' + bsp_short_name(bsp))})
yaml.dump(manifest, manifest_path)
+ # Add BSP Graphics LVGL if supported
+ if bsp_short_name(bsp) == "m5stack_tab5":
+ manifest['dependencies'].insert(0, "bsp_graphics_lvgl", {'version': '*', 'override_path': ('../../../components/bsp_graphics/bsp_graphics_lvgl')})
+ yaml.dump(manifest, manifest_path)
+
extensions = {
'global_action_callbacks': [global_callback],
'actions': {
diff --git a/examples/display/main/main.c b/examples/display/main/main.c
index 988be55cb..090eda2a7 100644
--- a/examples/display/main/main.c
+++ b/examples/display/main/main.c
@@ -13,6 +13,9 @@
#include
#include "bsp/esp-bsp.h"
+#ifdef BSP_GRAPHICS
+#include "esp_bsp_graphics.h"
+#endif
#include "lvgl.h"
#include "esp_log.h"
diff --git a/examples/display_audio_photo/main/app_disp_fs.c b/examples/display_audio_photo/main/app_disp_fs.c
index f7af772a8..76d044582 100644
--- a/examples/display_audio_photo/main/app_disp_fs.c
+++ b/examples/display_audio_photo/main/app_disp_fs.c
@@ -23,6 +23,9 @@
#include "lvgl.h"
#include "app_disp_fs.h"
#include "esp_jpeg_dec.h"
+#ifdef BSP_GRAPHICS
+#include "esp_bsp_graphics.h"
+#endif
/* SPIFFS mount root */
#define FS_MNT_PATH BSP_SPIFFS_MOUNT_POINT
diff --git a/examples/display_audio_photo/main/main.c b/examples/display_audio_photo/main/main.c
index 56e207a6f..da25d604e 100644
--- a/examples/display_audio_photo/main/main.c
+++ b/examples/display_audio_photo/main/main.c
@@ -13,6 +13,9 @@
#include "esp_log.h"
#include "bsp/esp-bsp.h"
+#ifdef BSP_GRAPHICS
+#include "esp_bsp_graphics.h"
+#endif
#include "app_disp_fs.h"
static const char *TAG = "example";
diff --git a/examples/display_camera_video/main/main.c b/examples/display_camera_video/main/main.c
index c99f2fc0f..6114bb08c 100644
--- a/examples/display_camera_video/main/main.c
+++ b/examples/display_camera_video/main/main.c
@@ -15,6 +15,9 @@
#include
#include "sdkconfig.h"
#include "bsp/esp-bsp.h"
+#ifdef BSP_GRAPHICS
+#include "esp_bsp_graphics.h"
+#endif
#include "esp_err.h"
#include "esp_log.h"
#include
diff --git a/examples/display_lvgl_benchmark/main/main.c b/examples/display_lvgl_benchmark/main/main.c
index 1e3da69e5..25149f278 100644
--- a/examples/display_lvgl_benchmark/main/main.c
+++ b/examples/display_lvgl_benchmark/main/main.c
@@ -16,6 +16,9 @@
#include "lv_demos.h"
#include "bsp/esp-bsp.h"
+#ifdef BSP_GRAPHICS
+#include "esp_bsp_graphics.h"
+#endif
static char *TAG = "app_main";
diff --git a/examples/display_lvgl_demos/main/main.c b/examples/display_lvgl_demos/main/main.c
index 72aa2405a..420c4de3b 100644
--- a/examples/display_lvgl_demos/main/main.c
+++ b/examples/display_lvgl_demos/main/main.c
@@ -17,6 +17,9 @@
#include "lv_demos.h"
#include "bsp/esp-bsp.h"
+#ifdef BSP_GRAPHICS
+#include "esp_bsp_graphics.h"
+#endif
static char *TAG = "app_main";
diff --git a/examples/display_rotation/main/main.c b/examples/display_rotation/main/main.c
index 955c9cfd5..73831b3c5 100644
--- a/examples/display_rotation/main/main.c
+++ b/examples/display_rotation/main/main.c
@@ -13,6 +13,9 @@
#include "esp_log.h"
#include "bsp/esp-bsp.h"
+#ifdef BSP_GRAPHICS
+#include "esp_bsp_graphics.h"
+#endif
#include "lvgl.h"
#if BSP_CAPS_IMU
#include "icm42670.h"
diff --git a/examples/display_sdcard/main/example_display.c b/examples/display_sdcard/main/example_display.c
index 5404700d7..7d758b40f 100644
--- a/examples/display_sdcard/main/example_display.c
+++ b/examples/display_sdcard/main/example_display.c
@@ -18,6 +18,9 @@
#include "lvgl.h"
#include "example_display.h"
+#ifdef BSP_GRAPHICS
+#include "esp_bsp_graphics.h"
+#endif
typedef enum : uint32_t {NOTIFY_FORMAT, } notif_task_t;
diff --git a/examples/display_sdcard/main/main.c b/examples/display_sdcard/main/main.c
index 5a5cee81c..81a1283f8 100644
--- a/examples/display_sdcard/main/main.c
+++ b/examples/display_sdcard/main/main.c
@@ -26,6 +26,9 @@
// Functionality which is only supported with display is hidden under BSP_CAPS_DISPLAY
#if(BSP_CAPS_DISPLAY)
#include "example_display.h"
+#ifdef BSP_GRAPHICS
+#include "esp_bsp_graphics.h"
+#endif
#endif
#define EXAMPLE_READ_BUF_SIZE 64
diff --git a/examples/display_sensors/main/main.c b/examples/display_sensors/main/main.c
index 845c06601..ec0317d74 100644
--- a/examples/display_sensors/main/main.c
+++ b/examples/display_sensors/main/main.c
@@ -14,6 +14,9 @@
#include
#include "bsp/esp-bsp.h"
#include "esp_log.h"
+#ifdef BSP_GRAPHICS
+#include "esp_bsp_graphics.h"
+#endif
#define IMU_SAMPLING_PERIOD 300
#define HUMITURE_SAMPLING_PERIOD 500
diff --git a/examples/display_usb_hid/main/main.c b/examples/display_usb_hid/main/main.c
index 8c3f60113..100fb841b 100644
--- a/examples/display_usb_hid/main/main.c
+++ b/examples/display_usb_hid/main/main.c
@@ -14,6 +14,9 @@
#include "bsp/esp-bsp.h"
#include "lvgl.h"
#include "esp_lvgl_port.h"
+#ifdef BSP_GRAPHICS
+#include "esp_bsp_graphics.h"
+#endif
static const char *TAG = "example";