Subversion Repositories testOled

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 mjames 1
/**
2
  ******************************************************************************
3
  * @file    stm32f1xx_hal_exti.h
4
  * @author  MCD Application Team
5
  * @brief   Header file of EXTI HAL module.
6
  ******************************************************************************
7
  * @attention
8
  *
9
  * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
10
  * All rights reserved.</center></h2>
11
  *
12
  * This software component is licensed by ST under BSD 3-Clause license,
13
  * the "License"; You may not use this file except in compliance with the
14
  * License. You may obtain a copy of the License at:
15
  *                        opensource.org/licenses/BSD-3-Clause
16
  *
17
  ******************************************************************************
18
  */
19
 
20
/* Define to prevent recursive inclusion -------------------------------------*/
21
#ifndef STM32F1xx_HAL_EXTI_H
22
#define STM32F1xx_HAL_EXTI_H
23
 
24
#ifdef __cplusplus
25
extern "C" {
26
#endif
27
 
28
/* Includes ------------------------------------------------------------------*/
29
#include "stm32f1xx_hal_def.h"
30
 
31
/** @addtogroup STM32F1xx_HAL_Driver
32
  * @{
33
  */
34
 
35
/** @defgroup EXTI EXTI
36
  * @brief EXTI HAL module driver
37
  * @{
38
  */
39
 
40
/* Exported types ------------------------------------------------------------*/
41
 
42
/** @defgroup EXTI_Exported_Types EXTI Exported Types
43
  * @{
44
  */
45
 
46
/**
47
  * @brief  HAL EXTI common Callback ID enumeration definition
48
  */
49
typedef enum
50
{
51
  HAL_EXTI_COMMON_CB_ID          = 0x00U
52
} EXTI_CallbackIDTypeDef;
53
 
54
/**
55
  * @brief  EXTI Handle structure definition
56
  */
57
typedef struct
58
{
59
  uint32_t Line;                    /*!<  Exti line number */
60
  void (* PendingCallback)(void);   /*!<  Exti pending callback */
61
} EXTI_HandleTypeDef;
62
 
63
/**
64
  * @brief  EXTI Configuration structure definition
65
  */
66
typedef struct
67
{
68
  uint32_t Line;      /*!< The Exti line to be configured. This parameter
69
                           can be a value of @ref EXTI_Line */
70
  uint32_t Mode;      /*!< The Exit Mode to be configured for a core.
71
                           This parameter can be a combination of @ref EXTI_Mode */
72
  uint32_t Trigger;   /*!< The Exti Trigger to be configured. This parameter
73
                           can be a value of @ref EXTI_Trigger */
74
  uint32_t GPIOSel;   /*!< The Exti GPIO multiplexer selection to be configured.
75
                           This parameter is only possible for line 0 to 15. It
76
                           can be a value of @ref EXTI_GPIOSel */
77
} EXTI_ConfigTypeDef;
78
 
79
/**
80
  * @}
81
  */
82
 
83
/* Exported constants --------------------------------------------------------*/
84
/** @defgroup EXTI_Exported_Constants EXTI Exported Constants
85
  * @{
86
  */
87
 
88
/** @defgroup EXTI_Line  EXTI Line
89
  * @{
90
  */
91
#define EXTI_LINE_0                        (EXTI_GPIO     | 0x00u)    /*!< External interrupt line 0 */
92
#define EXTI_LINE_1                        (EXTI_GPIO     | 0x01u)    /*!< External interrupt line 1 */
93
#define EXTI_LINE_2                        (EXTI_GPIO     | 0x02u)    /*!< External interrupt line 2 */
94
#define EXTI_LINE_3                        (EXTI_GPIO     | 0x03u)    /*!< External interrupt line 3 */
95
#define EXTI_LINE_4                        (EXTI_GPIO     | 0x04u)    /*!< External interrupt line 4 */
96
#define EXTI_LINE_5                        (EXTI_GPIO     | 0x05u)    /*!< External interrupt line 5 */
97
#define EXTI_LINE_6                        (EXTI_GPIO     | 0x06u)    /*!< External interrupt line 6 */
98
#define EXTI_LINE_7                        (EXTI_GPIO     | 0x07u)    /*!< External interrupt line 7 */
99
#define EXTI_LINE_8                        (EXTI_GPIO     | 0x08u)    /*!< External interrupt line 8 */
100
#define EXTI_LINE_9                        (EXTI_GPIO     | 0x09u)    /*!< External interrupt line 9 */
101
#define EXTI_LINE_10                       (EXTI_GPIO     | 0x0Au)    /*!< External interrupt line 10 */
102
#define EXTI_LINE_11                       (EXTI_GPIO     | 0x0Bu)    /*!< External interrupt line 11 */
103
#define EXTI_LINE_12                       (EXTI_GPIO     | 0x0Cu)    /*!< External interrupt line 12 */
104
#define EXTI_LINE_13                       (EXTI_GPIO     | 0x0Du)    /*!< External interrupt line 13 */
105
#define EXTI_LINE_14                       (EXTI_GPIO     | 0x0Eu)    /*!< External interrupt line 14 */
106
#define EXTI_LINE_15                       (EXTI_GPIO     | 0x0Fu)    /*!< External interrupt line 15 */
107
#define EXTI_LINE_16                       (EXTI_CONFIG   | 0x10u)    /*!< External interrupt line 16 Connected to the PVD Output */
108
#define EXTI_LINE_17                       (EXTI_CONFIG   | 0x11u)    /*!< External interrupt line 17 Connected to the RTC Alarm event */
109
#if defined(EXTI_IMR_IM18)
110
#define EXTI_LINE_18                       (EXTI_CONFIG   | 0x12u)    /*!< External interrupt line 18 Connected to the USB Wakeup from suspend event */
111
#endif /* EXTI_IMR_IM18 */
112
#if defined(EXTI_IMR_IM19)
113
#define EXTI_LINE_19                       (EXTI_CONFIG   | 0x13u)    /*!< External interrupt line 19 Connected to the Ethernet Wakeup event */
114
#endif /* EXTI_IMR_IM19 */
115
 
116
/**
117
  * @}
118
  */
119
 
120
/** @defgroup EXTI_Mode  EXTI Mode
121
  * @{
122
  */
123
#define EXTI_MODE_NONE                      0x00000000u
124
#define EXTI_MODE_INTERRUPT                 0x00000001u
125
#define EXTI_MODE_EVENT                     0x00000002u
126
/**
127
  * @}
128
  */
129
 
130
/** @defgroup EXTI_Trigger  EXTI Trigger
131
  * @{
132
  */
133
#define EXTI_TRIGGER_NONE                   0x00000000u
134
#define EXTI_TRIGGER_RISING                 0x00000001u
135
#define EXTI_TRIGGER_FALLING                0x00000002u
136
#define EXTI_TRIGGER_RISING_FALLING         (EXTI_TRIGGER_RISING | EXTI_TRIGGER_FALLING)
137
/**
138
  * @}
139
  */
140
 
141
/** @defgroup EXTI_GPIOSel  EXTI GPIOSel
142
  * @brief
143
  * @{
144
  */
145
#define EXTI_GPIOA                          0x00000000u
146
#define EXTI_GPIOB                          0x00000001u
147
#define EXTI_GPIOC                          0x00000002u
148
#define EXTI_GPIOD                          0x00000003u
149
#if defined (GPIOE)
150
#define EXTI_GPIOE                          0x00000004u
151
#endif /* GPIOE */
152
#if defined (GPIOF)
153
#define EXTI_GPIOF                          0x00000005u
154
#endif /* GPIOF */
155
#if defined (GPIOG)
156
#define EXTI_GPIOG                          0x00000006u
157
#endif /* GPIOG */
158
/**
159
  * @}
160
  */
161
 
162
/**
163
  * @}
164
  */
165
 
166
/* Exported macro ------------------------------------------------------------*/
167
/** @defgroup EXTI_Exported_Macros EXTI Exported Macros
168
  * @{
169
  */
170
 
171
/**
172
  * @}
173
  */
174
 
175
/* Private constants --------------------------------------------------------*/
176
/** @defgroup EXTI_Private_Constants EXTI Private Constants
177
  * @{
178
  */
179
/**
180
  * @brief  EXTI Line property definition
181
  */
182
#define EXTI_PROPERTY_SHIFT                 24u
183
#define EXTI_CONFIG                         (0x02uL << EXTI_PROPERTY_SHIFT)
184
#define EXTI_GPIO                           ((0x04uL << EXTI_PROPERTY_SHIFT) | EXTI_CONFIG)
185
#define EXTI_PROPERTY_MASK                  (EXTI_CONFIG | EXTI_GPIO)
186
 
187
/**
188
  * @brief  EXTI bit usage
189
  */
190
#define EXTI_PIN_MASK                       0x0000001Fu
191
 
192
/**
193
  * @brief  EXTI Mask for interrupt & event mode
194
  */
195
#define EXTI_MODE_MASK                      (EXTI_MODE_EVENT | EXTI_MODE_INTERRUPT)
196
 
197
/**
198
  * @brief  EXTI Mask for trigger possibilities
199
  */
200
#define EXTI_TRIGGER_MASK                   (EXTI_TRIGGER_RISING | EXTI_TRIGGER_FALLING)
201
 
202
/**
203
  * @brief  EXTI Line number
204
  */
205
#if defined(EXTI_IMR_IM19)
206
#define EXTI_LINE_NB                        20UL
207
#elif defined(EXTI_IMR_IM18)
208
#define EXTI_LINE_NB                        19UL
209
#else /* EXTI_IMR_IM17 */
210
#define EXTI_LINE_NB                        18UL
211
#endif /* EXTI_IMR_IM19 */
212
/**
213
  * @}
214
  */
215
 
216
/* Private macros ------------------------------------------------------------*/
217
/** @defgroup EXTI_Private_Macros EXTI Private Macros
218
  * @{
219
  */
220
#define IS_EXTI_LINE(__EXTI_LINE__)          ((((__EXTI_LINE__) & ~(EXTI_PROPERTY_MASK | EXTI_PIN_MASK)) == 0x00u) && \
221
                                             ((((__EXTI_LINE__) & EXTI_PROPERTY_MASK) == EXTI_CONFIG)   || \
222
                                              (((__EXTI_LINE__) & EXTI_PROPERTY_MASK) == EXTI_GPIO))    && \
223
                                              (((__EXTI_LINE__) & EXTI_PIN_MASK) < EXTI_LINE_NB))
