SYSCFG_EXTICR1~4这四个寄存器可以选择外部中断的pin。
有23个EXTI,分别是EXTI0~22;
对于EXIT0~15对应到各个GPIO组的16个PIN;
EXTI line 16 is connected to the PVD output
EXTI line 17 is connected to the RTC Alarm event
EXTI line 18 is connected to the USB OTG FS Wakeup event
EXTI line 21 is connected to the RTC Tamper and TimeStamp events
EXTI line 22 is connected to the RTC Wakeup event
如果如果要配置PC13这个pin,那么他如果EXTI13,且要配置SYSCFG_EXTICR4的EXTI1[0~3]配置成0010;
对于NVIC这边应该怎么配置呢,首先要找到PC13这个pin配置成外部中断对应的IRQ number。
我们知道PC13对应的EXTI13,通过终端向量表找到如下,即IRQ number=40,设置中断优先级以及使能中断即可。
EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts