Skip to content

Commit

Permalink
Merge pull request #16 from qjh1227/v2
Browse files Browse the repository at this point in the history
docs:updata get-started and integration and intro
  • Loading branch information
YobeZhou authored Oct 10, 2024
2 parents ff034d0 + 123e4f4 commit b1e6005
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
28 changes: 14 additions & 14 deletions docs/porting/project.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ files in the ``src`` folder.
<br>


图形库本身就是 ``lvgl`` 目录。它包含一个几个文件夹,但要使用 ``lvgl`` ,您只需要文件夹中的 ``.c`` and ``.h`` 文件。
图形库本身就是 ``lvgl`` 目录。它包含一个几个文件夹,但要使用 ``lvgl`` ,您只需要 ``src`` 文件夹中的 ``.c`` and ``.h`` 文件。


Automatically add files(自动添加文件)
Expand All @@ -66,7 +66,7 @@ project folder (as Eclipse or VSCode does), you can simply copy the
<br>


如果 IDE 自动将复制到的文件夹中的文件添加到 project 文件夹(就像 Eclipse 或 VSCode 一样),您只需将文件夹原封不动地复制 ``lvgl`` 到您的项目中即可
如果你的 IDE 会自动将复制到的文件夹中的文件添加到 project 文件夹(就像 Eclipse 或 VSCode 一样),您只需将 ``lvgl`` 文件夹原封不动地复制到您的项目中即可


Make and CMake
Expand Down Expand Up @@ -96,7 +96,7 @@ For integration with CMake take a look this section of the
<br>


LVGL 还支持 ``make`` 和 ``CMake`` 构建开箱即用的系统。 要将 LVGL 添加到基于 Makefile 的构建系统中,请将以下行添加到您的 main Makefile:
LVGL 还支持 ``make`` 和 ``CMake`` 构建系统,开箱即用。 要将 LVGL 添加到基于 Makefile 的构建系统中,请将以下行添加到您的 main Makefile:

.. code:: make
Expand Down Expand Up @@ -148,7 +148,7 @@ action required in these cases.
<br>


该 ``lvgl`` 文件夹还包含一个 ``examples`` 和一个 ``demos`` 文件夹。如果您需要手动将源文件添加到您的项目中, 您也可以对这两个文件夹的源文件执行相同的操作。 ``make`` 和 ``CMake`` 并处理示例和演示,因此无需额外在这些情况下需要采取的行动
该 ``lvgl`` 文件夹还包含一个 ``examples`` 和一个 ``demos`` 文件夹。如果您需要手动将源文件添加到您的项目中, 您也可以对这两个文件夹的源文件执行相同的操作。 ``make`` 和 ``CMake`` 会处理示例和演示,所以在这些情况下不需要额外的操作


Configuration file(修改配置文件)
Expand Down Expand Up @@ -218,27 +218,27 @@ For example:
<br>


有一个名为 **lv_conf.h** 的 LVGL 配置头文件。您可以修改此标头以设置库的基本行为、禁用未使用的模块和功能、在编译时调整内存缓冲区的大小等
LVGL 有一个名为 **lv_conf.h** 的配置头文件。你可以修改这个头文件来设置库的基本行为、禁用未使用的模块和功能、在编译时调整缓冲区的大小等等

要获取 ``lv_conf.h``,复制 lvgl 目录旁边的 **lvgl/lv_conf_template.h** 并将其重命名为 lv_conf.h。打开文件并将开头的 ``#if 0`` 更改为 ``#if 1`` 以启用其内容。因此,文件的布局应如下所示:
要获取 ``lv_conf.h``,**lvgl/lv_conf_template.h** 复制到 lvgl 目录旁边,并将其重命名为 lv_conf.h。打开文件并将开头的 ``#if 0`` 更改为 ``#if 1`` 以启用其内容。因此,文件的布局应如下所示:

::

|-lvgl
|-lv_conf.h
|-other files and folders

