feat(multi-instance): collect all the global variables into a struct to allow running multiple instances of LVGL

Closes #4358
This commit is contained in:
Gabor Kiss-Vamosi
2023-08-19 01:42:37 +02:00
parent 1f807ae714
commit 0b83a82a07
145 changed files with 3230 additions and 2707 deletions

View File

@@ -104,6 +104,21 @@ from ``lv_conf.h`` or build settings (``-D...``) overwrite the values
set in Kconfig. To ignore the configs from ``lv_conf.h`` simply remove
its content, or define :c:macro:`LV_CONF_SKIP`.
To enable multi-instance feature, set :c:macro:`LV_GLOBAL_CUSTOM` in
``lv_conf.h`` and provide a custom function to
:cpp:func:`lv_global_default` using ``__thread`` or ``pthread_key_t``.
For example:
.. code:: c
lv_global_t * lv_global_default(void)
{
static __thread lv_global_t lv_global;
return &lv_global;
}
Initialization
--------------

View File

@@ -7,6 +7,16 @@ Tick interface
LVGL needs a system tick to know elapsed time for animations and other
tasks.
If you want to use a custom function to :cpp:func:`lv_tick_get`, you can
register a "tick_get_cb" with :cpp:func:`lv_tick_set_cb`.
For example:
.. code:: c
lv_tick_set_cb(SDL_GetTicks);
You need to call the :cpp:expr:`lv_tick_inc(tick_period)` function periodically
and provide the call period in milliseconds. For example,
:cpp:expr:`lv_tick_inc(1)` when calling every millisecond.