三.配置EXIT线,使中断线和IO管脚连接在一起
void EXIT1_Configuration(void)
{
EXTI_InitTypeDef EXTI_InitStructure;
//Connect EXTI Line1 to PB.01
GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource1); //将EXTI线1连接到端口GPIOD的第1个针脚上
// Configure Key Button EXTI Line to generate an interrupt on both rising and falling edge
EXTI_InitStructure.EXTI_Line = EXTI_Line1; //注意:如果配置的1号针脚,那么必须是EXTI_Line1
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising_Falling; //下降沿和上升沿都触发
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure); //初始化中断
}
|