Forráskód Böngészése

默认开启2个霍尔中断,解决休眠漏中断导致有概率需要2次才能唤醒的问题

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 5 éve
szülő
commit
12c133913b
2 módosított fájl, 11 hozzáadás és 6 törlés
  1. 2 1
      Application/app/sox/iostate.c
  2. 9 5
      Application/bsp/mcu_power_sleep.c

+ 2 - 1
Application/app/sox/iostate.c

@@ -48,7 +48,8 @@ void io_state_init(void){
 
 	small_current_short_irq_enable(1);
 	charger_detect_irq_enable(1);
-	
+	hall_1_detect_irq_enable(1);
+	hall_2_detect_irq_enable(1);
 	bms_message_update_insert(_io_state.hall_detect);
 
 	iostate_log();

+ 9 - 5
Application/bsp/mcu_power_sleep.c

@@ -30,15 +30,15 @@ uint32_t get_system_sleep_time(void){
 }
 
 static void enable_wakeup_irq(void){
-	hall_1_detect_irq_enable(1);
-	hall_2_detect_irq_enable(1);
+	//hall_1_detect_irq_enable(1);
+	//hall_2_detect_irq_enable(1);
 	shark_rtc_start_alarm(RTC_ALARM_FOR_SLEEP);
 }
 
 static void disable_wakeup_irq(void){
 	shark_rtc_stop_alarm();
-	hall_1_detect_irq_enable(0);
-	hall_2_detect_irq_enable(0);
+	//hall_1_detect_irq_enable(0);
+	//hall_2_detect_irq_enable(0);
 }
 
 static int _is_wakeup_source(void){
@@ -89,7 +89,11 @@ static int pre_deepsleep(void){
 	
 	wdog_set_timeout(WDOG_TIME_FOR_SLEEP);
 	wait_for_enter_dsleep();
-
+	if (_is_wakeup_source()) {
+		_wakeup_source = 0;
+		post_deepsleep();
+		return -1;
+	}
 	return 0;
 }