2021-04-12 18:19:04 +02:00
|
|
|
```eval_rst
|
|
|
|
.. include:: /header.rst
|
|
|
|
:github_url: |github_link_base|/porting/task-handler.md
|
|
|
|
```
|
|
|
|
# Task Handler
|
|
|
|
|
2021-06-09 15:10:35 +02:00
|
|
|
To handle the tasks of LVGL you need to call `lv_timer_handler()` periodically in one of the following:
|
2021-04-12 18:19:04 +02:00
|
|
|
- *while(1)* of *main()* function
|
2021-06-09 15:10:35 +02:00
|
|
|
- timer interrupt periodically (lower priority than `lv_tick_inc()`)
|
2021-04-12 18:19:04 +02:00
|
|
|
- an OS task periodically
|
|
|
|
|
|
|
|
The timing is not critical but it should be about 5 milliseconds to keep the system responsive.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
```c
|
|
|
|
while(1) {
|
2021-05-17 16:17:20 +02:00
|
|
|
lv_timer_handler();
|
2021-04-12 18:19:04 +02:00
|
|
|
my_delay_ms(5);
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2021-05-17 16:17:20 +02:00
|
|
|
To learn more about timers visit the [Timer](/overview/timer) section.
|
2021-04-12 18:19:04 +02:00
|
|
|
|