#define GPIO_KEY_BUTTON GPIOD #define RCC_APB2Periph_GPIO_KEY_BUTTON RCC_APB2Periph_GPIOD #define GPIO_PIN_KEY_BUTTON GPIO_Pin_3 #define EXTI_LINE_KEY_BUTTON EXTI_Line3 #define GPIO_PORT_SOURCE_KEY_BUTTON GPIO_PortSourceGPIOD #define GPIO_PIN_SOURCE_KEY_BUTTON GPIO_PinSource3
RCC_Configuration();
NVIC_Configuration();
GPIO_Configuration(); GPIO_EXTILineConfig(GPIO_PORT_SOURCE_KEY_BUTTON, GPIO_PIN_SOURCE_KEY_BUTTON);
EXTI_InitStructure.EXTI_Line = EXTI_LINE_KEY_BUTTON; EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; EXTI_InitStructure.EXTI_LineCmd = ENABLE; EXTI_Init(&EXTI_InitStructure);
//EXTI_GenerateSWInterrupt(EXTI_LINE_KEY_BUTTON); while(1) {
}
如果不屏蔽EXTI_GenerateSWInterrupt,可以进中断 当屏蔽后相应管脚拉低无法进去了,是不是哪还没配置对? |