224
 
225
#define IS_EXTI_MODE(__EXTI_LINE__)          ((((__EXTI_LINE__) & EXTI_MODE_MASK) != 0x00u) && \
226
                                              (((__EXTI_LINE__) & ~EXTI_MODE_MASK) == 0x00u))
227
 
228
#define IS_EXTI_TRIGGER(__EXTI_LINE__)       (((__EXTI_LINE__) & ~EXTI_TRIGGER_MASK) == 0x00u)
229
 
230
#define IS_EXTI_PENDING_EDGE(__EXTI_LINE__)  ((__EXTI_LINE__) == EXTI_TRIGGER_RISING_FALLING)
231
 
232
#define IS_EXTI_CONFIG_LINE(__EXTI_LINE__)   (((__EXTI_LINE__) & EXTI_CONFIG) != 0x00u)
233
 
234
#if defined (GPIOG)
235
#define IS_EXTI_GPIO_PORT(__PORT__)     (((__PORT__) == EXTI_GPIOA) || \
236
                                         ((__PORT__) == EXTI_GPIOB) || \
237
                                         ((__PORT__) == EXTI_GPIOC) || \
238
                                         ((__PORT__) == EXTI_GPIOD) || \
239
                                         ((__PORT__) == EXTI_GPIOE) || \