配置文件中的注释解释了选项的含义。确定至少 :c:macro:`LV_COLOR_DEPTH` 根据显示器的颜色进行设置深度。请注意,明确需要启用示例和演示在 ``lv_conf.h``
配置文件中的注释解释了这些选项的含义。一定要根据你的显示器的颜色深度至少设置 :c:macro:`LV_COLOR_DEPTH` 。请注意,示例和演示需要在 ``lv_conf.h`` 中明确启用

或者, ``lv_conf.h`` 可以复制到另一个地方,但随后你应该将 :c:macro:`LV_CONF_INCLUDE_SIMPLE` 定义添加到编译器中选项(例如 ``-DLV_CONF_INCLUDE_SIMPLE`` 对于GCC编译器),并手动包含路径(例如 ``-I../include/gui`` )。在本例中为 LVGL 将尝试简单地将 ``lv_conf.h`` 包含在 ``#include "lv_conf.h"``
或者, ``lv_conf.h`` 可以复制到另一个地方,但随后你应该将 :c:macro:`LV_CONF_INCLUDE_SIMPLE` 定义添加到编译器中选项(例如对于GCC编译器使用 ``-DLV_CONF_INCLUDE_SIMPLE`` ),并手动包含路径(例如 ``-I../include/gui`` )。在这种情况下, LVGL 将尝试简单地使用 ``#include "lv_conf.h"`` 来包含 ``lv_conf.h``

您甚至可以为 ``lv_conf.h`` 使用不同的名称。自定义路径可以通过 :c:macro:`LV_CONF_PATH` 定义进行设置。例如 ``-DLV_CONF_PATH="/home/joe/my_project/my_custom_conf.h"``。如果设置了这个 :c:macro:`LV_CONF_SKIP` 将被假定为 ``0``
您甚至可以为 ``lv_conf.h`` 使用不同的名称。自定义路径可以通过 :c:macro:`LV_CONF_PATH` 定义进行设置。例如 ``-DLV_CONF_PATH="/home/joe/my_project/my_custom_conf.h"``。如果设置了这个定义,那么 “LV_CONF_SKIP” 被假定为 0

如果 :c:macro:`LV_CONF_SKIP` 已定义,则 LVGL 不会尝试包含 ``lv_conf.h``。相反,您可以使用 build 传递配置定义选项。例如 ``"-DLV_COLOR_DEPTH=32 -DLV_USE_BUTTON=1"``。未设置 options 将获得一个默认值,该值与 ``lv_conf_template.h`` 的内容相同。

LVGL 也可以通过 ``Kconfig`` 和 ``menuconfig`` 使用。您也可以 ``lv_conf.h`` 与 Kconfig 一起使用,但请记住,值从 ``lv_conf.h`` 或 生成设置 (``-D...``) 覆盖值在 Kconfig 中设置。要忽略配置,只需删除 ``lv_conf.h`` 其内容,或定义 :c:macro:`LV_CONF_SKIP`。
LVGL 也可以通过 ``Kconfig`` 和 ``menuconfig`` 使用。您也可以 ``lv_conf.h`` 与 Kconfig 一起使用,但请记住,来自 ``lv_conf.h`` 或 构建设置 (``-D...``) 的值会覆盖在 Kconfig 中设置的值。要忽略来自lv_conf.h配置,只需删除其内容,或定义 :c:macro:`LV_CONF_SKIP`。

要启用多实例功能,需要在 ``lv_conf.h`` 文件中设置 :c:macro:`LV_GLOBAL_CUSTOM` , 并使用 ``__thread`` 或 ``pthread_key_t`` 为 :cpp:func:`lv_global_default` 提供自定义函数。 它将允许通过存储全局变量来运行多个 LVGL 实例 在 TLS(线程本地存储)中
要启用多实例功能,需要在 ``lv_conf.h`` 文件中设置 :c:macro:`LV_GLOBAL_CUSTOM` , 并使用 ``__thread`` 或 ``pthread_key_t`` 为 :cpp:func:`lv_global_default` 提供自定义函数。 这将通过在TLS中存储全局变量来允许运行多个 LVGL 实例。

