「App:Library:LVGL:docs:Porting:Tick interface」の版間の差分
提供: robot-jp wiki
ナビゲーションに移動検索に移動 (ページの作成:「https://docs.lvgl.io/8.2/porting/tick.html __NOTOC__ {| class="wikitable" !英文 !自動翻訳 |- | | |- | | |- | | |- | | |- | | |- | | |- | | |- | | |} ---- App:…」) |
|||
30行目: | 30行目: | ||
|} | |} | ||
+ | |||
+ | |||
+ | = Tick interface = | ||
+ | LVGL needs a system tick to know elapsed time for animations and other tasks. | ||
+ | |||
+ | You need to call the <code>lv_tick_inc(tick_period)</code> function periodically and provide the call period in milliseconds. For example, <code>lv_tick_inc(1)</code> when calling every millisecond. | ||
+ | |||
+ | <code>lv_tick_inc</code> should be called in a higher priority routine than <code>lv_task_handler()</code> (e.g. in an interrupt) to precisely know the elapsed milliseconds even if the execution of <code>lv_task_handler</code> takes more time. | ||
+ | |||
+ | With FreeRTOS <code>lv_tick_inc</code> can be called in <code>vApplicationTickHook</code>. | ||
+ | |||
+ | On Linux based operating systems (e.g. on Raspberry Pi) <code>lv_tick_inc</code> can be called in a thread like below: | ||
+ | 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 == | ||
+ | Provide access to the system tick with 1 millisecond resolution | ||
+ | |||
+ | Functions | ||
+ | |||
+ | ; <span id="_CPPv311lv_tick_getv"></span><span id="_CPPv211lv_tick_getv"></span><span id="lv_tick_get__void"></span><span id="lv__hal__tick_8h_1a051c47bcfb48282a75834d8dd0a8470c" class="target"></span>uint32_t lv_tick_get(void)[https://docs.lvgl.io/8.2/porting/tick.html#_CPPv411lv_tick_getv] <span id="_CPPv311lv_tick_getv"></span><span id="_CPPv211lv_tick_getv"></span><span id="lv_tick_get__void"></span><span id="lv__hal__tick_8h_1a051c47bcfb48282a75834d8dd0a8470c" class="target"></span> | ||
+ | : Get the elapsed millis[https://docs.lvgl.io/8.2/porting/tick.html#_CPPv411lv_tick_getv]econds since start up | ||
+ | :; Returns | ||
+ | :: the elapsed milliseconds | ||
+ | |||
+ | ; <span id="_CPPv313lv_tick_elaps8uint32_t"></span><span id="_CPPv213lv_tick_elaps8uint32_t"></span><span id="lv_tick_elaps__uint32_t"></span><span id="lv__hal__tick_8h_1a632b8bf9b03d3a809d053508c06dc6d9" class="target"></span>uint32_t lv_tick_elaps(uint32_t prev_tick)[https://docs.lvgl.io/8.2/porting/tick.html#_CPPv413lv_tick_elaps8uint32_t] <span id="_CPPv313lv_tick_elaps8uint32_t"></span><span id="_CPPv213lv_tick_elaps8uint32_t"></span><span id="lv_tick_elaps__uint32_t"></span><span id="lv__hal__tick_8h_1a632b8bf9b03d3a809d053508c06dc6d9" class="target"></span> | ||
+ | : Get the elapsed milliseconds since a p[https://docs.lvgl.io/8.2/porting/tick.html#_CPPv413lv_tick_elaps8uint32_t]revious time stamp | ||
+ | :; Parameters | ||
+ | :: prev_tick -- a previous time stamp (return value of lv_tick_get() ) | ||
+ | :; Returns | ||
+ | :: the elapsed milliseconds since 'prev_tick' | ||
2022年6月22日 (水) 14:11時点における版
https://docs.lvgl.io/8.2/porting/tick.html
英文 | 自動翻訳 |
---|---|
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:
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
Provide access to the system tick with 1 millisecond resolution
Functions
- uint32_t lv_tick_get(void)[1]
- Get the elapsed millis[2]econds since start up
- Returns
- the elapsed milliseconds
- uint32_t lv_tick_elaps(uint32_t prev_tick)[3]
- Get the elapsed milliseconds since a p[4]revious time stamp
- Parameters
- prev_tick -- a previous time stamp (return value of lv_tick_get() )
- Returns
- the elapsed milliseconds since 'prev_tick'