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