diff src/cs/layer1/cust0/l1_cust.c @ 292:0f688d07b068

block deep sleep on activity in new PWT and vibrator drivers
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 27 Mar 2022 00:29:19 +0000
parents 6d77f6e1670a
children
line wrap: on
line diff
--- a/src/cs/layer1/cust0/l1_cust.c	Sat Mar 26 19:31:18 2022 +0000
+++ b/src/cs/layer1/cust0/l1_cust.c	Sun Mar 27 00:29:19 2022 +0000
@@ -255,6 +255,7 @@
   extern T_PWR_CTRL_BLOCK *pwr_ctrl;
 #endif
   extern SYS_BOOL uart_sleep_timer_enabled;
+  extern SYS_BOOL PWT_tone_is_on, HW_vibrator_is_on;
   extern unsigned char iota_ledb_status;
 
 #if (CODE_VERSION != SIMULATION)
@@ -279,6 +280,20 @@
       return(FRAME_STOP);  // BIG sleep
     }
 
+    // Forbid deep sleep if the buzzer is on
+    if (PWT_tone_is_on)
+    {
+      why_big_sleep = BIG_SLEEP_DUE_TO_BUZZER;
+      return(FRAME_STOP);  // BIG sleep
+    }
+
+    // Forbid deep sleep if the vibrator is on
+    if (HW_vibrator_is_on)
+    {
+      why_big_sleep = BIG_SLEEP_DUE_TO_VIBRATOR;
+      return(FRAME_STOP);  // BIG sleep
+    }
+
     // Forbid deep sleep if the SIM and UARTs not ready
     if (!SIM_SleepStatus())
     {