Files
2026-09-22 09:38:26 +08:00
..
2026-09-22 09:38:26 +08:00
2026-09-22 09:38:26 +08:00
2026-09-22 09:38:26 +08:00
2026-09-22 09:38:26 +08:00
2026-09-22 09:38:26 +08:00
2026-09-22 09:38:26 +08:00
2026-09-22 09:38:26 +08:00
2026-09-22 09:38:26 +08:00

Sample for Using Lvinit Library

Here is a sample which uses lvinit.so to init the lvgl and create ui.

Description

main.c

  • init lvgl
  • create ui
  • periodically handle the tasks
  • exit lvgl and stop task handler if ui has been closed
  • If TEST set to 1, will invoke BtnClickMock() which defined in btn_click.c.

ui_win_switch.c

  • create home_window and sub_window; switch windows by clicking different buttons; home_window has a close button and list button and sub_window has a back button
  • close button clicked, home_window will be deleted and the ui will be closed
  • list button clicked, home_window will be deleted and sub_window will be created
  • back button clicked, sub_window will be deleted and home_window will be created

btn_click.c

If TEST set to 1 in main.c , will create a thread to mock the button click action. The thread will keep switching the windows automatically.

Note: When invoking LVGL functions, we must use mutex to protect LVGL in case of interruption. For example, when using lv_event_send() to send events to button object, we should use mutex to avoid interrupting lv_task_handler in main.c.**