「App:Library:LVGL:docs:Porting:Tick interface」の版間の差分
| (同じ利用者による、間の5版が非表示) | |||
| 1行目: | 1行目: | ||
https://docs.lvgl.io/8.2/porting/tick.html | https://docs.lvgl.io/8.2/porting/tick.html | ||
__NOTOC__ | __NOTOC__ | ||
| + | = Tick interface = | ||
{| class="wikitable" | {| class="wikitable" | ||
!英文 | !英文 | ||
| 6行目: | 7行目: | ||
|- | |- | ||
| | | | ||
| − | + | LVGL needs a system tick to know elapsed time for animations and other tasks. | |
| − | |||
| − | |||
| − | |||
| − | = | + | You need to call the <code style="color: #bb0000;">lv_tick_inc(tick_period)</code> function periodically and provide the call period in milliseconds. |
| − | |||
| − | + | For example, <code style="color: #bb0000;">lv_tick_inc(1)</code> when calling every millisecond. | |
<code style="color: #bb0000;">lv_tick_inc</code> should be called in a higher priority routine than <code style="color: #bb0000;">lv_task_handler()</code> (e.g. in an interrupt) to precisely know the elapsed milliseconds even if the execution of <code style="color: #bb0000;">lv_task_handler</code> takes more time. | <code style="color: #bb0000;">lv_tick_inc</code> should be called in a higher priority routine than <code style="color: #bb0000;">lv_task_handler()</code> (e.g. in an interrupt) to precisely know the elapsed milliseconds even if the execution of <code style="color: #bb0000;">lv_task_handler</code> takes more time. | ||
| 22行目: | 19行目: | ||
On Linux based operating systems (e.g. on Raspberry Pi) <code style="color: #bb0000;">lv_tick_inc</code> can be called in a thread like below: | On Linux based operating systems (e.g. on Raspberry Pi) <code style="color: #bb0000;">lv_tick_inc</code> can be called in a thread like below: | ||
| − | <syntaxhighlight lang="C++"> | + | <syntaxhighlight lang="C++" style="border: 1px dashed gray;"> |
void * tick_thread (void *args) | void * tick_thread (void *args) | ||
{ | { | ||
| 31行目: | 28行目: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| + | | | ||
| + | |||
| + | |||
| + | LVGLには、アニメーションやその他のタスクの経過時間を知るためのシステムティックが必要です。 | ||
| + | |||
| + | |||
| + | |||
| + | 関数<code style="color: #bb0000;">lv_tick_inc(tick_period)</code>を定期的に呼び出し、呼び出し期間をミリ秒単位で指定する必要があります。 | ||
| + | |||
| + | たとえば、1ミリ秒ごとに呼び出す場合<code style="color: #bb0000;">lv_tick_inc(1)</code>。 | ||
| + | |||
| + | |||
| + | 経過したミリ秒を正確に知るには、<code style="color: #bb0000;">lv_task_handler</code>の実行に時間がかかる場合でも、<code style="color: #bb0000;">lv_tick_inc</code>は<code style="color: #bb0000;">lv_task_handler()</code>より優先度の高いルーチン(割り込みなど)で呼び出す必要があります。 | ||
| + | |||
| + | |||
| + | FreeRTOSを使用すると、<code style="color: #bb0000;">lv_tick_inc</code>は<code style="color: #bb0000;">vApplicationTickHook</code>で呼び出すことができます。 | ||
| + | |||
| + | Linuxベースのオペレーティングシステム(Raspberry Piなど)では、<code style="color: #bb0000;">lv_tick_inc</code>は次のようなスレッドで呼び出すことができます。 | ||
| + | <syntaxhighlight lang="C++" style="border: 1px dashed gray;"> | ||
| + | void * tick_thread (void * args ) | ||
| + | { | ||
| + | while (1 ) { | ||
| + | usleep (5 * 1000 ); /*5ミリ秒スリープ*/ | ||
| + | lv_tick_inc (5 ); /*5ミリ秒が経過したことをLVGLに通知します*/ | ||
| + | } | ||
| + | } | ||
| + | </syntaxhighlight> | ||
| + | |} | ||
| + | :[[App:Library:LVGL:docs:Porting#Tick interface|戻る : Previous]] | ||
== API == | == API == | ||
| + | {| class="wikitable" | ||
| + | !英文 | ||
| + | !自動翻訳 | ||
| + | |- | ||
| + | | | ||
Provide access to the system tick with 1 millisecond resolution | Provide access to the system tick with 1 millisecond resolution | ||
'''Functions''' | '''Functions''' | ||
| − | ; <span style="background-color: # | + | ; <span style="background-color: #eeeeee;">uint32_t lv_tick_get(void) </span> |
: Get the elapsed milliseconds since start up | : Get the elapsed milliseconds since start up | ||
: '''Returns''' | : '''Returns''' | ||
:: the elapsed milliseconds | :: the elapsed milliseconds | ||
| − | ; <span style="background-color: # | + | ; <span style="background-color: #eeeeee;">uint32_t lv_tick_elaps(uint32_t prev_tick) </span> |
: Get the elapsed milliseconds since a previous time stamp | : Get the elapsed milliseconds since a previous time stamp | ||
: '''Parameters''' | : '''Parameters''' | ||
| 49行目: | 80行目: | ||
: '''Returns''' | : '''Returns''' | ||
:: the elapsed milliseconds since 'prev_tick' | :: the elapsed milliseconds since 'prev_tick' | ||
| + | | | ||
| + | |||
| + | |||
| + | 1ミリ秒の分解能でsystem tickへのアクセスを提供します | ||
| + | '''Functions''' | ||
| + | ; uint32_t lv_tick_get(void) | ||
| + | : 起動してからの経過ミリ秒を取得します | ||
| + | : '''戻り値''' | ||
| + | :: 経過ミリ秒 | ||
| − | - | + | ; uint32_t lv_tick_elaps(uint32_t prev_tick) |
| − | [[App:Library:LVGL:docs:Porting|戻る : Previous]] | + | : 前のタイムスタンプから経過したミリ秒を取得します |
| + | : '''パラメーター''' | ||
| + | :: '''prev_tick-'''以前のタイムスタンプ(lv_tick_get()の戻り値) | ||
| + | : '''戻り値''' | ||
| + | :: 'prev_tick'からの経過ミリ秒 | ||
| + | |} | ||
| + | :[[App:Library:LVGL:docs:Porting#Tick interface|戻る : Previous]] | ||
2022年8月18日 (木) 22:40時点における最新版
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 For example,
On Linux based operating systems (e.g. on Raspberry Pi) 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*/
}
}
|
関数 たとえば、1ミリ秒ごとに呼び出す場合
Linuxベースのオペレーティングシステム(Raspberry Piなど)では、 void * tick_thread (void * args )
{
while (1 ) {
usleep (5 * 1000 ); /*5ミリ秒スリープ*/
lv_tick_inc (5 ); /*5ミリ秒が経過したことをLVGLに通知します*/
}
}
|
API
| 英文 | 自動翻訳 |
|---|---|
|
Provide access to the system tick with 1 millisecond resolution Functions
|
Functions
|