• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2   ******************************************************************************
3   * @file    stm32f4xx_exti.h
4   * @author  MCD Application Team
5   * @version V1.4.0
6   * @date    04-August-2014
7   * @brief   This file contains all the functions prototypes for the EXTI firmware
8   *          library.
9   ******************************************************************************
10   * @attention
11   *
12   * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
13   *
14   * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
15   * You may not use this file except in compliance with the License.
16   * You may obtain a copy of the License at:
17   *
18   *        http://www.st.com/software_license_agreement_liberty_v2
19   *
20   * Unless required by applicable law or agreed to in writing, software
21   * distributed under the License is distributed on an "AS IS" BASIS,
22   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23   * See the License for the specific language governing permissions and
24   * limitations under the License.
25   *
26   ******************************************************************************
27   */
28 
29 /* Define to prevent recursive inclusion -------------------------------------*/
30 #ifndef __STM32F4xx_EXTI_H
31 #define __STM32F4xx_EXTI_H
32 
33 #ifdef __cplusplus
34  extern "C" {
35 #endif
36 
37 /* Includes ------------------------------------------------------------------*/
38 #include "stm32f4xx.h"
39 
40 /** @addtogroup STM32F4xx_StdPeriph_Driver
41   * @{
42   */
43 
44 /** @addtogroup EXTI
45   * @{
46   */
47 
48 /* Exported types ------------------------------------------------------------*/
49 
50 /**
51   * @brief  EXTI mode enumeration
52   */
53 
54 typedef enum
55 {
56   EXTI_Mode_Interrupt = 0x00,
57   EXTI_Mode_Event = 0x04
58 }EXTIMode_TypeDef;
59 
60 #define IS_EXTI_MODE(MODE) (((MODE) == EXTI_Mode_Interrupt) || ((MODE) == EXTI_Mode_Event))
61 
62 /**
63   * @brief  EXTI Trigger enumeration
64   */
65 
66 typedef enum
67 {
68   EXTI_Trigger_Rising = 0x08,
69   EXTI_Trigger_Falling = 0x0C,
70   EXTI_Trigger_Rising_Falling = 0x10
71 }EXTITrigger_TypeDef;
72 
73 #define IS_EXTI_TRIGGER(TRIGGER) (((TRIGGER) == EXTI_Trigger_Rising) || \
74                                   ((TRIGGER) == EXTI_Trigger_Falling) || \
75                                   ((TRIGGER) == EXTI_Trigger_Rising_Falling))
76 /**
77   * @brief  EXTI Init Structure definition
78   */
79 
80 typedef struct
81 {
82   uint32_t EXTI_Line;               /*!< Specifies the EXTI lines to be enabled or disabled.
83                                          This parameter can be any combination value of @ref EXTI_Lines */
84 
85   EXTIMode_TypeDef EXTI_Mode;       /*!< Specifies the mode for the EXTI lines.
86                                          This parameter can be a value of @ref EXTIMode_TypeDef */
87 
88   EXTITrigger_TypeDef EXTI_Trigger; /*!< Specifies the trigger signal active edge for the EXTI lines.
89                                          This parameter can be a value of @ref EXTITrigger_TypeDef */
90 
91   FunctionalState EXTI_LineCmd;     /*!< Specifies the new state of the selected EXTI lines.
92                                          This parameter can be set either to ENABLE or DISABLE */
93 }EXTI_InitTypeDef;
94 
95 /* Exported constants --------------------------------------------------------*/
96 
97 /** @defgroup EXTI_Exported_Constants
98   * @{
99   */
100 
101 /** @defgroup EXTI_Lines
102   * @{
103   */
104 
105 #define EXTI_Line0       ((uint32_t)0x00001)     /*!< External interrupt line 0 */
106 #define EXTI_Line1       ((uint32_t)0x00002)     /*!< External interrupt line 1 */
107 #define EXTI_Line2       ((uint32_t)0x00004)     /*!< External interrupt line 2 */
108 #define EXTI_Line3       ((uint32_t)0x00008)     /*!< External interrupt line 3 */
109 #define EXTI_Line4       ((uint32_t)0x00010)     /*!< External interrupt line 4 */
110 #define EXTI_Line5       ((uint32_t)0x00020)     /*!< External interrupt line 5 */
111 #define EXTI_Line6       ((uint32_t)0x00040)     /*!< External interrupt line 6 */
112 #define EXTI_Line7       ((uint32_t)0x00080)     /*!< External interrupt line 7 */
113 #define EXTI_Line8       ((uint32_t)0x00100)     /*!< External interrupt line 8 */
114 #define EXTI_Line9       ((uint32_t)0x00200)     /*!< External interrupt line 9 */
115 #define EXTI_Line10      ((uint32_t)0x00400)     /*!< External interrupt line 10 */
116 #define EXTI_Line11      ((uint32_t)0x00800)     /*!< External interrupt line 11 */
117 #define EXTI_Line12      ((uint32_t)0x01000)     /*!< External interrupt line 12 */
118 #define EXTI_Line13      ((uint32_t)0x02000)     /*!< External interrupt line 13 */
119 #define EXTI_Line14      ((uint32_t)0x04000)     /*!< External interrupt line 14 */
120 #define EXTI_Line15      ((uint32_t)0x08000)     /*!< External interrupt line 15 */
121 #define EXTI_Line16      ((uint32_t)0x10000)     /*!< External interrupt line 16 Connected to the PVD Output */
122 #define EXTI_Line17      ((uint32_t)0x20000)     /*!< External interrupt line 17 Connected to the RTC Alarm event */
123 #define EXTI_Line18      ((uint32_t)0x40000)     /*!< External interrupt line 18 Connected to the USB OTG FS Wakeup from suspend event */
124 #define EXTI_Line19      ((uint32_t)0x80000)     /*!< External interrupt line 19 Connected to the Ethernet Wakeup event */
125 #define EXTI_Line20      ((uint32_t)0x00100000)  /*!< External interrupt line 20 Connected to the USB OTG HS (configured in FS) Wakeup event  */
126 #define EXTI_Line21      ((uint32_t)0x00200000)  /*!< External interrupt line 21 Connected to the RTC Tamper and Time Stamp events */
127 #define EXTI_Line22      ((uint32_t)0x00400000)  /*!< External interrupt line 22 Connected to the RTC Wakeup event */
128 
129 #define IS_EXTI_LINE(LINE) ((((LINE) & (uint32_t)0xFF800000) == 0x00) && ((LINE) != (uint16_t)0x00))
130 
131 #define IS_GET_EXTI_LINE(LINE) (((LINE) == EXTI_Line0) || ((LINE) == EXTI_Line1) || \
132                                 ((LINE) == EXTI_Line2) || ((LINE) == EXTI_Line3) || \
133                                 ((LINE) == EXTI_Line4) || ((LINE) == EXTI_Line5) || \
134                                 ((LINE) == EXTI_Line6) || ((LINE) == EXTI_Line7) || \
135                                 ((LINE) == EXTI_Line8) || ((LINE) == EXTI_Line9) || \
136                                 ((LINE) == EXTI_Line10) || ((LINE) == EXTI_Line11) || \
137                                 ((LINE) == EXTI_Line12) || ((LINE) == EXTI_Line13) || \
138                                 ((LINE) == EXTI_Line14) || ((LINE) == EXTI_Line15) || \
139                                 ((LINE) == EXTI_Line16) || ((LINE) == EXTI_Line17) || \
140                                 ((LINE) == EXTI_Line18) || ((LINE) == EXTI_Line19) || \
141                                 ((LINE) == EXTI_Line20) || ((LINE) == EXTI_Line21) ||\
142                                 ((LINE) == EXTI_Line22))
143 
144 /**
145   * @}
146   */
147 
148 /**
149   * @}
150   */
151 
152 /* Exported macro ------------------------------------------------------------*/
153 /* Exported functions --------------------------------------------------------*/
154 
155 /*  Function used to set the EXTI configuration to the default reset state *****/
156 void EXTI_DeInit(void);
157 
158 /* Initialization and Configuration functions *********************************/
159 void EXTI_Init(EXTI_InitTypeDef* EXTI_InitStruct);
160 void EXTI_StructInit(EXTI_InitTypeDef* EXTI_InitStruct);
161 void EXTI_GenerateSWInterrupt(uint32_t EXTI_Line);
162 
163 /* Interrupts and flags management functions **********************************/
164 FlagStatus EXTI_GetFlagStatus(uint32_t EXTI_Line);
165 void EXTI_ClearFlag(uint32_t EXTI_Line);
166 ITStatus EXTI_GetITStatus(uint32_t EXTI_Line);
167 void EXTI_ClearITPendingBit(uint32_t EXTI_Line);
168 
169 #ifdef __cplusplus
170 }
171 #endif
172 
173 #endif /* __STM32F4xx_EXTI_H */
174 
175 /**
176   * @}
177   */
178 
179 /**
180   * @}
181   */
182 
183 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
184