From df839be649149db069b2decb9887a3c76aeea80c Mon Sep 17 00:00:00 2001 From: SnickerSun Date: Fri, 29 Mar 2024 17:51:20 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E5=A4=8D=E5=85=85=E7=94=B5=E5=BC=80?= =?utf8?q?=E6=9C=BA=E5=90=8E=E6=A3=80=E6=B5=8B=E4=B8=8D=E5=88=B0=E5=85=85?= =?utf8?q?=E7=94=B5=E7=8A=B6=E6=80=81bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../brandy/brandy_standard/board_init.c | 21 +++---------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/code/sdk/application/brandy/brandy_standard/board_init.c b/code/sdk/application/brandy/brandy_standard/board_init.c index ec062ca5b..2003168f0 100755 --- a/code/sdk/application/brandy/brandy_standard/board_init.c +++ b/code/sdk/application/brandy/brandy_standard/board_init.c @@ -99,23 +99,7 @@ static void gpio_func_init(void) } static button_press_state_t g_pwrkey_press_state = RELEASED; -startup_reason_t startup_reason = STARTUP_OTHER; - -static startup_reason_t get_startup_reason(void) -{ - startup_reason_t startup_type = STARTUP_OTHER; - uint16_t g_ulp_wkup_flag = readw(ULP_WKUP_INT_STS); - if (((g_ulp_wkup_flag >> WKUP_SYSTICK_MASK) & 1) == 1) { - startup_type = STARTUP_SYSTICK; - } - if (((g_ulp_wkup_flag >> WKUP_PWRON_MASK) & 1) == 1) { - startup_type = STARTUP_PWRON; - } - if (((g_ulp_wkup_flag >> WKUP_VBUS_EN_MASK) & 1) == 1) { - startup_type = STARTUP_VBUS_EN; - } - return startup_type; -} +static startup_reason_t startup_reason = STARTUP_OTHER; static button_press_state_t porting_button_get_state(void) { if ((readl(ANA_STS) & 0x3) == 0) { @@ -130,7 +114,8 @@ void check_pwrkey_3s(void) bool button_pressed = false; int pressed_count = 0; // button_api->button_register_callback(PIN_NONE, (osal_irq_handler)button_irq_callback); - startup_reason = get_startup_reason(); + uapi_ulp_wkup_type_record(); + startup_reason = uapi_get_startup_reason(); PRINT("bootup reasion %d (0-systick 1-pwrkey 2-vbus 3-other)"NEWLINE,startup_reason); if(startup_reason == 1) g_pwrkey_press_state = PRESSED; else g_pwrkey_press_state = RELEASED; -- 2.17.1