00. 目录

文章目录

  • 00. 目录
  • 01. 概述
  • 02. 相关类型
  • 03. 相关函数
  • 04. 结构体封装
  • 05. 附录
  • 06. 声明

01. 概述

中断相关代码主要分布在固件库的 stm32f4xx_exti.hstm32f4xx_exti.c 文件中。

02. 相关类型

EXTI模式枚举

/** * @brief  EXTI mode enumeration  */typedef enum
{EXTI_Mode_Interrupt = 0x00,EXTI_Mode_Event = 0x04
}EXTIMode_TypeDef;#define IS_EXTI_MODE(MODE) (((MODE) == EXTI_Mode_Interrupt) || ((MODE) == EXTI_Mode_Event))

EXTI触发枚举

/** * @brief  EXTI Trigger enumeration  */typedef enum
{EXTI_Trigger_Rising = 0x08, //上升沿EXTI_Trigger_Falling = 0x0C,  //下降沿EXTI_Trigger_Rising_Falling = 0x10 //边沿触发
}EXTITrigger_TypeDef;#define IS_EXTI_TRIGGER(TRIGGER) (((TRIGGER) == EXTI_Trigger_Rising) || \((TRIGGER) == EXTI_Trigger_Falling) || \((TRIGGER) == EXTI_Trigger_Rising_Falling))

EXTI初始化结构体

/** * @brief  EXTI Init Structure definition  */typedef struct
{uint32_t EXTI_Line;               /*!< Specifies the EXTI lines to be enabled or disabled.This parameter can be any combination value of @ref EXTI_Lines */EXTIMode_TypeDef EXTI_Mode;       /*!< Specifies the mode for the EXTI lines.This parameter can be a value of @ref EXTIMode_TypeDef */EXTITrigger_TypeDef EXTI_Trigger; /*!< Specifies the trigger signal active edge for the EXTI lines.This parameter can be a value of @ref EXTITrigger_TypeDef */FunctionalState EXTI_LineCmd;     /*!< Specifies the new state of the selected EXTI lines.This parameter can be set either to ENABLE or DISABLE */
}EXTI_InitTypeDef;

外部中断线

/** @defgroup EXTI_Lines * @{*/#define EXTI_Line0       ((uint32_t)0x00001)     /*!< External interrupt line 0 */
#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 */#define IS_EXTI_LINE(LINE) ((((LINE) & (uint32_t)0xFF800000) == 0x00) && ((LINE) != (uint16_t)0x00))#define IS_GET_EXTI_LINE(LINE) (((LINE) == EXTI_Line0) || ((LINE) == EXTI_Line1) || \((LINE) == EXTI_Line2) || ((LINE) == EXTI_Line3) || \((LINE) == EXTI_Line4) || ((LINE) == EXTI_Line5) || \((LINE) == EXTI_Line6) || ((LINE) == EXTI_Line7) || \((LINE) == EXTI_Line8) || ((LINE) == EXTI_Line9) || \((LINE) == EXTI_Line10) || ((LINE) == EXTI_Line11) || \((LINE) == EXTI_Line12) || ((LINE) == EXTI_Line13) || \((LINE) == EXTI_Line14) || ((LINE) == EXTI_Line15) || \((LINE) == EXTI_Line16) || ((LINE) == EXTI_Line17) || \((LINE) == EXTI_Line18) || ((LINE) == EXTI_Line19) || \((LINE) == EXTI_Line20) || ((LINE) == EXTI_Line21) ||\((LINE) == EXTI_Line22) || ((LINE) == EXTI_Line23))

03. 相关函数


/* Exported macro ------------------------------------------------------------*/
/* Exported functions --------------------------------------------------------*//*  Function used to set the EXTI configuration to the default reset state *****/
void EXTI_DeInit(void);/* Initialization and Configuration functions *********************************/
void EXTI_Init(EXTI_InitTypeDef* EXTI_InitStruct);
void EXTI_StructInit(EXTI_InitTypeDef* EXTI_InitStruct);
void EXTI_GenerateSWInterrupt(uint32_t EXTI_Line);/* Interrupts and flags management functions **********************************/
FlagStatus EXTI_GetFlagStatus(uint32_t EXTI_Line);
void EXTI_ClearFlag(uint32_t EXTI_Line);
ITStatus EXTI_GetITStatus(uint32_t EXTI_Line);
void EXTI_ClearITPendingBit(uint32_t EXTI_Line);

04. 结构体封装

外部中断控制器结构体封装

/** * @brief External Interrupt/Event Controller*/typedef struct
{__IO uint32_t IMR;    /*!< EXTI Interrupt mask register,            Address offset: 0x00 */__IO uint32_t EMR;    /*!< EXTI Event mask register,                Address offset: 0x04 */__IO uint32_t RTSR;   /*!< EXTI Rising trigger selection register,  Address offset: 0x08 */__IO uint32_t FTSR;   /*!< EXTI Falling trigger selection register, Address offset: 0x0C */__IO uint32_t SWIER;  /*!< EXTI Software interrupt event register,  Address offset: 0x10 */__IO uint32_t PR;     /*!< EXTI Pending register,                   Address offset: 0x14 */
} EXTI_TypeDef;

