|
@@ -55,7 +55,7 @@ static void wait_for_enter_dsleep(void){
|
|
|
while(wait--> 0);
|
|
while(wait--> 0);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-static void pre_deepsleep(void){
|
|
|
|
|
|
|
+static int pre_deepsleep(void){
|
|
|
systick_close();
|
|
systick_close();
|
|
|
cs1180_cs(0);
|
|
cs1180_cs(0);
|
|
|
CS1180_PWR_ENABLE(0);
|
|
CS1180_PWR_ENABLE(0);
|
|
@@ -79,11 +79,13 @@ static void pre_deepsleep(void){
|
|
|
delay_us(5000); //give 5s to detect if the small current is short
|
|
delay_us(5000); //give 5s to detect if the small current is short
|
|
|
if (io_state()->aux_lock_detect){
|
|
if (io_state()->aux_lock_detect){
|
|
|
post_deepsleep();
|
|
post_deepsleep();
|
|
|
- return;
|
|
|
|
|
|
|
+ return -1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
wdog_set_timeout(WDOG_TIME_FOR_SLEEP);
|
|
wdog_set_timeout(WDOG_TIME_FOR_SLEEP);
|
|
|
wait_for_enter_dsleep();
|
|
wait_for_enter_dsleep();
|
|
|
|
|
+
|
|
|
|
|
+ return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void post_deepsleep(void){
|
|
static void post_deepsleep(void){
|
|
@@ -106,8 +108,9 @@ static void post_deepsleep(void){
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void mcu_enter_deepsleep(void){
|
|
void mcu_enter_deepsleep(void){
|
|
|
-
|
|
|
|
|
- pre_deepsleep();
|
|
|
|
|
|
|
+ if (pre_deepsleep()< 0){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
enable_wakeup_irq();
|
|
enable_wakeup_irq();
|
|
|
_sleep_second_time_now = 0;
|
|
_sleep_second_time_now = 0;
|
|
|
_wakeup_source = 0;
|
|
_wakeup_source = 0;
|