Update to LVGL 9.0.0 (#47)

- Updated LVGL from 8.3 to 9.0 (removed example/docs/demo folders)
- Updated esp_lvgl_port  to current status of the `lvgl9` branch on `esp-bsp`: https://github.com/espressif/esp-bsp/tree/lvgl9
- Updated all boards and drivers
- Removed `libs/lv_drivers` subproject as SDL is now supported by LVGL directly (although keyboard input seems broken)
- Updated `libs/lv_screenshot`
- Fixed the way `tt_statusbar` widget works due to behaviour change in LVGL
- Updated other lvgl code
This commit is contained in:
Ken Van Hoeylandt
2024-02-18 17:40:02 +01:00
committed by GitHub
parent 5fef25fb13
commit 473fb673bd
1630 changed files with 142517 additions and 182264 deletions
+11 -221
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -12,28 +12,15 @@
#pragma once
#include "esp_err.h"
#include "esp_lcd_panel_io.h"
#include "esp_lcd_panel_ops.h"
#include "lvgl.h"
#include "esp_lvgl_port_button.h"
#include "esp_lvgl_port_compatibility.h"
#include "esp_lvgl_port_disp.h"
#include "esp_lvgl_port_knob.h"
#include "esp_lvgl_port_touch.h"
#include "esp_lvgl_port_usbhid.h"
#if __has_include ("esp_lcd_touch.h")
#include "esp_lcd_touch.h"
#define ESP_LVGL_PORT_TOUCH_COMPONENT 1
#endif
#if __has_include ("iot_knob.h")
#include "iot_knob.h"
#include "iot_button.h"
#define ESP_LVGL_PORT_KNOB_COMPONENT 1
#endif
#if __has_include ("iot_button.h")
#include "iot_button.h"
#define ESP_LVGL_PORT_BUTTON_COMPONENT 1
#endif
#if __has_include ("usb/hid_host.h")
#define ESP_LVGL_PORT_USB_HOST_HID_COMPONENT 1
#if LVGL_VERSION_MAJOR == 8
#include "esp_lvgl_port_compatibility.h"
#endif
#ifdef __cplusplus
@@ -51,85 +38,6 @@ typedef struct {
int timer_period_ms; /*!< LVGL timer tick period in ms */
} lvgl_port_cfg_t;
/**
* @brief Rotation configuration
*/
typedef struct {
bool swap_xy; /*!< LCD Screen swapped X and Y (in esp_lcd driver) */
bool mirror_x; /*!< LCD Screen mirrored X (in esp_lcd driver) */
bool mirror_y; /*!< LCD Screen mirrored Y (in esp_lcd driver) */
} lvgl_port_rotation_cfg_t;
/**
* @brief Configuration display structure
*/
typedef struct {
esp_lcd_panel_io_handle_t io_handle; /*!< LCD panel IO handle */
esp_lcd_panel_handle_t panel_handle; /*!< LCD panel handle */
uint32_t buffer_size; /*!< Size of the buffer for the screen in pixels */
bool double_buffer; /*!< True, if should be allocated two buffers */
uint32_t hres; /*!< LCD display horizontal resolution */
uint32_t vres; /*!< LCD display vertical resolution */
bool monochrome; /*!< True, if display is monochrome and using 1bit for 1px */
lvgl_port_rotation_cfg_t rotation; /*!< Default values of the screen rotation */
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 */
} flags;
} lvgl_port_display_cfg_t;
#ifdef ESP_LVGL_PORT_TOUCH_COMPONENT
/**
* @brief Configuration touch structure
*/
typedef struct {
lv_disp_t *disp; /*!< LVGL display handle (returned from lvgl_port_add_disp) */
esp_lcd_touch_handle_t handle; /*!< LCD touch IO handle */
} lvgl_port_touch_cfg_t;
#endif
#ifdef ESP_LVGL_PORT_KNOB_COMPONENT
/**
* @brief Configuration of the encoder structure
*/
typedef struct {
lv_disp_t *disp; /*!< LVGL display handle (returned from lvgl_port_add_disp) */
const knob_config_t *encoder_a_b;
const button_config_t *encoder_enter; /*!< Navigation button for enter */
} lvgl_port_encoder_cfg_t;
#endif
#ifdef ESP_LVGL_PORT_BUTTON_COMPONENT
/**
* @brief Configuration of the navigation buttons structure
*/
typedef struct {
lv_disp_t *disp; /*!< LVGL display handle (returned from lvgl_port_add_disp) */
const button_config_t *button_prev; /*!< Navigation button for previous */
const button_config_t *button_next; /*!< Navigation button for next */
const button_config_t *button_enter; /*!< Navigation button for enter */
} lvgl_port_nav_btns_cfg_t;
#endif
#ifdef ESP_LVGL_PORT_USB_HOST_HID_COMPONENT
/**
* @brief Configuration of the mouse input
*/
typedef struct {
lv_disp_t *disp; /*!< LVGL display handle (returned from lvgl_port_add_disp) */
uint8_t sensitivity; /*!< Mouse sensitivity (cannot be zero) */
lv_obj_t *cursor_img; /*!< Mouse cursor image, if NULL then used default */
} lvgl_port_hid_mouse_cfg_t;
/**
* @brief Configuration of the keyboard input
*/
typedef struct {
lv_disp_t *disp; /*!< LVGL display handle (returned from lvgl_port_add_disp) */
} lvgl_port_hid_keyboard_cfg_t;
#endif
/**
* @brief LVGL port configuration structure
*
@@ -137,7 +45,7 @@ typedef struct {
#define ESP_LVGL_PORT_INIT_CONFIG() \
{ \
.task_priority = 4, \
.task_stack = 4096, \
.task_stack = 6144, \
.task_affinity = -1, \
.task_max_sleep_ms = 500, \
.timer_period_ms = 5, \
@@ -167,124 +75,6 @@ esp_err_t lvgl_port_init(const lvgl_port_cfg_t *cfg);
*/
esp_err_t lvgl_port_deinit(void);
/**
* @brief Add display handling to LVGL
*
* @note Allocated memory in this function is not free in deinit. You must call lvgl_port_remove_disp for free all memory!
*
* @param disp_cfg Display configuration structure
* @return Pointer to LVGL display or NULL when error occured
*/
lv_disp_t *lvgl_port_add_disp(const lvgl_port_display_cfg_t *disp_cfg);
/**
* @brief Remove display handling from LVGL
*
* @note Free all memory used for this display.
*
* @return
* - ESP_OK on success
*/
esp_err_t lvgl_port_remove_disp(lv_disp_t *disp);
#ifdef ESP_LVGL_PORT_TOUCH_COMPONENT
/**
* @brief Add LCD touch as an input device
*
* @note Allocated memory in this function is not free in deinit. You must call lvgl_port_remove_touch for free all memory!
*
* @param touch_cfg Touch configuration structure
* @return Pointer to LVGL touch input device or NULL when error occured
*/
lv_indev_t *lvgl_port_add_touch(const lvgl_port_touch_cfg_t *touch_cfg);
/**
* @brief Remove selected LCD touch from input devices
*
* @note Free all memory used for this display.
*
* @return
* - ESP_OK on success
*/
esp_err_t lvgl_port_remove_touch(lv_indev_t *touch);
#endif
#ifdef ESP_LVGL_PORT_KNOB_COMPONENT
/**
* @brief Add encoder as an input device
*
* @note Allocated memory in this function is not free in deinit. You must call lvgl_port_remove_encoder for free all memory!
*
* @param encoder_cfg Encoder configuration structure
* @return Pointer to LVGL encoder input device or NULL when error occured
*/
lv_indev_t *lvgl_port_add_encoder(const lvgl_port_encoder_cfg_t *encoder_cfg);
/**
* @brief Remove encoder from input devices
*
* @note Free all memory used for this input device.
*
* @return
* - ESP_OK on success
*/
esp_err_t lvgl_port_remove_encoder(lv_indev_t *encoder);
#endif
#ifdef ESP_LVGL_PORT_BUTTON_COMPONENT
/**
* @brief Add buttons as an input device
*
* @note Allocated memory in this function is not free in deinit. You must call lvgl_port_remove_navigation_buttons for free all memory!
*
* @param buttons_cfg Buttons configuration structure
* @return Pointer to LVGL buttons input device or NULL when error occured
*/
lv_indev_t *lvgl_port_add_navigation_buttons(const lvgl_port_nav_btns_cfg_t *buttons_cfg);
/**
* @brief Remove selected buttons from input devices
*
* @note Free all memory used for this input device.
*
* @return
* - ESP_OK on success
*/
esp_err_t lvgl_port_remove_navigation_buttons(lv_indev_t *buttons);
#endif
#ifdef ESP_LVGL_PORT_USB_HOST_HID_COMPONENT
/**
* @brief Add USB HID mouse as an input device
*
* @note The USB host must be initialized before. Use `usb_host_install` for host initialization.
*
* @param mouse_cfg mouse configuration structure
* @return Pointer to LVGL buttons input device or NULL when error occured
*/
lv_indev_t *lvgl_port_add_usb_hid_mouse_input(const lvgl_port_hid_mouse_cfg_t *mouse_cfg);
/**
* @brief Add USB HID keyboard as an input device
*
* @note The USB host must be initialized before. Use `usb_host_install` for host initialization.
*
* @param keyboard_cfg keyboard configuration structure
* @return Pointer to LVGL buttons input device or NULL when error occured
*/
lv_indev_t *lvgl_port_add_usb_hid_keyboard_input(const lvgl_port_hid_keyboard_cfg_t *keyboard_cfg);
/**
* @brief Remove selected USB HID from input devices
*
* @note Free all memory used for this input device. When removed all HID devices, the HID task will be freed.
*
* @return
* - ESP_OK on success
*/
esp_err_t lvgl_port_remove_usb_hid_input(lv_indev_t *hid);
#endif
/**
* @brief Take LVGL mutex
*
@@ -308,7 +98,7 @@ void lvgl_port_unlock(void);
*
* @param disp LVGL display handle (returned from lvgl_port_add_disp)
*/
void lvgl_port_flush_ready(lv_disp_t *disp);
void lvgl_port_flush_ready(lv_display_t *disp);
/**
* @brief Stop lvgl task
@@ -0,0 +1,64 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief ESP LVGL port button
*/
#pragma once
#include "esp_err.h"
#include "lvgl.h"
#if __has_include ("iot_button.h")
#include "iot_button.h"
#define ESP_LVGL_PORT_BUTTON_COMPONENT 1
#endif
#if LVGL_VERSION_MAJOR == 8
#include "esp_lvgl_port_compatibility.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifdef ESP_LVGL_PORT_BUTTON_COMPONENT
/**
* @brief Configuration of the navigation buttons structure
*/
typedef struct {
lv_display_t *disp; /*!< LVGL display handle (returned from lvgl_port_add_disp) */
const button_config_t *button_prev; /*!< Navigation button for previous */
const button_config_t *button_next; /*!< Navigation button for next */
const button_config_t *button_enter; /*!< Navigation button for enter */
} lvgl_port_nav_btns_cfg_t;
/**
* @brief Add buttons as an input device
*
* @note Allocated memory in this function is not free in deinit. You must call lvgl_port_remove_navigation_buttons for free all memory!
*
* @param buttons_cfg Buttons configuration structure
* @return Pointer to LVGL buttons input device or NULL when error occurred
*/
lv_indev_t *lvgl_port_add_navigation_buttons(const lvgl_port_nav_btns_cfg_t *buttons_cfg);
/**
* @brief Remove selected buttons from input devices
*
* @note Free all memory used for this input device.
*
* @return
* - ESP_OK on success
*/
esp_err_t lvgl_port_remove_navigation_buttons(lv_indev_t *buttons);
#endif
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,25 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief ESP LVGL port compatibility
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Backward compatibility with LVGL 8
*/
typedef lv_disp_t lv_display_t;
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,80 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief ESP LVGL port display
*/
#pragma once
#include "esp_err.h"
#include "esp_lcd_panel_io.h"
#include "esp_lcd_panel_ops.h"
#include "lvgl.h"
#if LVGL_VERSION_MAJOR == 8
#include "esp_lvgl_port_compatibility.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Rotation configuration
*/
typedef struct {
bool swap_xy; /*!< LCD Screen swapped X and Y (in esp_lcd driver) */
bool mirror_x; /*!< LCD Screen mirrored X (in esp_lcd driver) */
bool mirror_y; /*!< LCD Screen mirrored Y (in esp_lcd driver) */
} lvgl_port_rotation_cfg_t;
/**
* @brief Configuration display structure
*/
typedef struct {
esp_lcd_panel_io_handle_t io_handle; /*!< LCD panel IO handle */
esp_lcd_panel_handle_t panel_handle; /*!< LCD panel handle */
uint32_t buffer_size; /*!< Size of the buffer for the screen in pixels */
bool double_buffer; /*!< True, if should be allocated two buffers */
uint32_t trans_size; /*!< Allocated buffer will be in SRAM to move framebuf */
uint32_t hres; /*!< LCD display horizontal resolution */
uint32_t vres; /*!< LCD display vertical resolution */
bool monochrome; /*!< True, if display is monochrome and using 1bit for 1px */
lvgl_port_rotation_cfg_t rotation; /*!< Default values of the screen rotation */
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) */
unsigned int swap_bytes: 1; /*!< Swap bytes in RGB656 (16-bit) before send to LCD driver */
} flags;
} lvgl_port_display_cfg_t;
/**
* @brief Add display handling to LVGL
*
* @note Allocated memory in this function is not free in deinit. You must call lvgl_port_remove_disp for free all memory!
*
* @param disp_cfg Display configuration structure
* @return Pointer to LVGL display or NULL when error occurred
*/
lv_display_t *lvgl_port_add_disp(const lvgl_port_display_cfg_t *disp_cfg);
/**
* @brief Remove display handling from LVGL
*
* @note Free all memory used for this display.
*
* @return
* - ESP_OK on success
*/
esp_err_t lvgl_port_remove_disp(lv_display_t *disp);
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,64 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief ESP LVGL port knob
*/
#pragma once
#include "esp_err.h"
#include "lvgl.h"
#if __has_include ("iot_knob.h")
#include "iot_knob.h"
#include "iot_button.h"
#define ESP_LVGL_PORT_KNOB_COMPONENT 1
#endif
#if LVGL_VERSION_MAJOR == 8
#include "esp_lvgl_port_compatibility.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifdef ESP_LVGL_PORT_KNOB_COMPONENT
/**
* @brief Configuration of the encoder structure
*/
typedef struct {
lv_display_t *disp; /*!< LVGL display handle (returned from lvgl_port_add_disp) */
const knob_config_t *encoder_a_b;
const button_config_t *encoder_enter; /*!< Navigation button for enter */
} lvgl_port_encoder_cfg_t;
/**
* @brief Add encoder as an input device
*
* @note Allocated memory in this function is not free in deinit. You must call lvgl_port_remove_encoder for free all memory!
*
* @param encoder_cfg Encoder configuration structure
* @return Pointer to LVGL encoder input device or NULL when error occurred
*/
lv_indev_t *lvgl_port_add_encoder(const lvgl_port_encoder_cfg_t *encoder_cfg);
/**
* @brief Remove encoder from input devices
*
* @note Free all memory used for this input device.
*
* @return
* - ESP_OK on success
*/
esp_err_t lvgl_port_remove_encoder(lv_indev_t *encoder);
#endif
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,62 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief ESP LVGL port touch
*/
#pragma once
#include "esp_err.h"
#include "lvgl.h"
#if __has_include ("esp_lcd_touch.h")
#include "esp_lcd_touch.h"
#define ESP_LVGL_PORT_TOUCH_COMPONENT 1
#endif
#if LVGL_VERSION_MAJOR == 8
#include "esp_lvgl_port_compatibility.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifdef ESP_LVGL_PORT_TOUCH_COMPONENT
/**
* @brief Configuration touch structure
*/
typedef struct {
lv_display_t *disp; /*!< LVGL display handle (returned from lvgl_port_add_disp) */
esp_lcd_touch_handle_t handle; /*!< LCD touch IO handle */
} lvgl_port_touch_cfg_t;
/**
* @brief Add LCD touch as an input device
*
* @note Allocated memory in this function is not free in deinit. You must call lvgl_port_remove_touch for free all memory!
*
* @param touch_cfg Touch configuration structure
* @return Pointer to LVGL touch input device or NULL when error occurred
*/
lv_indev_t *lvgl_port_add_touch(const lvgl_port_touch_cfg_t *touch_cfg);
/**
* @brief Remove selected LCD touch from input devices
*
* @note Free all memory used for this display.
*
* @return
* - ESP_OK on success
*/
esp_err_t lvgl_port_remove_touch(lv_indev_t *touch);
#endif
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,80 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief ESP LVGL port USB HID
*/
#pragma once
#include "esp_err.h"
#include "lvgl.h"
#if __has_include ("usb/hid_host.h")
#define ESP_LVGL_PORT_USB_HOST_HID_COMPONENT 1
#endif
#if LVGL_VERSION_MAJOR == 8
#include "esp_lvgl_port_compatibility.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifdef ESP_LVGL_PORT_USB_HOST_HID_COMPONENT
/**
* @brief Configuration of the mouse input
*/
typedef struct {
lv_display_t *disp; /*!< LVGL display handle (returned from lvgl_port_add_disp) */
uint8_t sensitivity; /*!< Mouse sensitivity (cannot be zero) */
lv_obj_t *cursor_img; /*!< Mouse cursor image, if NULL then used default */
} lvgl_port_hid_mouse_cfg_t;
/**
* @brief Configuration of the keyboard input
*/
typedef struct {
lv_display_t *disp; /*!< LVGL display handle (returned from lvgl_port_add_disp) */
} lvgl_port_hid_keyboard_cfg_t;
/**
* @brief Add USB HID mouse as an input device
*
* @note The USB host must be initialized before. Use `usb_host_install` for host initialization.
*
* @param mouse_cfg mouse configuration structure
* @return Pointer to LVGL buttons input device or NULL when error occurred
*/
lv_indev_t *lvgl_port_add_usb_hid_mouse_input(const lvgl_port_hid_mouse_cfg_t *mouse_cfg);
/**
* @brief Add USB HID keyboard as an input device
*
* @note The USB host must be initialized before. Use `usb_host_install` for host initialization.
*
* @param keyboard_cfg keyboard configuration structure
* @return Pointer to LVGL buttons input device or NULL when error occurred
*/
lv_indev_t *lvgl_port_add_usb_hid_keyboard_input(const lvgl_port_hid_keyboard_cfg_t *keyboard_cfg);
/**
* @brief Remove selected USB HID from input devices
*
* @note Free all memory used for this input device. When removed all HID devices, the HID task will be freed.
*
* @return
* - ESP_OK on success
*/
esp_err_t lvgl_port_remove_usb_hid_input(lv_indev_t *hid);
#endif
#ifdef __cplusplus
}
#endif