240
                                         ((__PORT__) == EXTI_GPIOF) || \
241
                                         ((__PORT__) == EXTI_GPIOG))
242
#elif defined (GPIOF)
243
#define IS_EXTI_GPIO_PORT(__PORT__)     (((__PORT__) == EXTI_GPIOA) || \
244
                                         ((__PORT__) == EXTI_GPIOB) || \
245
                                         ((__PORT__) == EXTI_GPIOC) || \
246
                                         ((__PORT__) == EXTI_GPIOD) || \
247
                                         ((__PORT__) == EXTI_GPIOE) || \
248
                                         ((__PORT__) == EXTI_GPIOF))
249
#elif defined (GPIOE)
250
#define IS_EXTI_GPIO_PORT(__PORT__)     (((__PORT__) == EXTI_GPIOA) || \
251
                                         ((__PORT__) == EXTI_GPIOB) || \
252
                                         ((__PORT__) == EXTI_GPIOC) || \
253
                                         ((__PORT__) == EXTI_GPIOD) || \
254
                                         ((__PORT__) == EXTI_GPIOE))
255
#else
256
#define IS_EXTI_GPIO_PORT(__PORT__)     (((__PORT__) == EXTI_GPIOA) || \
257
                                         ((__PORT__) == EXTI_GPIOB) || \
