mirror of
https://gitee.com/Vancouver2017/luban-lite.git
synced 2025-12-25 21:48:54 +00:00
v1.0.3
This commit is contained in:
31
packages/artinchip/lvgl-ui/lvgl/docs/porting/tick.md
Normal file
31
packages/artinchip/lvgl-ui/lvgl/docs/porting/tick.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# Tick interface
|
||||
|
||||
LVGL needs a system tick to know elapsed time for animations and other tasks.
|
||||
|
||||
You 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.
|
||||
|
||||
`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.
|
||||
|
||||
With FreeRTOS `lv_tick_inc` can be called in `vApplicationTickHook`.
|
||||
|
||||
On Linux based operating systems (e.g. on Raspberry Pi) `lv_tick_inc` can be called in a thread like below:
|
||||
```c
|
||||
void * tick_thread (void *args)
|
||||
{
|
||||
while(1) {
|
||||
usleep(5*1000); /*Sleep for 5 millisecond*/
|
||||
lv_tick_inc(5); /*Tell LVGL that 5 milliseconds were elapsed*/
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
## API
|
||||
|
||||
```eval_rst
|
||||
|
||||
.. doxygenfile:: lv_hal_tick.h
|
||||
:project: lvgl
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user