一、EXTI 管理控制23个中断/事件,每个中断/事件 都对应一个边沿检测器,可以实现信号输入的上升沿检测和下降沿检测。 EXTI可实现对每个中断/事件线单独配置,
可以单独配置为中断或事件,以及触发事件的属性。
二、EXTI的功能框图,见具体资料手册。
三、EXIT中断/事件线
#define EXTI_Line0 ((uint32_t)0x00001) /*!< External interrupt line 0 PX0(X可为 A,B,C,D,E,F,G,H,I)*/ #define EXTI_Line1 ((uint32_t)0x00002) /*!< External interrupt line 1 同上*/ #define EXTI_Line2 ((uint32_t)0x00004) /*!< External interrupt line 2 */ #define EXTI_Line3 ((uint32_t)0x00008) /*!< External interrupt line 3 */ #define EXTI_Line4 ((uint32_t)0x00010) /*!< External interrupt line 4 */ #define EXTI_Line5 ((uint32_t)0x00020) /*!< External interrupt line 5 */ #define EXTI_Line6 ((uint32_t)0x00040) /*!< External interrupt line 6 */ #define EXTI_Line7 ((uint32_t)0x00080) /*!< External interrupt line 7 */ #define EXTI_Line8 ((uint32_t)0x00100) /*!< External interrupt line 8 */ #define EXTI_Line9 ((uint32_t)0x00200) /*!< External interrupt line 9 */ #define EXTI_Line10 ((uint32_t)0x00400) /*!< External interrupt line 10 */ #define EXTI_Line11 ((uint32_t)0x00800) /*!< External interrupt line 11 */ #define EXTI_Line12 ((uint32_t)0x01000) /*!< External interrupt line 12 */ #define EXTI_Line13 ((uint32_t)0x02000) /*!< External interrupt line 13 */ #define EXTI_Line14 ((uint32_t)0x04000) /*!< External interrupt line 14 */ #define EXTI_Line15 ((uint32_t)0x08000) /*!< External interrupt line 15 */ #define EXTI_Line16 ((uint32_t)0x10000) /*!< External interrupt line 16 Connected to the PVD Output 可编程电压检测器输出*/ #define EXTI_Line17 ((uint32_t)0x20000) /*!< External interrupt line 17 Connected to the RTC Alarm event */ #define EXTI_Line18 ((uint32_t)0x40000) /*!< External interrupt line 18 Connected to the USB OTG FS Wakeup from suspend event */ #define EXTI_Line19 ((uint32_t)0x80000) /*!< External interrupt line 19 Connected to the Ethernet Wakeup event */ #define EXTI_Line20 ((uint32_t)0x00100000) /*!< External interrupt line 20 Connected to the USB OTG HS (configured in FS) Wakeup event */ #define EXTI_Line21 ((uint32_t)0x00200000) /*!< External interrupt line 21 Connected to the RTC Tamper and Time Stamp events */ #define EXTI_Line22 ((uint32_t)0x00400000) /*!< External interrupt line 22 Connected to the RTC Wakeup event */ #define EXTI_Line23 ((uint32_t)0x00800000) /*!< External interrupt line 23 Connected to the LPTIM Wakeup event */
四、EXTI初始化结构体
typedef struct { uint32_t EXTI_Line; //中断/事件线 EXTIMode_TypeDef EXTI_Mode; //模式 EXTITrigger_TypeDef EXTI_Trigger; //触发方式(上升或下降) FunctionalState EXTI_LineCmd; //EXTI使能 }EXTI_InitTypeDef;
五、实验:通过按键来触发EXTI,并在中断服务函数中实现对RGB彩灯的亮灭
5.1 流程图
标签:控制器,STM32,External,interrupt,line,uint32,EXTI,define From: https://www.cnblogs.com/zhanghongfei/p/17480371.html