05. 附录

5.1 【STM32】STM32系列教程汇总

网址:【STM32】STM32系列教程汇总

06. 声明

【STM32】中断相关函数和类型相关推荐

  1. 【STM32】RTC相关函数和类型

    00. 目录 文章目录 00. 目录 01. 概述 02. 相关类型 03. 相关函数 04. 结构体封装 05. 预留 06. 附录 07. 声明 01. 概述 RTC相关函数和类型主要在stm32 ...

  2. 【STM32】GPIO相关函数和类型

    00. 目录 文章目录 00. 目录 01. GPIO固件库概述 02. GPIO相关类型 03. GPIO相关宏 04. GPIO相关函数 05. GPIO其它相关 06. 附录 07. 声明 01 ...

  3. STM32中断中调用OLED显示出现OLED花屏

    STM32中断中调用OLED显示出现OLED花屏 在TIM5中断处理函数中,我写了OLED显示,经过DEBUG发现程序执行到OLED显示语句的时候,OLED就会花屏. //中断服务处理函数 void ...

  4. STM32中断笔记——关于NVIC的两个问题

    STM32 中断非常强大,每个外设都可以产生中断,中断也是STM32非常重要的一个内容. NVIC:嵌套向量中断控制器,属于内核外设,管理着包括内核和片上所有外设的中断相关的功能. ARM corte ...

  5. 第十一章 STM32中断应用

    目录 11.1 中断概述 11.1.1 中断的基本概念和原理 11.1.2 STM32中断系统结构和工作原理 11.1.3 中断向量表及存储位置 11.2 中断控制器 11.2.1 NVIC的功能和特 ...

  6. STM32中断—EXTI外部中断

    5. 中断 本文来自于<STM32--江科大>的笔记整理. 中断系统 中断:在主程序运行过程中,出现了特定的中断触发条件(中断源),使得CPU暂停当前正在运行的程序,转而去处理中断程序,处 ...

  7. STM32中断:NVIC与EXTI

    STM32中断非常强大,每个外设都可以产生中断.异常就是中断,中断就是异常,请不要刻意钻牛角尖较劲. 1.异常类型 F103在内核水平上搭载了一个异常响应系统,支持为数众多的系统异常和外部中断.其中系 ...

  8. STM32中断应用总结

    STM32中断应用总结 STM32中断很强大,STM32中断可以嵌套,任何外设都可以产生中断,其中中断和异常是等价的. 中断执行流程: 主程序执行过程可以产生中断去执行中断的内容(保护现场),然后在返 ...

  9. STM32——中断、EXTI、按键中断实验

    STM32中断--总结及实操 一.中断是什么? 1.1 中断的含义 1.2 中断的作用(了解即可) 1.3 中断的流程 二.中断资源 2.1 NVIC中断控制器 2.2 NVIC寄存器 三.优先级的概 ...

最新文章

  1. Comparison of Laser SLAM and Visual SLAM
  2. Glassfish3 asadmin 常用命令
  3. 数据中心虚拟化的7大考量要素
  4. json spr路驾驶技术视频api_每天弄个小爬取之Python爬取批量爬取B站小视频
  5. [BZOJ 2654]tree(陈立杰)
  6. 上传本地项目到git
  7. 记录下Lambda常用的表现形式
  8. 用__asm写c函数[秋镇菜]
  9. c语言向自定数组_C语言怎么向自定义函数中传入一个数组,处理完再返回新的数组?...
  10. 有道智云智能语音服务全面升级 最多可支持44种语言和方言
  11. 《自然》:这家中国AI公司的计划,超越了所有对手
  12. Mybatis高级映射一对多查询
  13. Jmeter之web压力测试
  14. node.js安装和卸载问题could not access network location *\Program...
  15. SQL的笛卡尔积简记
  16. 计算机通信原理电子版,通信原理-西安电子科技大学.PDF
  17. 电子书如何通过邮箱传入kindle
  18. C#简单实现控制台2048
  19. c语言常见表达式汇总(赋值表达式,条件表达式,关系表达式,算数表达式......)
  20. sns是什么?可以做什么?

热门文章

  1. StringBuffer(字符串缓冲区)
  2. 每列大于0的个数_题目1342——把一个数字减少到0的步骤数
  3. unet脑肿瘤分割_2D UNet3+ Pytorch实现 脑肿瘤分割
  4. 中英文切换_王者荣耀:模拟战奖励一览,新增中英文切换,李白第二套星元来袭...
  5. python csdn博客_利用Python抓取CSDN博客
  6. Java黑皮书课后题第5章:*5.48(处理字符串)编写一个程序,提示用户输入一个字符串,显示奇数位置的字符
  7. 洛谷P2055 [ZJOI2009]假期的宿舍 题解
  8. 【BZOJ2286】消耗战(虚树,动态规划)
  9. php mysql jquery ajax 查询数据库三级联动
  10. 运营系统的前世今生(1)