修复充电开机后检测不到充电状态bug
authorSnickerSun <snickersun@163.com>
Fri, 29 Mar 2024 09:51:20 +0000 (17:51 +0800)
committerSnickerSun <snickersun@163.com>
Fri, 29 Mar 2024 09:51:20 +0000 (17:51 +0800)
code/sdk/application/brandy/brandy_standard/board_init.c

index ec062ca..2003168 100755 (executable)
@@ -99,23 +99,7 @@ static void gpio_func_init(void)
 }\r
 \r
 static button_press_state_t g_pwrkey_press_state = RELEASED;\r
-startup_reason_t startup_reason = STARTUP_OTHER;\r
-\r
-static startup_reason_t get_startup_reason(void)\r
-{\r
-    startup_reason_t startup_type = STARTUP_OTHER;\r
-    uint16_t g_ulp_wkup_flag = readw(ULP_WKUP_INT_STS);\r
-    if (((g_ulp_wkup_flag >> WKUP_SYSTICK_MASK) & 1) == 1) {\r
-        startup_type = STARTUP_SYSTICK;\r
-    }\r
-    if (((g_ulp_wkup_flag >> WKUP_PWRON_MASK) & 1) == 1) {\r
-        startup_type = STARTUP_PWRON;\r
-    }\r
-    if (((g_ulp_wkup_flag >> WKUP_VBUS_EN_MASK) & 1) == 1) {\r
-        startup_type = STARTUP_VBUS_EN;\r
-    }\r
-    return startup_type;\r
-}\r
+static startup_reason_t startup_reason = STARTUP_OTHER;\r
 static button_press_state_t porting_button_get_state(void)\r
 {\r
     if ((readl(ANA_STS) & 0x3) == 0) {\r
@@ -130,7 +114,8 @@ void check_pwrkey_3s(void)
     bool button_pressed = false;\r
     int pressed_count = 0;\r
     // button_api->button_register_callback(PIN_NONE, (osal_irq_handler)button_irq_callback);\r
-    startup_reason = get_startup_reason();\r
+    uapi_ulp_wkup_type_record();\r
+    startup_reason = uapi_get_startup_reason();\r
     PRINT("bootup reasion %d (0-systick 1-pwrkey 2-vbus 3-other)"NEWLINE,startup_reason);\r
     if(startup_reason == 1) g_pwrkey_press_state = PRESSED;\r
     else g_pwrkey_press_state = RELEASED;\r