mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-20 21:35:19 +08:00
docs(README): add instructions for new documentation features (#9149)
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This commit is contained in:
+245
-163
File diff suppressed because it is too large
Load Diff
@@ -79,10 +79,10 @@ widgets are marked as "dirty." LVGL recalculates dirty widgets’ positions, siz
|
||||
and layouts just before redrawing the screen.
|
||||
|
||||
So, if you change a widget’s position or size and then immediately read it, call
|
||||
:cpp:func:`lv_obj_update_layout()` first to ensure the values are up to date.
|
||||
:cpp:func:`lv_obj_update_layout` first to ensure the values are up to date.
|
||||
|
||||
Note: Since layout and size may depend on the parent,
|
||||
:cpp:func:`lv_obj_update_layout()` recalculates coordinates for **all** widgets on
|
||||
:cpp:func:`lv_obj_update_layout` recalculates coordinates for **all** widgets on
|
||||
the screen of the given object.
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ Screens are created on the :ref:`Default display <default_display>`. As typicall
|
||||
there is only one displays the screen are created on them automatically.
|
||||
|
||||
The resolution of the screen always matches the resolution of the display. Functions
|
||||
such as :cpp:func:`lv_obj_set_pos()` and :cpp:func:`lv_obj_set_size()` cannot be used
|
||||
such as :cpp:func:`lv_obj_set_pos` and :cpp:func:`lv_obj_set_size` cannot be used
|
||||
on screens.
|
||||
|
||||
The created Screens can be deleted with :cpp:expr:`lv_obj_delete(scr)`, but be sure
|
||||
|
||||
@@ -19,7 +19,7 @@ Usage
|
||||
|
||||
First, enable :c:macro:`LV_USE_MONKEY` in ``lv_conf.h``.
|
||||
|
||||
Next, declare a variable (it can be local) of type :c:type:`lv_monkey_config_t` to
|
||||
Next, declare a variable (it can be local) of type :cpp:type:`lv_monkey_config_t` to
|
||||
define the configuration structure, initialize it using
|
||||
:cpp:expr:`lv_monkey_config_init(cfg)` then set its ``type`` member to the desired
|
||||
type of :ref:`input device <indev>`, and set the ``min`` and ``max`` values for its
|
||||
@@ -60,3 +60,4 @@ Example
|
||||
API
|
||||
***
|
||||
|
||||
.. API equals: lv_monkey_create
|
||||
|
||||
@@ -60,7 +60,7 @@ other things, depending on the implementation.
|
||||
|
||||
This function (whether provided by LVGL or by you --- more on this below) is
|
||||
responsible for doing the clean-up of any resources allocated by
|
||||
:cpp:func:`lv_obj_assign_id()`
|
||||
:cpp:func:`lv_obj_assign_id`
|
||||
|
||||
|
||||
:c:macro:`LV_USE_OBJ_ID_BUILTIN`
|
||||
|
||||
@@ -58,7 +58,7 @@ Basic configuration:
|
||||
Basic initialization:
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
PXP draw initialization is done automatically in :cpp:func:`lv_init()` once the
|
||||
PXP draw initialization is done automatically in :cpp:func:`lv_init` once the
|
||||
PXP is enabled as a draw unit or to rotate the screen, no user code is required:
|
||||
|
||||
.. code-block:: c
|
||||
@@ -192,16 +192,16 @@ PXP default configuration:
|
||||
|
||||
- Implementation depends on multiple OS-specific functions. The struct
|
||||
:cpp:struct:`pxp_cfg_t` with callback pointers is used as a parameter for the
|
||||
:cpp:func:`lv_pxp_init()` function. Default implementation for
|
||||
:cpp:func:`lv_pxp_init` function. Default implementation for
|
||||
FreeRTOS in lv_pxp_osa.c.
|
||||
|
||||
- :cpp:func:`pxp_interrupt_init()`: Initialize PXP interrupt (HW setup,
|
||||
- :cpp:func:`pxp_interrupt_init`: Initialize PXP interrupt (HW setup,
|
||||
OS setup)
|
||||
- :cpp:func:`pxp_interrupt_deinit()`: Deinitialize PXP interrupt (HW setup,
|
||||
- :cpp:func:`pxp_interrupt_deinit`: Deinitialize PXP interrupt (HW setup,
|
||||
OS setup)
|
||||
- :cpp:func:`pxp_run()`: Start PXP job. Use OS-specific mechanism to block
|
||||
- :cpp:func:`pxp_run`: Start PXP job. Use OS-specific mechanism to block
|
||||
drawing thread.
|
||||
- :cpp:func:`pxp_wait()`: Wait for PXP completion.
|
||||
- :cpp:func:`pxp_wait`: Wait for PXP completion.
|
||||
|
||||
|
||||
VGLite accelerator
|
||||
@@ -229,7 +229,7 @@ Basic configuration:
|
||||
Basic initialization:
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Initialize VGLite GPU before calling :cpp:func:`lv_init()` by specifying the
|
||||
Initialize VGLite GPU before calling :cpp:func:`lv_init` by specifying the
|
||||
width/height of tessellation window. The default values for tessellation width
|
||||
and height, and command buffer size are in the SDK file "vglite_support.h".
|
||||
|
||||
@@ -258,7 +258,7 @@ and height, and command buffer size are in the SDK file "vglite_support.h".
|
||||
}
|
||||
#endif
|
||||
|
||||
VGLite draw initialization is done automatically in :cpp:func:`lv_init()` once
|
||||
VGLite draw initialization is done automatically in :cpp:func:`lv_init` once
|
||||
the VGLite is enabled, no user code is required:
|
||||
|
||||
.. code-block:: c
|
||||
@@ -433,7 +433,7 @@ Basic configuration:
|
||||
Basic initialization:
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
G2D draw initialization is done automatically in :cpp:func:`lv_init()` once the
|
||||
G2D draw initialization is done automatically in :cpp:func:`lv_init` once the
|
||||
G2D is enabled as a draw unit , no user code is required:
|
||||
|
||||
.. code:: c
|
||||
|
||||
@@ -110,7 +110,7 @@ Reliability
|
||||
Advancing the tick value should be done in such a way that its timing is reliable and
|
||||
not dependent on anything that consumes an unknown amount of time. For an example of
|
||||
what *not* to do: this can "seem" to work, but LVGL's timing will be incorrect
|
||||
because the execution time of :c:func:`lv_timer_handler` varies from call to call and
|
||||
because the execution time of :cpp:func:`lv_timer_handler` varies from call to call and
|
||||
thus the delay it introduces cannot be known.
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
@@ -66,7 +66,7 @@ See :ref:`timer` section to learn more about timers.
|
||||
When No Timers Are Ready
|
||||
************************
|
||||
|
||||
:c:func:`lv_timer_handler` will return :c:macro:`LV_NO_TIMER_READY` (``UINT32_MAX``)
|
||||
:cpp:func:`lv_timer_handler` will return :c:macro:`LV_NO_TIMER_READY` (``UINT32_MAX``)
|
||||
if there are no running timers. This can happen if there are no indevs or they are disabled with `lv_indev_enable()`, running
|
||||
animations, or running user-created timers. :cpp:func:`lv_timer_handler` will continue
|
||||
to return :c:macro:`LV_NO_TIMER_READY` until there is a running timer. Display
|
||||
@@ -99,7 +99,7 @@ If there is no external event source, you may choose to exit the loop or simply
|
||||
delay for a long time.
|
||||
|
||||
If another :ref:`thread <threading>` is
|
||||
calling LVGL functions, you may want to call :c:func:`lv_timer_handler` again
|
||||
calling LVGL functions, you may want to call :cpp:func:`lv_timer_handler` again
|
||||
very soon to handle the effects of those other threads.
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ Usage
|
||||
When enabled in ``lv_conf.h`` by setting :c:macro:`LV_USE_TINY_TTF` to ``1``,
|
||||
:cpp:expr:`lv_tiny_ttf_create_data(data, data_size, font_size)` can be used to
|
||||
create a TTF font instance with the specified line height. You can then
|
||||
use that font anywhere :c:struct:`lv_font_t` is accepted.
|
||||
use that font anywhere :cpp:struct:`lv_font_t` is accepted.
|
||||
|
||||
By default, the TTF or OTF file must be embedded as an array, either in
|
||||
a header, or loaded into RAM in order to function.
|
||||
|
||||
@@ -30,7 +30,7 @@ Limitations
|
||||
***********
|
||||
|
||||
- Only BMP files are supported. BMP images as C arrays
|
||||
(:c:struct:`lv_image_dsc_t`) are not. This is because there is no practical
|
||||
(:cpp:struct:`lv_image_dsc_t`) are not. This is because there is no practical
|
||||
differences between how the BMP files and LVGL's image format stores
|
||||
the image data.
|
||||
- BMP files can be loaded only from .BMP files. If you want to store them in
|
||||
|
||||
@@ -35,7 +35,7 @@ The supported color formats are:
|
||||
- :cpp:enumerator:`LV_COLOR_FORMAT_ARGB8888`
|
||||
|
||||
:cpp:expr:`lv_gif_set_src(widget, src)` works very similarly to :cpp:func:`lv_image_set_src`.
|
||||
As source, it also accepts images as variables (:c:struct:`lv_image_dsc_t`) or files.
|
||||
As source, it also accepts images as variables (:cpp:struct:`lv_image_dsc_t`) or files.
|
||||
|
||||
|
||||
Converting GIF Files to C Arrays
|
||||
|
||||
@@ -138,7 +138,7 @@ If you don't enable looping, a :cpp:enumerator:`LV_EVENT_READY` is sent when the
|
||||
animation cannot make more progress without looping.
|
||||
|
||||
To get the number of frames in an animation or the current frame index,
|
||||
you can cast the :c:struct:`lv_obj_t` instance to a :c:struct:`lv_rlottie_t` instance
|
||||
you can cast the :cpp:struct:`lv_obj_t` instance to a :cpp:struct:`lv_rlottie_t` instance
|
||||
and inspect the ``current_frame`` and ``total_frames`` members.
|
||||
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ read and it should call ``read_cb`` again.
|
||||
|
||||
If the driver can provide precise timestamps for buffered events, it can
|
||||
overwrite ``data->timestamp``. By default, this is initialized to
|
||||
:cpp:func:`lv_tick_get()` just before invoking ``read_cb``.
|
||||
:cpp:func:`lv_tick_get` just before invoking ``read_cb``.
|
||||
|
||||
.. _indev event mode:
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ they are stored in ROM memory, which is always accessible.
|
||||
.. warning::
|
||||
|
||||
Do not use ``const`` strings with :cpp:func:`lv_label_set_text_static` when the
|
||||
Label is being used in :cpp:enumerator:`LV_LABEL_LONG_DOT` mode since the Label
|
||||
Label is being used in :cpp:enumerator:`LV_LABEL_LONG_MODE_DOTS` mode since the Label
|
||||
will attempt to do an in-place edit of the string. This will cause an MCU
|
||||
exception by attempting to modify program memory (ROM).
|
||||
|
||||
@@ -117,13 +117,13 @@ of the text is greater than the height of the Label.
|
||||
|
||||
You can specify the long mode with :cpp:expr:`lv_label_set_long_mode(label, LV_LABEL_LONG_...)`
|
||||
|
||||
Note that :cpp:enumerator:`LV_LABEL_LONG_DOT` manipulates the text buffer in-place in
|
||||
Note that :cpp:enumerator:`LV_LABEL_LONG_MODE_DOTS` manipulates the text buffer in-place in
|
||||
order to add/remove the dots. When :cpp:func:`lv_label_set_text` or
|
||||
:cpp:func:`lv_label_set_array_text` are used, a separate buffer is allocated and
|
||||
this implementation detail is unnoticed. This is not the case with
|
||||
:cpp:func:`lv_label_set_text_static`. The buffer you pass to
|
||||
:cpp:func:`lv_label_set_text_static` must be writable if you plan to use
|
||||
:cpp:enumerator:`LV_LABEL_LONG_DOT`.
|
||||
:cpp:enumerator:`LV_LABEL_LONG_MODE_DOTS`.
|
||||
|
||||
.. _lv_label_text_recolor:
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ will be placed in the Header in left-to-right order as they are added. These
|
||||
functions can be called in any order, any number of times.
|
||||
|
||||
- :cpp:expr:`lv_win_add_title(win, "The title")` adds a Label to the header, with
|
||||
long mode :c:enumerator:`LV_LABEL_LONG_DOT` so that if its text contents are wider
|
||||
long mode :cpp:enumerator:`LV_LABEL_LONG_MODE_DOTS` so that if its text contents are wider
|
||||
than the area it has, the text will be truncated with an ellipsis ("...") placed
|
||||
at the end of the text. It is set to be FLEX GROW 1, so if it is the only Label
|
||||
in the header, it will occupy all available space after any Buttons are added.
|
||||
|
||||
Reference in New Issue
Block a user