例如:

Expand Down Expand Up @@ -279,10 +279,10 @@ components. The order of the initialization is:
<br>


要使用图形库,您必须对其进行初始化并进行必要的设置其他组件。初始化的顺序为:
要使用图形库,您必须对其进行初始化并设置所需的组件。初始化的顺序为:

1. 调用 :cpp:func:`lv_init`。
2. 初始化您的驱动程序。
3. 在 LVGL 中注册显示和输入设备驱动程序。详细了解 `显示 </porting/display>`__ 和 `输入设备 </porting/indev>`__ 注册
4. 在中断中每隔 ``x`` 毫秒调用 :cpp:expr:`lv_tick_inc(x)` 以告知经过的时间。 `了解更多 </porting/tick>`__。
3. 在 LVGL 中注册显示和输入设备驱动程序。了解更多关于 `显示 </porting/display>`__ 和 `输入设备 </porting/indev>`__ 注册的信息
4. 在中断中每隔 ``x`` 毫秒调用 :cpp:expr:`lv_tick_inc(x)` 以向LVGL报告经过的时间。 `了解更多 </porting/tick>`__。
5. 每隔几毫秒调用`lv_timer_handler` 来处理LVGL相关的任务。 `了解更多 </porting/timer-handler>`__ 。
2 changes: 1 addition & 1 deletion docs/porting/sleep.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ main ``while(1)`` should look like this:
<br>


当没有用户输入发生时,MCU 可以进入睡眠状态。在这种情况下,主要的 ``while(1)`` 应该是这样的:
当没有用户输入发生时,MCU 可以进入睡眠状态。在这种情况下,主循环 ``while(1)`` 应该是这样的:


.. code:: c
Expand Down
4 changes: 2 additions & 2 deletions docs/porting/tick.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ LVGL 需要一个系统滴答时钟来了解动画和其他任务所用的时间
- Arduino: ``lv_tick_set_cb(millis);``
- FreeRTOS: ``lv_tick_set_cb(xTaskGetTickCount);``
- STM32: ``lv_tick_set_cb(HAL_GetTick);``
- ESP32: ``lv_tick_set_cb(my_tick_get_cb);``, 哪里 ``my_tick_get_cb`` 是包装器 ``esp_timer_get_time() / 1000;``
- ESP32: ``lv_tick_set_cb(my_tick_get_cb);``, 其中 ``my_tick_get_cb`` ``esp_timer_get_time() / 1000 的包装函数;``

2. 定期调用 ``lv_tick_inc(x)`` 其中 ``x`` 是自上次调用以来经过的毫秒数。 ``lv_tick_inc`` 应从高优先级中断调用。

刻度(毫秒)应独立于 MCU 的任何其他活动。

例如,这可行,但 LVGL 的计时将不正确,因为 ``lv_timer_handler`` 未考虑 的执行时间:
例如,这种方法可行,但 LVGL 的计时将不正确,因为 ``lv_timer_handler`` 未考虑 的执行时间:

API
---
4 changes: 2 additions & 2 deletions docs/porting/timer_handler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Example:
<br>


要处理 LVGL 的任务,您需要以下列方式之一定期调用 :cpp:func:`lv_timer_handler`:
要处理 LVGL 的任务,您需要以下列方式之一中定期调用 :cpp:func:`lv_timer_handler`:

- *main()* 函数的 *while(1)*
- 定时器定期中断(比 :cpp:func:`lv_tick_inc` 优先级低)
Expand Down Expand Up @@ -56,7 +56,7 @@ the porting:
<br>


如果要在超级循环中使用 :cpp:func:`lv_timer_handler` ,则需要帮助程序 :cpp:func:`lv_timer_handler_run_in_period` 提供功能以简化移植
如果要在超级循环中使用 :cpp:func:`lv_timer_handler` ,则提供了一个辅助函数 :cpp:func:`lv_timer_handler_run_in_period` 来简化移植过程


.. code:: c
Expand Down

0 comments on commit b1e6005

Please sign in to comment.