acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

sleep.md (1086B)

      1 ```eval_rst
      2 .. include:: /header.rst
      3 :github_url: |github_link_base|/porting/sleep.md
      4 ```
      5 # Sleep management
      6 
      7 The MCU can go to sleep when no user input happens. In this case, the main `while(1)` should look like this:
      8 
      9 ```c
     10 while(1) {
     11   /*Normal operation (no sleep) in < 1 sec inactivity*/
     12   if(lv_disp_get_inactive_time(NULL) < 1000) {
     13 	  lv_task_handler();
     14   }
     15   /*Sleep after 1 sec inactivity*/
     16   else {
     17 	  timer_stop();   /*Stop the timer where lv_tick_inc() is called*/
     18 	  sleep();		    /*Sleep the MCU*/
     19   }
     20   my_delay_ms(5);
     21 }
     22 ```
     23 
     24 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:
     25 ```c
     26 lv_tick_inc(LV_DISP_DEF_REFR_PERIOD);  /*Force task execution on wake-up*/
     27 timer_start();                         /*Restart the timer where lv_tick_inc() is called*/
     28 lv_task_handler();                     /*Call `lv_task_handler()` manually to process the wake-up event*/
     29 ```
     30 
     31 In addition to `lv_disp_get_inactive_time()` you can check `lv_anim_count_running()` to see if all animations have finished.