diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-06-01 15:41:47 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-06-01 15:41:47 +1000 |
| commit | dd27c3530432ea0b09f01e604bf577f31d8ef841 (patch) | |
| tree | bbf86cf81a78f0ff0b07f31f1c390db473f26fd3 /lib/lvgl/docs/porting/sleep.md | |
| parent | 6fd588e970470b15936187980829916d0dbe77bb (diff) | |
| download | tangara-fw-dd27c3530432ea0b09f01e604bf577f31d8ef841.tar.gz | |
convert lvgl from submodule to a plain old directory
Diffstat (limited to 'lib/lvgl/docs/porting/sleep.md')
| m--------- | lib/lvgl | 0 | ||||
| -rw-r--r-- | lib/lvgl/docs/porting/sleep.md | 27 |
2 files changed, 27 insertions, 0 deletions
diff --git a/lib/lvgl b/lib/lvgl deleted file mode 160000 -Subproject 0732400e7b564dd0e7dc4a924619d8e19c5b23a diff --git a/lib/lvgl/docs/porting/sleep.md b/lib/lvgl/docs/porting/sleep.md new file mode 100644 index 00000000..b0a877c7 --- /dev/null +++ b/lib/lvgl/docs/porting/sleep.md @@ -0,0 +1,27 @@ +# Sleep management + +The MCU can go to sleep when no user input happens. In this case, the main `while(1)` should look like this: + +```c +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: +```c +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 `lv_disp_get_inactive_time()` you can check `lv_anim_count_running()` to see if all animations have finished. |
