ESP LV Present
esp_lv_present 是 esp_display_present 的 LVGL 9 flush 挂钩。应用持有
esp_lcd 面板和 Presenter;本组件只把 LVGL display 接到这个 Presenter 上。
它不是第二套 display 方案。display 留在 esp_display_present 上,本组件
名字表示 LVGL 这一侧。
依赖
ESP-IDF >= 6.0
仅 LVGL 9.x(不支持 LVGL 8)
应用已创建好的
esp_display_presenter_t
关系
LVGL 9 控件
│
esp_lv_present (本组件,仅 LVGL 9)
│
esp_display_present (缓冲区、TE、旋转、送屏)
│
esp_lcd 面板
和 esp_lvgl_adapter 的区别
esp_lvgl_adapter 是完整 LVGL 适配(v8 和 v9):显示注册、工作任务、锁、
触摸/编码器,以及可选 FS / 解码 / FreeType。界面不走
esp_display_present 时用它。
esp_lv_present 只在已有 Presenter 上安装 LVGL 9 的 flush 路径。调用
start() 的任务必须自己跑 lv_timer_handler()。同一块面板不要同时走两套。
如何搭配 Presenter
初始化面板(例如
hw_init)。创建 Presenter(模式一般用
AUTO)。在即将泵 LVGL 的任务里调用
esp_lv_present_start()。把 Presenter 交给其他生产者之前:先 quiesce,再
esp_lv_present_stop()。Presenter 不会被删除。
dependencies:
espressif/esp_lv_present: "^0.1.0"
#include "esp_lv_present.h"
lv_display_t *display = NULL;
ESP_ERROR_CHECK(esp_lv_present_start(presenter, &display));
更多说明
参见组件 README:
示例:examples/display/gui/lvgl_present_benchmark、
examples/display/gui/gsp_lvgl_present_handoff。
Test app:components/display/tools/esp_lv_present/test_apps。
API 参考
Header File
Functions
-
esp_err_t esp_lv_present_start(esp_display_presenter_t *presenter, lv_display_t **ret_disp)
Create an LVGL display on
presenterand install the flush path.Rebinds the presenter producer to the calling task. Initializes LVGL and an esp_timer tick on the first successful call. Supports PARTITION, DIRECT, and FULL contracts.
- 参数
presenter – [in] Presenter already created by the application.
ret_disp – [out] Created LVGL display handle.
- 返回
ESP_OK: Success
ESP_ERR_INVALID_ARG:
presenterorret_dispis NULLESP_ERR_INVALID_STATE: Binding already started
ESP_ERR_NOT_SUPPORTED: Unsupported contract, pixel format, or buffer layout
ESP_ERR_NO_MEM: Failed to create the LVGL display
-
esp_err_t esp_lv_present_stop(void)
Tear down the LVGL display bound by esp_lv_present_start().
Cancels any in-flight presenter frame first. The presenter itself is not deleted; borrowed draw buffers remain owned by the presenter.
- 返回
ESP_OK: Success
ESP_ERR_INVALID_STATE: Binding is not started
-
uint32_t esp_lv_present_get_frame_count(void)
Return frames committed to the presenter since the last start.
- 返回
Committed frame count, or 0 when the binding is not started.