I have some questions about relationship between the 2 function described in the subtitle.
Could you support me?
What LVGL version are you using?
I am using FreeRTOS, and set 1 tick = 5ms
I place lv_tick_inc in vApplicationTickHook, and lv_task_handler in main()
Then I create a lv_task with period = 1s as below code:
lv_task_create(func, 200, LV_TASK_PRIO_MID, NULL);
※In fun(), print a count variable
■ If use lv_tick_inc(1)
func() will be called each about 1s
■ If use lv_tick_inc(5)
func() will be called each about 200ms
Could you explain the meaning of tick_period of lv_tick_inc() ?
How does it affect lv_task_handler?
If I change tick_period of lv_tick_inc(), how can I calculate the period of lv_task?
Is there a risk if I increase tick_period significantly ( such as 5, 10, 100 )?
LVGL has no concept of your system’s time by default. You use lv_tick_inc to inform LVGL that a certain amount of time has elapsed since the previous call to lv_tick_inc.
In your case, FreeRTOS’ tick is set to 5ms, meaning that vApplicationTickHook is called every 5ms. When you call lv_tick_inc(1), you are informing LVGL that 1ms of time has passed since the last call, when really 5ms of time has passed. That’s why func is only called at 1/5 of the desired rate.
lv_tick_inc(5) correctly informs LVGL that 5ms of time has passed.
The period you specified there was 200ms. I think the reason you are seeing the function called every 1s is because you’re calling lv_tick_inc with the wrong value.
If you change the tick period of lv_tick_inc, you should update FreeRTOS’ tick speed to match, and vice versa. I don’t recommend keeping them out of sync.
It is recommended to keep it between about 5-10ms so that LVGL can perform animations accurately. Otherwise, it will still work, but you will notice choppiness due to the very infrequent ticks.