{ ????uint32_t?irq_status; ????while(1) ????{ ????????SYS_DisableAllIrq(?&irq_status?); ????????if(?true?==?g_irq_button_event?)?{ ????????????tmos_clear_event(?main_func_get_taskid(),?BUTTON_IRQ_EVENT); ????????????tmos_set_event(?main_func_get_taskid(),?BUTTON_IRQ_EVENT); ????????????g_irq_button_event?=?false; ????????} ????????SYS_RecoverIrq(?irq_status?); ????????TMOS_SystemProcess(); ????} } __attribute__((interrupt("WCH-Interrupt-fast"))) __attribute__((section(".highcode"))) void?GPIOA_IRQHandler(void) { ????if(GPIOA_ReadITFlagBit(BUTTON_MAINTENANCE_PIN)){ ????????g_irq_button_event?=?true; ????????PRINT("aaaaaaaaaaaaaa\n"); ????????if(R32_PA_PIN?&?(BUTTON_MAINTENANCE_PIN)) ????????????GPIOA_ITModeCfg(BUTTON_MAINTENANCE_PIN,?GPIO_ITMode_LowLevel); ????????else ????????????GPIOA_ITModeCfg(BUTTON_MAINTENANCE_PIN,?GPIO_ITMode_HighLevel); ????????//GPIOA_ClearITFlagBit(BUTTON_MAINTENANCE_PIN); ????}else{ ????????PRINT("bbbbbbbbbbbbb\n"); ????} }
按鍵狀態(tài)變換一次就執(zhí)行一次任務(wù)。在不開(kāi)啟休眠HAL_SLEEP時(shí),運(yùn)行正常,但是開(kāi)啟休眠后,就不能按一次按鍵打印一次,而且放開(kāi)后才執(zhí)行兩次