「App:Library:LVGL:docs:Porting:Sleep management」の版間の差分
提供: robot-jp wiki
ナビゲーションに移動検索に移動(同じ利用者による、間の7版が非表示) | |||
1行目: | 1行目: | ||
https://docs.lvgl.io/8.2/porting/sleep.html | https://docs.lvgl.io/8.2/porting/sleep.html | ||
__NOTOC__ | __NOTOC__ | ||
+ | |||
+ | = Sleep management = | ||
{| class="wikitable" | {| class="wikitable" | ||
!英文 | !英文 | ||
6行目: | 8行目: | ||
|- | |- | ||
| | | | ||
− | + | The MCU can go to sleep when no user input happens. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | In this case, the main <code style="color: #bb0000;">while(1)</code>should look like this:<syntaxhighlight lang="C++" style="border: 1px dashed gray;"> | |
− | |||
− | |||
− | |||
− | should look like this: | ||
while(1) { | while(1) { | ||
/*Normal operation (no sleep) in < 1 sec inactivity*/ | /*Normal operation (no sleep) in < 1 sec inactivity*/ | ||
48行目: | 23行目: | ||
my_delay_ms(5); | my_delay_ms(5); | ||
} | } | ||
+ | </syntaxhighlight> | ||
You should also add the following lines to your input device read function to signal a wake-up (press, touch or click etc.) has happened: | You should also add the following lines to your input device read function to signal a wake-up (press, touch or click etc.) has happened: | ||
+ | <syntaxhighlight lang="C++" style="border: 1px dashed gray;"> | ||
lv_tick_inc(LV_DISP_DEF_REFR_PERIOD); /*Force task execution on wake-up*/ | lv_tick_inc(LV_DISP_DEF_REFR_PERIOD); /*Force task execution on wake-up*/ | ||
timer_start(); /*Restart the timer where lv_tick_inc() is called*/ | timer_start(); /*Restart the timer where lv_tick_inc() is called*/ | ||
lv_task_handler(); /*Call `lv_task_handler()` manually to process the wake-up event*/ | lv_task_handler(); /*Call `lv_task_handler()` manually to process the wake-up event*/ | ||
− | In addition to <code>lv_disp_get_inactive_time()</code> you can check <code>lv_anim_count_running()</code> to see if all animations have finished. | + | </syntaxhighlight> |
− | + | In addition to <code style="color: #bb0000;">lv_disp_get_inactive_time()</code> you can check <code style="color: #bb0000;">lv_anim_count_running()</code> to see if all animations have finished. | |
− | [[App:Library:LVGL:docs:Porting|戻る : Previous]] | + | |ユーザー入力が発生しない場合、MCUはスリープ状態になる可能性があります。この場合、メイン<code style="color: #bb0000;">while(1)</code>は次のようになります。<syntaxhighlight lang="C++" style="border: 1px dashed gray;"> |
+ | while (1 ) { | ||
+ | / *通常の操作(スリープなし)<1秒の非アクティブ* / | ||
+ | if (lv_disp_get_inactive_time (NULL ) < 1000 ) { | ||
+ | lv_task_handler (); | ||
+ | } | ||
+ | /*1秒間非アクティブになった後にスリープ*/ | ||
+ | else { | ||
+ | timer_stop (); / * lv_tick_inc()が呼び出されるタイマーを停止します* / | ||
+ | sleep (); /*MCUをスリープ状態にします*/ | ||
+ | } | ||
+ | my_delay_ms (5 ); | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | また、ウェイクアップ(押す、タッチする、クリックするなど)が発生したことを通知するために、入力デバイスの読み取り機能に次の行を追加する必要があります。 | ||
+ | <syntaxhighlight lang="C++" style="border: 1px dashed gray;"> | ||
+ | lv_tick_inc (LV_DISP_DEF_REFR_PERIOD ); /*ウェイクアップ時にタスクの実行を強制します*/ | ||
+ | timer_start (); / * lv_tick_inc()が呼び出されたタイマーを再起動します* / | ||
+ | lv_task_handler (); / *ウェイクアップイベントを処理するには、手動で `lv_task_handler()`を呼び出します* / | ||
+ | </syntaxhighlight> | ||
+ | <code style="color: #bb0000;">lv_disp_get_inactive_time()</code>に加えて、<code style="color: #bb0000;">lv_anim_count_running()</code>でもすべてのアニメーションが終了したかどうかを確認できます。 | ||
+ | |} | ||
+ | :[[App:Library:LVGL:docs:Porting#Sleep management|戻る : Previous]] |
2022年8月18日 (木) 22:43時点における最新版
https://docs.lvgl.io/8.2/porting/sleep.html
Sleep management
英文 | 自動翻訳 |
---|---|
The MCU can go to sleep when no user input happens. In this case, the mainwhile(1) should look like this: while(1) {
/*Normal operation (no sleep) in < 1 sec inactivity*/
if(lv_disp_get_inactive_time(NULL) < 1000) {
lv_task_handler();
}
/*Sleep after 1 sec inactivity*/
else {
timer_stop(); /*Stop the timer where lv_tick_inc() is called*/
sleep(); /*Sleep the MCU*/
}
my_delay_ms(5);
}
You should also add the following lines to your input device read function to signal a wake-up (press, touch or click etc.) has happened: lv_tick_inc(LV_DISP_DEF_REFR_PERIOD); /*Force task execution on wake-up*/
timer_start(); /*Restart the timer where lv_tick_inc() is called*/
lv_task_handler(); /*Call `lv_task_handler()` manually to process the wake-up event*/
In addition to |
ユーザー入力が発生しない場合、MCUはスリープ状態になる可能性があります。この場合、メインwhile(1) は次のようになります。 while (1 ) {
/ *通常の操作(スリープなし)<1秒の非アクティブ* /
if (lv_disp_get_inactive_time (NULL ) < 1000 ) {
lv_task_handler ();
}
/*1秒間非アクティブになった後にスリープ*/
else {
timer_stop (); / * lv_tick_inc()が呼び出されるタイマーを停止します* /
sleep (); /*MCUをスリープ状態にします*/
}
my_delay_ms (5 );
}
また、ウェイクアップ(押す、タッチする、クリックするなど)が発生したことを通知するために、入力デバイスの読み取り機能に次の行を追加する必要があります。 lv_tick_inc (LV_DISP_DEF_REFR_PERIOD ); /*ウェイクアップ時にタスクの実行を強制します*/
timer_start (); / * lv_tick_inc()が呼び出されたタイマーを再起動します* /
lv_task_handler (); / *ウェイクアップイベントを処理するには、手動で `lv_task_handler()`を呼び出します* /
|