Explorar el Código

开启alarm失败,退出休眠

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui hace 5 años
padre
commit
a1845ffa59
Se han modificado 1 ficheros con 6 adiciones y 2 borrados
  1. 6 2
      Application/bsp/mcu_power_sleep.c

+ 6 - 2
Application/bsp/mcu_power_sleep.c

@@ -29,7 +29,7 @@ uint32_t get_system_sleep_time(void){
 	return _sleep_second_time;
 }
 
-static void enable_wakeup_irq(void){
+static int enable_wakeup_irq(void){
 	//hall_1_detect_irq_enable(1);
 	//hall_2_detect_irq_enable(1);
 	shark_rtc_start_alarm(RTC_ALARM_FOR_SLEEP);
@@ -123,7 +123,11 @@ void mcu_enter_deepsleep(void){
 	if (pre_deepsleep()< 0){
 		return;
 	} 
-	enable_wakeup_irq();
+	if (enable_wakeup_irq()< 0){
+		disable_wakeup_irq();
+		post_deepsleep();
+		return;
+	}
 	_sleep_second_time_now = 0;
 	_wakeup_source = 0;
 	do {