]> git.friedersdorff.com Git - max/tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F3XX/stm32f30x_exti.h
Merge commit 'fdc38ef3f92af7adeeb4de49550d8838c8a39b5c'
[max/tmk_keyboard.git] / tmk_core / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_STM / TARGET_STM32F3XX / stm32f30x_exti.h
1 /**
2   ******************************************************************************
3   * @file    stm32f30x_exti.h
4   * @author  MCD Application Team
5   * @version V1.1.0
6   * @date    27-February-2014
7   * @brief   This file contains all the functions prototypes for the EXTI 
8   *          firmware library.
9   ******************************************************************************
10   * @attention
11   *
12   * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
13   *
14   * Redistribution and use in source and binary forms, with or without modification,
15   * are permitted provided that the following conditions are met:
16   *   1. Redistributions of source code must retain the above copyright notice,
17   *      this list of conditions and the following disclaimer.
18   *   2. Redistributions in binary form must reproduce the above copyright notice,
19   *      this list of conditions and the following disclaimer in the documentation
20   *      and/or other materials provided with the distribution.
21   *   3. Neither the name of STMicroelectronics nor the names of its contributors
22   *      may be used to endorse or promote products derived from this software
23   *      without specific prior written permission.
24   *
25   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
29   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35   *
36   ******************************************************************************
37   */ 
38
39 /* Define to prevent recursive inclusion -------------------------------------*/
40 #ifndef __STM32F30x_EXTI_H
41 #define __STM32F30x_EXTI_H
42
43 #ifdef __cplusplus
44  extern "C" {
45 #endif
46
47 /* Includes ------------------------------------------------------------------*/
48 #include "stm32f30x.h"
49
50 /** @addtogroup STM32F30x_StdPeriph_Driver
51   * @{
52   */
53
54 /** @addtogroup EXTI
55   * @{
56   */
57
58 /* Exported types ------------------------------------------------------------*/
59
60 /** 
61   * @brief  EXTI mode enumeration  
62   */
63
64 typedef enum
65 {
66   EXTI_Mode_Interrupt = 0x00,
67   EXTI_Mode_Event = 0x04
68 }EXTIMode_TypeDef;
69
70 #define IS_EXTI_MODE(MODE) (((MODE) == EXTI_Mode_Interrupt) || ((MODE) == EXTI_Mode_Event))
71
72 /** 
73   * @brief  EXTI Trigger enumeration  
74   */
75
76 typedef enum
77 {
78   EXTI_Trigger_Rising = 0x08,
79   EXTI_Trigger_Falling = 0x0C,
80   EXTI_Trigger_Rising_Falling = 0x10
81 }EXTITrigger_TypeDef;
82
83 #define IS_EXTI_TRIGGER(TRIGGER) (((TRIGGER) == EXTI_Trigger_Rising) || \
84                                   ((TRIGGER) == EXTI_Trigger_Falling) || \
85                                   ((TRIGGER) == EXTI_Trigger_Rising_Falling))
86 /** 
87   * @brief  EXTI Init Structure definition  
88   */
89
90 typedef struct
91 {
92   uint32_t EXTI_Line;               /*!< Specifies the EXTI lines to be enabled or disabled.
93                                          This parameter can be any combination of @ref EXTI_Lines */
94    
95   EXTIMode_TypeDef EXTI_Mode;       /*!< Specifies the mode for the EXTI lines.
96                                          This parameter can be a value of @ref EXTIMode_TypeDef */
97
98   EXTITrigger_TypeDef EXTI_Trigger; /*!< Specifies the trigger signal active edge for the EXTI lines.
99                                          This parameter can be a value of @ref EXTITrigger_TypeDef */
100
101   FunctionalState EXTI_LineCmd;     /*!< Specifies the new state of the selected EXTI lines.
102                                          This parameter can be set either to ENABLE or DISABLE */
103 }EXTI_InitTypeDef;
104
105 /* Exported constants --------------------------------------------------------*/
106
107 /** @defgroup EXTI_Exported_Constants
108   * @{
109   */ 
110 /** @defgroup EXTI_Lines 
111   * @{
112   */
113
114 #define EXTI_Line0       ((uint32_t)0x00)  /*!< External interrupt line 0  */
115 #define EXTI_Line1       ((uint32_t)0x01)  /*!< External interrupt line 1  */
116 #define EXTI_Line2       ((uint32_t)0x02)  /*!< External interrupt line 2  */
117 #define EXTI_Line3       ((uint32_t)0x03)  /*!< External interrupt line 3  */
118 #define EXTI_Line4       ((uint32_t)0x04)  /*!< External interrupt line 4  */
119 #define EXTI_Line5       ((uint32_t)0x05)  /*!< External interrupt line 5  */
120 #define EXTI_Line6       ((uint32_t)0x06)  /*!< External interrupt line 6  */
121 #define EXTI_Line7       ((uint32_t)0x07)  /*!< External interrupt line 7  */
122 #define EXTI_Line8       ((uint32_t)0x08)  /*!< External interrupt line 8  */
123 #define EXTI_Line9       ((uint32_t)0x09)  /*!< External interrupt line 9  */
124 #define EXTI_Line10      ((uint32_t)0x0A)  /*!< External interrupt line 10 */
125 #define EXTI_Line11      ((uint32_t)0x0B)  /*!< External interrupt line 11 */
126 #define EXTI_Line12      ((uint32_t)0x0C)  /*!< External interrupt line 12 */
127 #define EXTI_Line13      ((uint32_t)0x0D)  /*!< External interrupt line 13 */
128 #define EXTI_Line14      ((uint32_t)0x0E)  /*!< External interrupt line 14 */
129 #define EXTI_Line15      ((uint32_t)0x0F)  /*!< External interrupt line 15 */
130 #define EXTI_Line16      ((uint32_t)0x10)  /*!< External interrupt line 16 
131                                                       Connected to the PVD Output */
132 #define EXTI_Line17      ((uint32_t)0x11)  /*!< Internal interrupt line 17 
133                                                       Connected to the RTC Alarm 
134                                                       event */
135 #define EXTI_Line18      ((uint32_t)0x12)  /*!< Internal interrupt line 18 
136                                                       Connected to the USB Device
137                                                       Wakeup from suspend event */
138 #define EXTI_Line19      ((uint32_t)0x13)  /*!< Internal interrupt line 19
139                                                       Connected to the RTC Tamper
140                                                       and Time Stamp events */
141 #define EXTI_Line20      ((uint32_t)0x14)  /*!< Internal interrupt line 20
142                                                       Connected to the RTC wakeup
143                                                       event */                                                      
144 #define EXTI_Line21      ((uint32_t)0x15)  /*!< Internal interrupt line 21
145                                                       Connected to the Comparator 1
146                                                       event */
147 #define EXTI_Line22      ((uint32_t)0x16)  /*!< Internal interrupt line 22
148                                                       Connected to the Comparator 2
149                                                       event */
150 #define EXTI_Line23      ((uint32_t)0x17)  /*!< Internal interrupt line 23
151                                                       Connected to the I2C1 wakeup
152                                                       event */
153 #define EXTI_Line24      ((uint32_t)0x18)  /*!< Internal interrupt line 24
154                                                       Connected to the I2C2 wakeup
155                                                       event */
156 #define EXTI_Line25      ((uint32_t)0x19)  /*!< Internal interrupt line 25
157                                                       Connected to the USART1 wakeup
158                                                       event */
159 #define EXTI_Line26      ((uint32_t)0x1A)  /*!< Internal interrupt line 26
160                                                       Connected to the USART2 wakeup
161                                                       event */
162 #define EXTI_Line27      ((uint32_t)0x1B)  /*!< Internal interrupt line 27
163                                                        reserved */
164 #define EXTI_Line28      ((uint32_t)0x1C)  /*!< Internal interrupt line 28
165                                                       Connected to the USART3 wakeup
166                                                       event */
167 #define EXTI_Line29      ((uint32_t)0x1D)  /*!< Internal interrupt line 29
168                                                       Connected to the Comparator 3 
169                                                       event */
170 #define EXTI_Line30      ((uint32_t)0x1E)  /*!< Internal interrupt line 30
171                                                       Connected to the Comparator 4 
172                                                       event */
173 #define EXTI_Line31      ((uint32_t)0x1F)  /*!< Internal interrupt line 31
174                                                       Connected to the Comparator 5 
175                                                       event */
176 #define EXTI_Line32      ((uint32_t)0x20)  /*!< Internal interrupt line 32
177                                                       Connected to the Comparator 6 
178                                                       event */
179 #define EXTI_Line33      ((uint32_t)0x21)  /*!< Internal interrupt line 33
180                                                       Connected to the Comparator 7 
181                                                       event */
182 #define EXTI_Line34      ((uint32_t)0x22)  /*!< Internal interrupt line 34
183                                                       Connected to the USART4 wakeup
184                                                       event */
185 #define EXTI_Line35      ((uint32_t)0x23)  /*!< Internal interrupt line 35
186                                                       Connected to the USART5 wakeup
187                                                       event */
188                                                                                                                                                                                                                                                                                                                                                                                                                                                 
189 #define IS_EXTI_LINE_ALL(LINE) ((LINE) <= 0x23)
190 #define IS_EXTI_LINE_EXT(LINE) (((LINE) <= 0x16) || (((LINE) == EXTI_Line29) || ((LINE) == EXTI_Line30) || \
191                                ((LINE) == EXTI_Line31) || ((LINE) == EXTI_Line32) || ((LINE) == EXTI_Line33)))
192
193 #define IS_GET_EXTI_LINE(LINE) (((LINE) == EXTI_Line0) || ((LINE) == EXTI_Line1) || \
194                                 ((LINE) == EXTI_Line2) || ((LINE) == EXTI_Line3) || \
195                                 ((LINE) == EXTI_Line4) || ((LINE) == EXTI_Line5) || \
196                                 ((LINE) == EXTI_Line6) || ((LINE) == EXTI_Line7) || \
197                                 ((LINE) == EXTI_Line8) || ((LINE) == EXTI_Line9) || \
198                                 ((LINE) == EXTI_Line10) || ((LINE) == EXTI_Line11) || \
199                                 ((LINE) == EXTI_Line12) || ((LINE) == EXTI_Line13) || \
200                                 ((LINE) == EXTI_Line14) || ((LINE) == EXTI_Line15) || \
201                                 ((LINE) == EXTI_Line16) || ((LINE) == EXTI_Line17) || \
202                                 ((LINE) == EXTI_Line18) || ((LINE) == EXTI_Line19) || \
203                                 ((LINE) == EXTI_Line20) || ((LINE) == EXTI_Line21) || \
204                                 ((LINE) == EXTI_Line22) || ((LINE) == EXTI_Line29) || \
205                                 ((LINE) == EXTI_Line30) || ((LINE) == EXTI_Line31) || \
206                                 ((LINE) == EXTI_Line32) || ((LINE) == EXTI_Line33))
207 /**
208   * @}
209   */
210  
211 /**
212   * @}
213   */
214
215 /* Exported macro ------------------------------------------------------------*/
216 /* Exported functions ------------------------------------------------------- */
217 /* Function used to set the EXTI configuration to the default reset state *****/
218 void EXTI_DeInit(void);
219
220 /* Initialization and Configuration functions *********************************/
221 void EXTI_Init(EXTI_InitTypeDef* EXTI_InitStruct);
222 void EXTI_StructInit(EXTI_InitTypeDef* EXTI_InitStruct);
223 void EXTI_GenerateSWInterrupt(uint32_t EXTI_Line);
224
225 /* Interrupts and flags management functions **********************************/
226 FlagStatus EXTI_GetFlagStatus(uint32_t EXTI_Line);
227 void EXTI_ClearFlag(uint32_t EXTI_Line);
228 ITStatus EXTI_GetITStatus(uint32_t EXTI_Line);
229 void EXTI_ClearITPendingBit(uint32_t EXTI_Line);
230
231 #ifdef __cplusplus
232 }
233 #endif
234
235 #endif /* __STM32F30x_EXTI_H */
236 /**
237   * @}
238   */ 
239
240 /**
241   * @}
242   */
243
244 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/