void?wakeup_init(void) { ????GPIO_InitTypeDef?GPIO_InitStructure; ????EXTI_InitTypeDef?EXTI_InitStructure; ????NVIC_InitTypeDef?NVIC_InitStructure; ????//?使能GPIOA時鐘 ????RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO?|RCC_APB2Periph_GPIOA,?ENABLE); ???? ????//?配置PA0為輸入模式 ????GPIO_InitStructure.GPIO_Pin?=?GPIO_Pin_0; ????GPIO_InitStructure.GPIO_Mode?=?GPIO_Mode_IPU; ????GPIO_Init(GPIOA,?&GPIO_InitStructure); ???? ????//?配置EXTI?Line0 ????GPIO_EXTILineConfig(GPIO_PortSourceGPIOA,?GPIO_PinSource0); ????EXTI_InitStructure.EXTI_Line?=?EXTI_Line0; ????EXTI_InitStructure.EXTI_Mode?=?EXTI_Mode_Event; ????EXTI_InitStructure.EXTI_Trigger?=?EXTI_Trigger_Falling; ????EXTI_InitStructure.EXTI_LineCmd?=?ENABLE; ????EXTI_Init(&EXTI_InitStructure); } void?off_sta(void) { ????GPIO_InitTypeDef?GPIO_InitStructure?=?{0}; ???? ????/*?To?reduce?power?consumption,?unused?GPIOs?need?to?be?set?as?pull-down?inputs?*/ ????RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOB| ???????????????????????????RCC_APB2Periph_GPIOC|RCC_APB2Periph_GPIOD|RCC_APB2Periph_GPIOE,?ENABLE); ????GPIO_InitStructure.GPIO_Pin?=?GPIO_Pin_All; ????GPIO_InitStructure.GPIO_Mode?=?GPIO_Mode_IPD; ???? ????GPIO_Init(GPIOA,?&GPIO_InitStructure); ????GPIO_Init(GPIOB,?&GPIO_InitStructure); ????GPIO_Init(GPIOC,?&GPIO_InitStructure); ????GPIO_Init(GPIOD,?&GPIO_InitStructure); ????GPIO_Init(GPIOE,?&GPIO_InitStructure); ???? ????wakeup_init(); ???? ????SystemCoreClockUpdate(); ???? ????RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR,?ENABLE); ????PWR_WakeUpPinCmd(ENABLE); ????PWR_EnterSTANDBYMode_RAM(); }
用PA0配置喚醒standby模式的時候,剛進(jìn)入就被自動喚醒了,是什么原因啊
熱門產(chǎn)品 :
CH32V317: 互聯(lián)型青稞RISC-V MCU