stm32如何在中断服务程序里关闭EXTI中断?

2024-11-28 00:31:41
推荐回答(2个)
回答1:

那个中断已经被触发了,你要做的只有是清中断标志位:
EXTI_ClearITPendingBit(EXTI_Line14);
EXTI_ClearFlag(EXTI_Line14);
非要关的话,我觉得这样就关了
EXTI_InitStructure.EXTI_Line = EXTI_Line14;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
EXTI_InitStructure.EXTI_LineCmd = DISABLE; //ENABLE
EXTI_Init(&EXTI_InitStructure);

回答2:

注意外部中断信号的响应速度,最好在退出时清中断,以免重复响应