1# Tick interface
2
3LVGL needs a system tick to know elapsed time for animations and other tasks.
4
5You need to call the `lv_tick_inc(tick_period)` function periodically and provide the call period in milliseconds. For example, `lv_tick_inc(1)` when calling every millisecond.
6
7`lv_tick_inc` should be called in a higher priority routine than `lv_task_handler()` (e.g. in an interrupt) to precisely know the elapsed milliseconds even if the execution of `lv_task_handler` takes more time.
8
9With FreeRTOS `lv_tick_inc` can be called in `vApplicationTickHook`.
10
11On Linux based operating systems (e.g. on Raspberry Pi) `lv_tick_inc` can be called in a thread like below:
12```c
13void * tick_thread (void *args)
14{
15      while(1) {
16        usleep(5*1000);   /*Sleep for 5 millisecond*/
17        lv_tick_inc(5);      /*Tell LVGL that 5 milliseconds were elapsed*/
18    }
19}
20```
21
22
23
24## API
25
26```eval_rst
27
28.. doxygenfile:: lv_hal_tick.h
29  :project: lvgl
30
31```
32