From 71207f32ffef5d6e75a734005a8876ac0a79c8c1 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Tue, 5 Jul 2022 23:23:15 -0400 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0lvgl=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E6=89=8B=E5=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../packages-manual/lvgl-docs/introduction.md | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/rt-thread-version/rt-thread-standard/packages-manual/lvgl-docs/introduction.md b/rt-thread-version/rt-thread-standard/packages-manual/lvgl-docs/introduction.md index bb226f1..1b5d6c6 100644 --- a/rt-thread-version/rt-thread-standard/packages-manual/lvgl-docs/introduction.md +++ b/rt-thread-version/rt-thread-standard/packages-manual/lvgl-docs/introduction.md @@ -14,26 +14,29 @@ RT-Thread 的两款模拟器均适配了 LVGL,你可以不需要开发板也 LVGL 的配置文件有三个: -| 配置文件名称 | 位置 | 功能 | 用户是否需要修改此文件 | -| ------------------- | ------------------------------------------------------------ | ------------------------------------------------ | -------------------------------------------------------- | -| lv_conf_internal.h | [LVGL 侧](https://github.com/lvgl/lvgl/blob/master/src/lv_conf_internal.h) | 将用户未配置的功能设置为默认值 | 不需要 | -| lv_rt_thread_conf.h | [LVGL 侧](https://github.com/lvgl/lvgl/blob/master/env_support/rt-thread/lv_rt_thread_conf.h) | 接管与操作系统相关的配置(例如时基信号、内存等) | 不需要 | -| lv_conf.h | RT-Thread 侧:[参考](https://github.com/RT-Thread/rt-thread/blob/master/bsp/stm32/stm32l475-atk-pandora/applications/lvgl/lv_conf.h) | 用户自定义配置 | 需要用户自行在具体 BSP 的 applications/lvgl 文件夹下创建 | +| 配置文件名称 | 位置 | 功能 | 用户是否需要修改此文件 | +| ------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ------------------------ | ---------------------------------------- | +| lv_conf_internal.h | [LVGL 侧](https://github.com/lvgl/lvgl/blob/master/src/lv_conf_internal.h) | 将用户未配置的功能设置为默认值 | 不需要 | +| lv_rt_thread_conf.h | [LVGL 侧](https://github.com/lvgl/lvgl/blob/master/env_support/rt-thread/lv_rt_thread_conf.h) | 接管与操作系统相关的配置(例如时基信号、内存等) | 不需要 | +| lv_conf.h | RT-Thread 侧:[参考](https://github.com/RT-Thread/rt-thread/blob/master/bsp/stm32/stm32l475-atk-pandora/applications/lvgl/lv_conf.h) | 用户自定义配置 | 需要用户自行在具体 BSP 的 applications/lvgl 文件夹下创建 | 从上表中可以看出,虽然配置文件看起来三个很多,但是实际需要用户干预的只有最后一项,即用户需要在 BSP 的 applications 文件夹中创建一个 lvgl 文件夹,该文件夹就是用来放置 lvgl 相关文件的,内容如下: -| 文件名称 | 作用 | -| ------------------ | ------------------------------------------------------------ | -| lv_conf.h | 用户自定义配置 LVGL 功能(该文件名不可以乱改) | -| lv_port_disp.c/.h | LVGL 显示屏对接文件,内部需要有一个叫 `void lv_port_disp_init(void)` 的函数(该函数必须存在,.h文件必须同名) | -| lv_port_indev.c/.h | LVGL 输入设备对接文件,内部需要有一个叫 `void lv_port_indev_init(void)` 的函数(该函数必须存在,.h文件必须同名) | -| lv_demo.c | 初始化 LVGL 线程,并调用 LVGL 的 demo 函数(改文件可以根据具体需求改成不同的文件名,无特殊要求) | +| 文件名称 | 作用 | +| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| lv_conf.h | 用户自定义配置 LVGL 功能(该文件名不可以乱改) | +| lv_port_disp.c | LVGL 显示屏对接文件,在 `void lv_port_disp_init(void)` 的函数内初始化与LVGL显示框架对接相关内容(该函数必须存在)。[官方手册参考](https://docs.lvgl.io/master/porting/display.html) \| [移植参考](https://github.com/RT-Thread/rt-thread/blob/master/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_disp.c) | +| lv_port_indev.c | LVGL 输入设备对接文件,在 `void lv_port_indev_init(void)` 的函数内初始化与LVGL输入设备框架对接相关内容(该函数必须存在)。[官方手册参考](https://docs.lvgl.io/master/porting/indev.html) \| [移植参考](https://github.com/RT-Thread/rt-thread/blob/master/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_indev.c) | +| 用户界面初始化文件 | 在 `void lv_user_gui_init(void)` 函数内调用你想要初始化的函数(该函数必须存在),LVGL在初始化时会自动调用该函数。[移植参考](https://github.com/RT-Thread/rt-thread/blob/master/bsp/stm32/stm32f469-st-disco/applications/lvgl/demo/lv_demo.c) | 注意:用户无需关心对 LVGL 本身的初始化 (`lv_init`),以及输入输出设备对接函数的初始化(`lv_port_disp_init`、`lv_port_indev_init`),这些初始化的工作已经在 LVGL 侧的 [lv_rt_thread_port.c](https://github.com/lvgl/lvgl/blob/master/env_support/rt-thread/lv_rt_thread_port.c) 文件中自动初始化完成。 +用户无需关心LVGL初始化的问题,LVGL会在设备上电时自动由RT-Thread初始化,同时也会自动调用 `lv_port_disp_init`、`lv_port_indev_init` 和 `lv_user_gui_init`来初始化用户的显示屏、输入设备驱动以及界面绘制函数。 + +> 自 RT-Thread 4.1.1 版本之后(含4.1.1),用户无需再创建 `lv_port_disp.h` 和 `lv_port_indev.h` 文件。 + ## 提问 - 如果遇到移植相关的问题请到 RT-Thread 社区论坛提问:https://club.rt-thread.org/index.html - 如果遇到 LVGL 使用相关的问题请到 LVGL 社区论坛提问(请使用英文):https://forum.lvgl.io/ - -- Gitee