我在V003使用PA1中断进行待机模式唤醒时似乎会导致单片机复位,手册里写的也有些模糊,是必须AWU事件才能不复位吗
我的代码
NVIC_DisableIRQ(SysTicK_IRQn); Wake_EnableIRQ(); PWR_EnterSTANDBYMode(PWR_STANDBYEntry_WFI);
void?Wake_Init()?{ ????GPIO_InitTypeDef?GPIO_InitStructure?=?{0}; ????GPIO_InitStructure.GPIO_Speed?=?GPIO_Speed_2MHz; ????GPIO_InitStructure.GPIO_Mode?=?GPIO_Mode_IPD; ????GPIO_InitStructure.GPIO_Pin?=?WAKE_Pin; ????GPIO_Init(WAKE_GPIO_Port,?&GPIO_InitStructure); ????EXTI_InitTypeDef?EXTI_InitStructure?=?{0}; ????/*?GPIOA.0?---->?EXTI_Line0?*/ ????GPIO_EXTILineConfig(GPIO_PortSourceGPIOA,?GPIO_PinSource1); ????EXTI_InitStructure.EXTI_Line?=?EXTI_Line1; ????EXTI_InitStructure.EXTI_Mode?=?EXTI_Mode_Interrupt; ????EXTI_InitStructure.EXTI_Trigger?=?EXTI_Trigger_Rising; ????EXTI_InitStructure.EXTI_LineCmd?=?ENABLE; ????EXTI_Init(&EXTI_InitStructure); ????NVIC_InitTypeDef?NVIC_InitStructure?=?{0}; ????NVIC_InitStructure.NVIC_IRQChannel?=?EXTI7_0_IRQn; ????NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority?=?0; ????NVIC_InitStructure.NVIC_IRQChannelSubPriority?=?1; ????NVIC_InitStructure.NVIC_IRQChannelCmd?=?DISABLE; ????NVIC_Init(&NVIC_InitStructure); } void?Wake_EnableIRQ()?{ ????NVIC_EnableIRQ(EXTI7_0_IRQn); }
void?EXTI7_0_IRQHandler()?__attribute__((interrupt("WCH-Interrupt-fast"))); void?EXTI7_0_IRQHandler()?{ ????if?(EXTI_GetITStatus(EXTI_Line1)?!=?RESET)?{ ????????EXTI_ClearITPendingBit(EXTI_Line1); ????} }
热门产品 :
CH32L103: 32位PDUSB低功耗单片机