258
                                         ((__PORT__) == EXTI_GPIOC) || \
259
                                         ((__PORT__) == EXTI_GPIOD))
260
#endif /* GPIOG */
261
 
262
#define IS_EXTI_GPIO_PIN(__PIN__)       ((__PIN__) < 16u)
263
 
264
/**
265
  * @}
266
  */
267
 
268
/* Exported functions --------------------------------------------------------*/
269
/** @defgroup EXTI_Exported_Functions EXTI Exported Functions
270
  * @brief    EXTI Exported Functions
271
  * @{
272
  */
273
 
274
/** @defgroup EXTI_Exported_Functions_Group1 Configuration functions
275
  * @brief    Configuration functions
276
  * @{
277
  */
278
/* Configuration functions ****************************************************/
279
HAL_StatusTypeDef HAL_EXTI_SetConfigLine(EXTI_HandleTypeDef *hexti, EXTI_ConfigTypeDef *pExtiConfig);
280
HAL_StatusTypeDef HAL_EXTI_GetConfigLine(EXTI_HandleTypeDef *hexti, EXTI_ConfigTypeDef *pExtiConfig);
281
HAL_StatusTypeDef HAL_EXTI_ClearConfigLine(EXTI_HandleTypeDef *hexti);
282
HAL_StatusTypeDef HAL_EXTI_RegisterCallback(EXTI_HandleTypeDef *hexti, EXTI_CallbackIDTypeDef CallbackID, void (*pPendingCbfn)(void));
283
HAL_StatusTypeDef HAL_EXTI_GetHandle(EXTI_HandleTypeDef *hexti, uint32_t ExtiLine);
284
/**
285
  * @}
286
  */
287
 
288
/** @defgroup EXTI_Exported_Functions_Group2 IO operation functions
289
  * @brief    IO operation functions
290
  * @{
291
  */
292
/* IO operation functions *****************************************************/
293
void              HAL_EXTI_IRQHandler(EXTI_HandleTypeDef *hexti);
294
uint32_t          HAL_EXTI_GetPending(EXTI_HandleTypeDef *hexti, uint32_t Edge);
295
void              HAL_EXTI_ClearPending(EXTI_HandleTypeDef *hexti, uint32_t Edge);
296
void              HAL_EXTI_GenerateSWI(EXTI_HandleTypeDef *hexti);
297
 
298
/**
299
  * @}
300
  */
301
 
302
/**
303
  * @}
304
  */
305
 
306
/**
307
  * @}
308
  */
309
 
310
/**
311
  * @}
312
  */
313
 
314
#ifdef __cplusplus
315
}
316
#endif
317
 
318
#endif /* STM32F1xx_HAL_EXTI_H */
319
 
320
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/