38
|
1 /**
|
|
2 ******************************************************************************
|
|
3 * @file stm32f4xx_hal_gpio_ex.h
|
|
4 * @author MCD Application Team
|
|
5 * @version V1.2.0
|
|
6 * @date 26-December-2014
|
|
7 * @brief Header file of GPIO HAL Extension module.
|
|
8 ******************************************************************************
|
|
9 * @attention
|
|
10 *
|
|
11 * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
|
12 *
|
|
13 * Redistribution and use in source and binary forms, with or without modification,
|
|
14 * are permitted provided that the following conditions are met:
|
|
15 * 1. Redistributions of source code must retain the above copyright notice,
|
|
16 * this list of conditions and the following disclaimer.
|
|
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
18 * this list of conditions and the following disclaimer in the documentation
|
|
19 * and/or other materials provided with the distribution.
|
|
20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
21 * may be used to endorse or promote products derived from this software
|
|
22 * without specific prior written permission.
|
|
23 *
|
|
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34 *
|
|
35 ******************************************************************************
|
|
36 */
|
|
37
|
|
38 /* Define to prevent recursive inclusion -------------------------------------*/
|
|
39 #ifndef __STM32F4xx_HAL_GPIO_EX_H
|
|
40 #define __STM32F4xx_HAL_GPIO_EX_H
|
|
41
|
|
42 #ifdef __cplusplus
|
|
43 extern "C" {
|
|
44 #endif
|
|
45
|
|
46 /* Includes ------------------------------------------------------------------*/
|
|
47 #include "stm32f4xx_hal_def.h"
|
|
48
|
|
49 /** @addtogroup STM32F4xx_HAL_Driver
|
|
50 * @{
|
|
51 */
|
|
52
|
|
53 /** @addtogroup GPIO
|
|
54 * @{
|
|
55 */
|
|
56
|
|
57 /* Exported types ------------------------------------------------------------*/
|
|
58 /* Exported constants --------------------------------------------------------*/
|
|
59 /** @addtogroup GPIO_Exported_Constants
|
|
60 * @{
|
|
61 */
|
|
62
|
|
63 /** @defgroup GPIO_Alternate_function_selection GPIO Alternate Function Selection
|
|
64 * @{
|
|
65 */
|
|
66 /*------------------------- STM32F429xx/STM32F439xx---------------------------*/
|
|
67 #if defined (STM32F429xx) || defined (STM32F439xx)
|
|
68 /**
|
|
69 * @brief AF 0 selection
|
|
70 */
|
|
71 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
|
|
72 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
|
|
73 #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
|
|
74 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
|
|
75 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
|
|
76
|
|
77 /**
|
|
78 * @brief AF 1 selection
|
|
79 */
|
|
80 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
|
|
81 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
|
|
82
|
|
83 /**
|
|
84 * @brief AF 2 selection
|
|
85 */
|
|
86 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
|
|
87 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
|
|
88 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
|
|
89
|
|
90 /**
|
|
91 * @brief AF 3 selection
|
|
92 */
|
|
93 #define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */
|
|
94 #define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */
|
|
95 #define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */
|
|
96 #define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */
|
|
97
|
|
98 /**
|
|
99 * @brief AF 4 selection
|
|
100 */
|
|
101 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
|
|
102 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
|
|
103 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */
|
|
104
|
|
105 /**
|
|
106 * @brief AF 5 selection
|
|
107 */
|
|
108 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */
|
|
109 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */
|
|
110 #define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3/I2S3 Alternate Function mapping */
|
|
111 #define GPIO_AF5_SPI4 ((uint8_t)0x05) /* SPI4 Alternate Function mapping */
|
|
112 #define GPIO_AF5_SPI5 ((uint8_t)0x05) /* SPI5 Alternate Function mapping */
|
|
113 #define GPIO_AF5_SPI6 ((uint8_t)0x05) /* SPI6 Alternate Function mapping */
|
|
114 #define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */
|
|
115
|
|
116 /**
|
|
117 * @brief AF 6 selection
|
|
118 */
|
|
119 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */
|
|
120 #define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */
|
|
121 #define GPIO_AF6_SAI1 ((uint8_t)0x06) /* SAI1 Alternate Function mapping */
|
|
122
|
|
123 /**
|
|
124 * @brief AF 7 selection
|
|
125 */
|
|
126 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
|
|
127 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
|
|
128 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */
|
|
129 #define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */
|
|
130
|
|
131 /**
|
|
132 * @brief AF 8 selection
|
|
133 */
|
|
134 #define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */
|
|
135 #define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */
|
|
136 #define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */
|
|
137 #define GPIO_AF8_UART7 ((uint8_t)0x08) /* UART7 Alternate Function mapping */
|
|
138 #define GPIO_AF8_UART8 ((uint8_t)0x08) /* UART8 Alternate Function mapping */
|
|
139
|
|
140 /**
|
|
141 * @brief AF 9 selection
|
|
142 */
|
|
143 #define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */
|
|
144 #define GPIO_AF9_CAN2 ((uint8_t)0x09) /* CAN2 Alternate Function mapping */
|
|
145 #define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */
|
|
146 #define GPIO_AF9_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */
|
|
147 #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */
|
|
148 #define GPIO_AF9_LTDC ((uint8_t)0x09) /* LCD-TFT Alternate Function mapping */
|
|
149
|
|
150 /**
|
|
151 * @brief AF 10 selection
|
|
152 */
|
|
153 #define GPIO_AF10_OTG_FS ((uint8_t)0xA) /* OTG_FS Alternate Function mapping */
|
|
154 #define GPIO_AF10_OTG_HS ((uint8_t)0xA) /* OTG_HS Alternate Function mapping */
|
|
155
|
|
156 /**
|
|
157 * @brief AF 11 selection
|
|
158 */
|
|
159 #define GPIO_AF11_ETH ((uint8_t)0x0B) /* ETHERNET Alternate Function mapping */
|
|
160
|
|
161 /**
|
|
162 * @brief AF 12 selection
|
|
163 */
|
|
164 #define GPIO_AF12_FMC ((uint8_t)0xC) /* FMC Alternate Function mapping */
|
|
165 #define GPIO_AF12_OTG_HS_FS ((uint8_t)0xC) /* OTG HS configured in FS, Alternate Function mapping */
|
|
166 #define GPIO_AF12_SDIO ((uint8_t)0xC) /* SDIO Alternate Function mapping */
|
|
167
|
|
168 /**
|
|
169 * @brief AF 13 selection
|
|
170 */
|
|
171 #define GPIO_AF13_DCMI ((uint8_t)0x0D) /* DCMI Alternate Function mapping */
|
|
172
|
|
173 /**
|
|
174 * @brief AF 14 selection
|
|
175 */
|
|
176 #define GPIO_AF14_LTDC ((uint8_t)0x0E) /* LCD-TFT Alternate Function mapping */
|
|
177
|
|
178 /**
|
|
179 * @brief AF 15 selection
|
|
180 */
|
|
181 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
|
|
182 #endif /* STM32F429xx || STM32F439xx */
|
|
183 /*------------------------------------------------------------------------------------------*/
|
|
184
|
|
185 /*---------------------------------- STM32F427xx/STM32F437xx--------------------------------*/
|
|
186 #if defined (STM32F427xx) || defined (STM32F437xx)
|
|
187 /**
|
|
188 * @brief AF 0 selection
|
|
189 */
|
|
190 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
|
|
191 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
|
|
192 #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
|
|
193 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
|
|
194 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
|
|
195
|
|
196 /**
|
|
197 * @brief AF 1 selection
|
|
198 */
|
|
199 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
|
|
200 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
|
|
201
|
|
202 /**
|
|
203 * @brief AF 2 selection
|
|
204 */
|
|
205 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
|
|
206 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
|
|
207 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
|
|
208
|
|
209 /**
|
|
210 * @brief AF 3 selection
|
|
211 */
|
|
212 #define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */
|
|
213 #define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */
|
|
214 #define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */
|
|
215 #define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */
|
|
216
|
|
217 /**
|
|
218 * @brief AF 4 selection
|
|
219 */
|
|
220 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
|
|
221 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
|
|
222 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */
|
|
223
|
|
224 /**
|
|
225 * @brief AF 5 selection
|
|
226 */
|
|
227 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */
|
|
228 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */
|
|
229 #define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3/I2S3 Alternate Function mapping */
|
|
230 #define GPIO_AF5_SPI4 ((uint8_t)0x05) /* SPI4 Alternate Function mapping */
|
|
231 #define GPIO_AF5_SPI5 ((uint8_t)0x05) /* SPI5 Alternate Function mapping */
|
|
232 #define GPIO_AF5_SPI6 ((uint8_t)0x05) /* SPI6 Alternate Function mapping */
|
|
233 /** @brief GPIO_Legacy
|
|
234 */
|
|
235 #define GPIO_AF5_I2S3ext GPIO_AF5_SPI3 /* I2S3ext_SD Alternate Function mapping */
|
|
236
|
|
237 /**
|
|
238 * @brief AF 6 selection
|
|
239 */
|
|
240 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */
|
|
241 #define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */
|
|
242 #define GPIO_AF6_SAI1 ((uint8_t)0x06) /* SAI1 Alternate Function mapping */
|
|
243
|
|
244 /**
|
|
245 * @brief AF 7 selection
|
|
246 */
|
|
247 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
|
|
248 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
|
|
249 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */
|
|
250 #define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */
|
|
251
|
|
252 /**
|
|
253 * @brief AF 8 selection
|
|
254 */
|
|
255 #define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */
|
|
256 #define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */
|
|
257 #define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */
|
|
258 #define GPIO_AF8_UART7 ((uint8_t)0x08) /* UART7 Alternate Function mapping */
|
|
259 #define GPIO_AF8_UART8 ((uint8_t)0x08) /* UART8 Alternate Function mapping */
|
|
260
|
|
261 /**
|
|
262 * @brief AF 9 selection
|
|
263 */
|
|
264 #define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */
|
|
265 #define GPIO_AF9_CAN2 ((uint8_t)0x09) /* CAN2 Alternate Function mapping */
|
|
266 #define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */
|
|
267 #define GPIO_AF9_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */
|
|
268 #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */
|
|
269
|
|
270 /**
|
|
271 * @brief AF 10 selection
|
|
272 */
|
|
273 #define GPIO_AF10_OTG_FS ((uint8_t)0xA) /* OTG_FS Alternate Function mapping */
|
|
274 #define GPIO_AF10_OTG_HS ((uint8_t)0xA) /* OTG_HS Alternate Function mapping */
|
|
275
|
|
276 /**
|
|
277 * @brief AF 11 selection
|
|
278 */
|
|
279 #define GPIO_AF11_ETH ((uint8_t)0x0B) /* ETHERNET Alternate Function mapping */
|
|
280
|
|
281 /**
|
|
282 * @brief AF 12 selection
|
|
283 */
|
|
284 #define GPIO_AF12_FMC ((uint8_t)0xC) /* FMC Alternate Function mapping */
|
|
285 #define GPIO_AF12_OTG_HS_FS ((uint8_t)0xC) /* OTG HS configured in FS, Alternate Function mapping */
|
|
286 #define GPIO_AF12_SDIO ((uint8_t)0xC) /* SDIO Alternate Function mapping */
|
|
287
|
|
288 /**
|
|
289 * @brief AF 13 selection
|
|
290 */
|
|
291 #define GPIO_AF13_DCMI ((uint8_t)0x0D) /* DCMI Alternate Function mapping */
|
|
292
|
|
293 /**
|
|
294 * @brief AF 15 selection
|
|
295 */
|
|
296 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
|
|
297 #endif /* STM32F427xx || STM32F437xx */
|
|
298 /*------------------------------------------------------------------------------------------*/
|
|
299
|
|
300 /*---------------------------------- STM32F407xx/STM32F417xx--------------------------------*/
|
|
301 #if defined (STM32F407xx) || defined (STM32F417xx)
|
|
302 /**
|
|
303 * @brief AF 0 selection
|
|
304 */
|
|
305 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
|
|
306 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
|
|
307 #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
|
|
308 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
|
|
309 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
|
|
310
|
|
311 /**
|
|
312 * @brief AF 1 selection
|
|
313 */
|
|
314 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
|
|
315 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
|
|
316
|
|
317 /**
|
|
318 * @brief AF 2 selection
|
|
319 */
|
|
320 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
|
|
321 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
|
|
322 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
|
|
323
|
|
324 /**
|
|
325 * @brief AF 3 selection
|
|
326 */
|
|
327 #define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */
|
|
328 #define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */
|
|
329 #define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */
|
|
330 #define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */
|
|
331
|
|
332 /**
|
|
333 * @brief AF 4 selection
|
|
334 */
|
|
335 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
|
|
336 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
|
|
337 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */
|
|
338
|
|
339 /**
|
|
340 * @brief AF 5 selection
|
|
341 */
|
|
342 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */
|
|
343 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */
|
|
344 #define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */
|
|
345
|
|
346 /**
|
|
347 * @brief AF 6 selection
|
|
348 */
|
|
349 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */
|
|
350 #define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */
|
|
351
|
|
352 /**
|
|
353 * @brief AF 7 selection
|
|
354 */
|
|
355 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
|
|
356 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
|
|
357 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */
|
|
358 #define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */
|
|
359
|
|
360 /**
|
|
361 * @brief AF 8 selection
|
|
362 */
|
|
363 #define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */
|
|
364 #define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */
|
|
365 #define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */
|
|
366
|
|
367 /**
|
|
368 * @brief AF 9 selection
|
|
369 */
|
|
370 #define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */
|
|
371 #define GPIO_AF9_CAN2 ((uint8_t)0x09) /* CAN2 Alternate Function mapping */
|
|
372 #define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */
|
|
373 #define GPIO_AF9_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */
|
|
374 #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */
|
|
375
|
|
376 /**
|
|
377 * @brief AF 10 selection
|
|
378 */
|
|
379 #define GPIO_AF10_OTG_FS ((uint8_t)0xA) /* OTG_FS Alternate Function mapping */
|
|
380 #define GPIO_AF10_OTG_HS ((uint8_t)0xA) /* OTG_HS Alternate Function mapping */
|
|
381
|
|
382 /**
|
|
383 * @brief AF 11 selection
|
|
384 */
|
|
385 #define GPIO_AF11_ETH ((uint8_t)0x0B) /* ETHERNET Alternate Function mapping */
|
|
386
|
|
387 /**
|
|
388 * @brief AF 12 selection
|
|
389 */
|
|
390 #define GPIO_AF12_FSMC ((uint8_t)0xC) /* FSMC Alternate Function mapping */
|
|
391 #define GPIO_AF12_OTG_HS_FS ((uint8_t)0xC) /* OTG HS configured in FS, Alternate Function mapping */
|
|
392 #define GPIO_AF12_SDIO ((uint8_t)0xC) /* SDIO Alternate Function mapping */
|
|
393
|
|
394 /**
|
|
395 * @brief AF 13 selection
|
|
396 */
|
|
397 #define GPIO_AF13_DCMI ((uint8_t)0x0D) /* DCMI Alternate Function mapping */
|
|
398
|
|
399 /**
|
|
400 * @brief AF 15 selection
|
|
401 */
|
|
402 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
|
|
403 #endif /* STM32F407xx || STM32F417xx */
|
|
404 /*------------------------------------------------------------------------------------------*/
|
|
405
|
|
406 /*---------------------------------- STM32F405xx/STM32F415xx--------------------------------*/
|
|
407 #if defined (STM32F405xx) || defined (STM32F415xx)
|
|
408 /**
|
|
409 * @brief AF 0 selection
|
|
410 */
|
|
411 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
|
|
412 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
|
|
413 #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
|
|
414 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
|
|
415 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
|
|
416
|
|
417 /**
|
|
418 * @brief AF 1 selection
|
|
419 */
|
|
420 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
|
|
421 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
|
|
422
|
|
423 /**
|
|
424 * @brief AF 2 selection
|
|
425 */
|
|
426 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
|
|
427 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
|
|
428 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
|
|
429
|
|
430 /**
|
|
431 * @brief AF 3 selection
|
|
432 */
|
|
433 #define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */
|
|
434 #define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */
|
|
435 #define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */
|
|
436 #define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */
|
|
437
|
|
438 /**
|
|
439 * @brief AF 4 selection
|
|
440 */
|
|
441 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
|
|
442 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
|
|
443 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */
|
|
444
|
|
445 /**
|
|
446 * @brief AF 5 selection
|
|
447 */
|
|
448 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */
|
|
449 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */
|
|
450 #define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */
|
|
451
|
|
452 /**
|
|
453 * @brief AF 6 selection
|
|
454 */
|
|
455 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */
|
|
456 #define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */
|
|
457
|
|
458 /**
|
|
459 * @brief AF 7 selection
|
|
460 */
|
|
461 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
|
|
462 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
|
|
463 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */
|
|
464 #define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */
|
|
465
|
|
466 /**
|
|
467 * @brief AF 8 selection
|
|
468 */
|
|
469 #define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */
|
|
470 #define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */
|
|
471 #define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */
|
|
472
|
|
473 /**
|
|
474 * @brief AF 9 selection
|
|
475 */
|
|
476 #define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */
|
|
477 #define GPIO_AF9_CAN2 ((uint8_t)0x09) /* CAN2 Alternate Function mapping */
|
|
478 #define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */
|
|
479 #define GPIO_AF9_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */
|
|
480 #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */
|
|
481
|
|
482 /**
|
|
483 * @brief AF 10 selection
|
|
484 */
|
|
485 #define GPIO_AF10_OTG_FS ((uint8_t)0xA) /* OTG_FS Alternate Function mapping */
|
|
486 #define GPIO_AF10_OTG_HS ((uint8_t)0xA) /* OTG_HS Alternate Function mapping */
|
|
487
|
|
488 /**
|
|
489 * @brief AF 12 selection
|
|
490 */
|
|
491 #define GPIO_AF12_FSMC ((uint8_t)0xC) /* FSMC Alternate Function mapping */
|
|
492 #define GPIO_AF12_OTG_HS_FS ((uint8_t)0xC) /* OTG HS configured in FS, Alternate Function mapping */
|
|
493 #define GPIO_AF12_SDIO ((uint8_t)0xC) /* SDIO Alternate Function mapping */
|
|
494
|
|
495 /**
|
|
496 * @brief AF 15 selection
|
|
497 */
|
|
498 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
|
|
499 #endif /* STM32F405xx || STM32F415xx */
|
|
500
|
|
501 /*------------------------------------------------------------------------------------------*/
|
|
502
|
|
503 /*---------------------------------------- STM32F401xx--------------------------------------*/
|
|
504 #if defined(STM32F401xC) || defined(STM32F401xE)
|
|
505 /**
|
|
506 * @brief AF 0 selection
|
|
507 */
|
|
508 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
|
|
509 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
|
|
510 #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
|
|
511 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
|
|
512 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
|
|
513
|
|
514 /**
|
|
515 * @brief AF 1 selection
|
|
516 */
|
|
517 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
|
|
518 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
|
|
519
|
|
520 /**
|
|
521 * @brief AF 2 selection
|
|
522 */
|
|
523 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
|
|
524 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
|
|
525 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
|
|
526
|
|
527 /**
|
|
528 * @brief AF 3 selection
|
|
529 */
|
|
530 #define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */
|
|
531 #define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */
|
|
532 #define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */
|
|
533
|
|
534 /**
|
|
535 * @brief AF 4 selection
|
|
536 */
|
|
537 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
|
|
538 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
|
|
539 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */
|
|
540
|
|
541 /**
|
|
542 * @brief AF 5 selection
|
|
543 */
|
|
544 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */
|
|
545 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */
|
|
546 #define GPIO_AF5_SPI4 ((uint8_t)0x05) /* SPI4 Alternate Function mapping */
|
|
547 #define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */
|
|
548
|
|
549 /**
|
|
550 * @brief AF 6 selection
|
|
551 */
|
|
552 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */
|
|
553 #define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */
|
|
554
|
|
555 /**
|
|
556 * @brief AF 7 selection
|
|
557 */
|
|
558 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
|
|
559 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
|
|
560 #define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */
|
|
561
|
|
562 /**
|
|
563 * @brief AF 8 selection
|
|
564 */
|
|
565 #define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */
|
|
566
|
|
567 /**
|
|
568 * @brief AF 9 selection
|
|
569 */
|
|
570 #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */
|
|
571 #define GPIO_AF9_I2C2 ((uint8_t)0x09) /* I2C2 Alternate Function mapping */
|
|
572 #define GPIO_AF9_I2C3 ((uint8_t)0x09) /* I2C3 Alternate Function mapping */
|
|
573
|
|
574
|
|
575 /**
|
|
576 * @brief AF 10 selection
|
|
577 */
|
|
578 #define GPIO_AF10_OTG_FS ((uint8_t)0xA) /* OTG_FS Alternate Function mapping */
|
|
579
|
|
580 /**
|
|
581 * @brief AF 12 selection
|
|
582 */
|
|
583 #define GPIO_AF12_SDIO ((uint8_t)0xC) /* SDIO Alternate Function mapping */
|
|
584
|
|
585 /**
|
|
586 * @brief AF 15 selection
|
|
587 */
|
|
588 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
|
|
589 #endif /* STM32F401xC || STM32F401xE */
|
|
590 /*------------------------------------------------------------------------------------------*/
|
|
591
|
|
592 /*---------------------------------------- STM32F411xx--------------------------------------*/
|
|
593 #if defined(STM32F411xE)
|
|
594 /**
|
|
595 * @brief AF 0 selection
|
|
596 */
|
|
597 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
|
|
598 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
|
|
599 #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
|
|
600 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
|
|
601 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
|
|
602
|
|
603 /**
|
|
604 * @brief AF 1 selection
|
|
605 */
|
|
606 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
|
|
607 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
|
|
608
|
|
609 /**
|
|
610 * @brief AF 2 selection
|
|
611 */
|
|
612 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
|
|
613 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
|
|
614 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
|
|
615
|
|
616 /**
|
|
617 * @brief AF 3 selection
|
|
618 */
|
|
619 #define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */
|
|
620 #define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */
|
|
621 #define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */
|
|
622
|
|
623 /**
|
|
624 * @brief AF 4 selection
|
|
625 */
|
|
626 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
|
|
627 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
|
|
628 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */
|
|
629
|
|
630 /**
|
|
631 * @brief AF 5 selection
|
|
632 */
|
|
633 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1/I2S1 Alternate Function mapping */
|
|
634 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */
|
|
635 #define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3/I2S3 Alternate Function mapping */
|
|
636 #define GPIO_AF5_SPI4 ((uint8_t)0x05) /* SPI4 Alternate Function mapping */
|
|
637 #define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */
|
|
638
|
|
639 /**
|
|
640 * @brief AF 6 selection
|
|
641 */
|
|
642 #define GPIO_AF6_SPI2 ((uint8_t)0x06) /* I2S2 Alternate Function mapping */
|
|
643 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */
|
|
644 #define GPIO_AF6_SPI4 ((uint8_t)0x06) /* SPI4/I2S4 Alternate Function mapping */
|
|
645 #define GPIO_AF6_SPI5 ((uint8_t)0x06) /* SPI5/I2S5 Alternate Function mapping */
|
|
646 #define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */
|
|
647 /**
|
|
648 * @brief AF 7 selection
|
|
649 */
|
|
650 #define GPIO_AF7_SPI3 ((uint8_t)0x07) /* SPI3/I2S3 Alternate Function mapping */
|
|
651 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
|
|
652 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
|
|
653 #define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */
|
|
654
|
|
655 /**
|
|
656 * @brief AF 8 selection
|
|
657 */
|
|
658 #define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */
|
|
659
|
|
660 /**
|
|
661 * @brief AF 9 selection
|
|
662 */
|
|
663 #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */
|
|
664 #define GPIO_AF9_I2C2 ((uint8_t)0x09) /* I2C2 Alternate Function mapping */
|
|
665 #define GPIO_AF9_I2C3 ((uint8_t)0x09) /* I2C3 Alternate Function mapping */
|
|
666
|
|
667
|
|
668 /**
|
|
669 * @brief AF 10 selection
|
|
670 */
|
|
671 #define GPIO_AF10_OTG_FS ((uint8_t)0xA) /* OTG_FS Alternate Function mapping */
|
|
672
|
|
673 /**
|
|
674 * @brief AF 12 selection
|
|
675 */
|
|
676 #define GPIO_AF12_SDIO ((uint8_t)0xC) /* SDIO Alternate Function mapping */
|
|
677
|
|
678 /**
|
|
679 * @brief AF 15 selection
|
|
680 */
|
|
681 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
|
|
682 #endif /* STM32F411xE */
|
|
683 /**
|
|
684 * @}
|
|
685 */
|
|
686
|
|
687 /**
|
|
688 * @}
|
|
689 */
|
|
690
|
|
691 /* Exported macro ------------------------------------------------------------*/
|
|
692 /** @addtogroup GPIO_Exported_Macros
|
|
693 * @{
|
|
694 */
|
|
695 /**
|
|
696 * @}
|
|
697 */
|
|
698
|
|
699 /* Exported functions --------------------------------------------------------*/
|
|
700 /** @addtogroup GPIO_Exported_Functions
|
|
701 * @{
|
|
702 */
|
|
703 /**
|
|
704 * @}
|
|
705 */
|
|
706
|
|
707 /* Private types -------------------------------------------------------------*/
|
|
708 /* Private variables ---------------------------------------------------------*/
|
|
709 /* Private constants ---------------------------------------------------------*/
|
|
710 /** @addtogroup GPIO_Private_Constants
|
|
711 * @{
|
|
712 */
|
|
713 /**
|
|
714 * @}
|
|
715 */
|
|
716
|
|
717 /* Private macros ------------------------------------------------------------*/
|
|
718 /** @addtogroup GPIO_Private_Macros
|
|
719 * @{
|
|
720 */
|
|
721 /** @defgroup GPIO_Get_Port_Index GPIO Get Port Index
|
|
722 * @{
|
|
723 */
|
|
724 #if defined (STM32F405xx) || defined (STM32F415xx) || defined (STM32F407xx) || defined (STM32F417xx)
|
|
725 #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
|
|
726 ((__GPIOx__) == (GPIOB))? 1U :\
|
|
727 ((__GPIOx__) == (GPIOC))? 2U :\
|
|
728 ((__GPIOx__) == (GPIOD))? 3U :\
|
|
729 ((__GPIOx__) == (GPIOE))? 4U :\
|
|
730 ((__GPIOx__) == (GPIOF))? 5U :\
|
|
731 ((__GPIOx__) == (GPIOG))? 6U :\
|
|
732 ((__GPIOx__) == (GPIOH))? 7U :\
|
|
733 ((__GPIOx__) == (GPIOI))? 8U : 9U)
|
|
734 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */
|
|
735
|
|
736 #if defined (STM32F427xx) || defined (STM32F437xx) || defined (STM32F429xx) || defined (STM32F439xx)
|
|
737 #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
|
|
738 ((__GPIOx__) == (GPIOB))? 1U :\
|
|
739 ((__GPIOx__) == (GPIOC))? 2U :\
|
|
740 ((__GPIOx__) == (GPIOD))? 3U :\
|
|
741 ((__GPIOx__) == (GPIOE))? 4U :\
|
|
742 ((__GPIOx__) == (GPIOF))? 5U :\
|
|
743 ((__GPIOx__) == (GPIOG))? 6U :\
|
|
744 ((__GPIOx__) == (GPIOH))? 7U :\
|
|
745 ((__GPIOx__) == (GPIOI))? 8U :\
|
|
746 ((__GPIOx__) == (GPIOJ))? 9U : 10U)
|
|
747 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
|
|
748
|
|
749 #if defined (STM32F401xC) || defined (STM32F401xE) || defined (STM32F411xE)
|
|
750 #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
|
|
751 ((__GPIOx__) == (GPIOB))? 1U :\
|
|
752 ((__GPIOx__) == (GPIOC))? 2U :\
|
|
753 ((__GPIOx__) == (GPIOD))? 3U :\
|
|
754 ((__GPIOx__) == (GPIOE))? 4U : 5U)
|
|
755 #endif /* STM32F401xC || STM32F401xE || STM32F411xE */
|
|
756
|
|
757 /**
|
|
758 * @}
|
|
759 */
|
|
760
|
|
761 /** @defgroup GPIO_IS_Alternate_function_selection GPIO Check Alternate Function
|
|
762 * @{
|
|
763 */
|
|
764 /*------------------------- STM32F429xx/STM32F439xx---------------------------*/
|
|
765 #if defined (STM32F429xx) || defined (STM32F439xx)
|
|
766 #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \
|
|
767 ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \
|
|
768 ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
|
|
769 ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \
|
|
770 ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
|
|
771 ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \
|
|
772 ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \
|
|
773 ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF5_SPI1) || \
|
|
774 ((AF) == GPIO_AF5_SPI2) || ((AF) == GPIO_AF9_TIM13) || \
|
|
775 ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF9_TIM12) || \
|
|
776 ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
|
|
777 ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF8_UART4) || \
|
|
778 ((AF) == GPIO_AF8_UART5) || ((AF) == GPIO_AF8_USART6) || \
|
|
779 ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \
|
|
780 ((AF) == GPIO_AF10_OTG_FS) || ((AF) == GPIO_AF10_OTG_HS) || \
|
|
781 ((AF) == GPIO_AF11_ETH) || ((AF) == GPIO_AF12_OTG_HS_FS) || \
|
|
782 ((AF) == GPIO_AF12_SDIO) || ((AF) == GPIO_AF13_DCMI) || \
|
|
783 ((AF) == GPIO_AF15_EVENTOUT) || ((AF) == GPIO_AF5_SPI4) || \
|
|
784 ((AF) == GPIO_AF5_SPI5) || ((AF) == GPIO_AF5_SPI6) || \
|
|
785 ((AF) == GPIO_AF8_UART7) || ((AF) == GPIO_AF8_UART8) || \
|
|
786 ((AF) == GPIO_AF12_FMC) || ((AF) == GPIO_AF6_SAI1) || \
|
|
787 ((AF) == GPIO_AF14_LTDC))
|
|
788
|
|
789 #endif /* STM32F429xx || STM32F439xx */
|
|
790 /*------------------------------------------------------------------------------------------*/
|
|
791
|
|
792 /*---------------------------------- STM32F427xx/STM32F437xx--------------------------------*/
|
|
793 #if defined (STM32F427xx) || defined (STM32F437xx)
|
|
794 #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \
|
|
795 ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \
|
|
796 ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
|
|
797 ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \
|
|
798 ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
|
|
799 ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \
|
|
800 ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \
|
|
801 ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF5_SPI1) || \
|
|
802 ((AF) == GPIO_AF5_SPI2) || ((AF) == GPIO_AF9_TIM13) || \
|
|
803 ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF9_TIM12) || \
|
|
804 ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
|
|
805 ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF8_UART4) || \
|
|
806 ((AF) == GPIO_AF8_UART5) || ((AF) == GPIO_AF8_USART6) || \
|
|
807 ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \
|
|
808 ((AF) == GPIO_AF10_OTG_FS) || ((AF) == GPIO_AF10_OTG_HS) || \
|
|
809 ((AF) == GPIO_AF11_ETH) || ((AF) == GPIO_AF12_OTG_HS_FS) || \
|
|
810 ((AF) == GPIO_AF12_SDIO) || ((AF) == GPIO_AF13_DCMI) || \
|
|
811 ((AF) == GPIO_AF15_EVENTOUT) || ((AF) == GPIO_AF5_SPI4) || \
|
|
812 ((AF) == GPIO_AF5_SPI5) || ((AF) == GPIO_AF5_SPI6) || \
|
|
813 ((AF) == GPIO_AF8_UART7) || ((AF) == GPIO_AF8_UART8) || \
|
|
814 ((AF) == GPIO_AF12_FMC) || ((AF) == GPIO_AF6_SAI1))
|
|
815
|
|
816 #endif /* STM32F427xx || STM32F437xx */
|
|
817 /*------------------------------------------------------------------------------------------*/
|
|
818
|
|
819 /*---------------------------------- STM32F407xx/STM32F417xx--------------------------------*/
|
|
820 #if defined (STM32F407xx) || defined (STM32F417xx)
|
|
821 #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \
|
|
822 ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \
|
|
823 ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
|
|
824 ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \
|
|
825 ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
|
|
826 ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \
|
|
827 ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \
|
|
828 ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF5_SPI1) || \
|
|
829 ((AF) == GPIO_AF5_SPI2) || ((AF) == GPIO_AF9_TIM13) || \
|
|
830 ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF9_TIM12) || \
|
|
831 ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
|
|
832 ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF8_UART4) || \
|
|
833 ((AF) == GPIO_AF8_UART5) || ((AF) == GPIO_AF8_USART6) || \
|
|
834 ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \
|
|
835 ((AF) == GPIO_AF10_OTG_FS) || ((AF) == GPIO_AF10_OTG_HS) || \
|
|
836 ((AF) == GPIO_AF11_ETH) || ((AF) == GPIO_AF12_OTG_HS_FS) || \
|
|
837 ((AF) == GPIO_AF12_SDIO) || ((AF) == GPIO_AF13_DCMI) || \
|
|
838 ((AF) == GPIO_AF12_FSMC) || ((AF) == GPIO_AF15_EVENTOUT))
|
|
839
|
|
840 #endif /* STM32F407xx || STM32F417xx */
|
|
841 /*------------------------------------------------------------------------------------------*/
|
|
842
|
|
843 /*---------------------------------- STM32F405xx/STM32F415xx--------------------------------*/
|
|
844 #if defined (STM32F405xx) || defined (STM32F415xx)
|
|
845 #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \
|
|
846 ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \
|
|
847 ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
|
|
848 ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \
|
|
849 ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
|
|
850 ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \
|
|
851 ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \
|
|
852 ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF5_SPI1) || \
|
|
853 ((AF) == GPIO_AF5_SPI2) || ((AF) == GPIO_AF9_TIM13) || \
|
|
854 ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF9_TIM12) || \
|
|
855 ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
|
|
856 ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF8_UART4) || \
|
|
857 ((AF) == GPIO_AF8_UART5) || ((AF) == GPIO_AF8_USART6) || \
|
|
858 ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \
|
|
859 ((AF) == GPIO_AF10_OTG_FS) || ((AF) == GPIO_AF10_OTG_HS) || \
|
|
860 ((AF) == GPIO_AF12_OTG_HS_FS) || ((AF) == GPIO_AF12_SDIO) || \
|
|
861 ((AF) == GPIO_AF12_FSMC) || ((AF) == GPIO_AF15_EVENTOUT))
|
|
862
|
|
863 #endif /* STM32F405xx || STM32F415xx */
|
|
864
|
|
865 /*------------------------------------------------------------------------------------------*/
|
|
866
|
|
867 /*---------------------------------------- STM32F401xx--------------------------------------*/
|
|
868 #if defined(STM32F401xC) || defined(STM32F401xE)
|
|
869 #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \
|
|
870 ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \
|
|
871 ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
|
|
872 ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \
|
|
873 ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
|
|
874 ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF4_I2C1) || \
|
|
875 ((AF) == GPIO_AF4_I2C2) || ((AF) == GPIO_AF4_I2C3) || \
|
|
876 ((AF) == GPIO_AF5_SPI1) || ((AF) == GPIO_AF5_SPI2) || \
|
|
877 ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF5_SPI4) || \
|
|
878 ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
|
|
879 ((AF) == GPIO_AF8_USART6) || ((AF) == GPIO_AF10_OTG_FS) || \
|
|
880 ((AF) == GPIO_AF9_I2C2) || ((AF) == GPIO_AF9_I2C3) || \
|
|
881 ((AF) == GPIO_AF12_SDIO) || ((AF) == GPIO_AF15_EVENTOUT))
|
|
882
|
|
883 #endif /* STM32F401xC || STM32F401xE */
|
|
884 /*------------------------------------------------------------------------------------------*/
|
|
885
|
|
886 /*---------------------------------------- STM32F411xx--------------------------------------*/
|
|
887 #if defined(STM32F411xE)
|
|
888 #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \
|
|
889 ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \
|
|
890 ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
|
|
891 ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \
|
|
892 ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
|
|
893 ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF4_I2C1) || \
|
|
894 ((AF) == GPIO_AF4_I2C2) || ((AF) == GPIO_AF4_I2C3) || \
|
|
895 ((AF) == GPIO_AF5_SPI1) || ((AF) == GPIO_AF5_SPI2) || \
|
|
896 ((AF) == GPIO_AF5_SPI3) || ((AF) == GPIO_AF6_SPI4) || \
|
|
897 ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF5_SPI4) || \
|
|
898 ((AF) == GPIO_AF6_SPI5) || ((AF) == GPIO_AF7_SPI3) || \
|
|
899 ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
|
|
900 ((AF) == GPIO_AF8_USART6) || ((AF) == GPIO_AF10_OTG_FS) || \
|
|
901 ((AF) == GPIO_AF9_I2C2) || ((AF) == GPIO_AF9_I2C3) || \
|
|
902 ((AF) == GPIO_AF12_SDIO) || ((AF) == GPIO_AF15_EVENTOUT))
|
|
903
|
|
904 #endif /* STM32F411xE */
|
|
905 /**
|
|
906 * @}
|
|
907 */
|
|
908
|
|
909 /**
|
|
910 * @}
|
|
911 */
|
|
912
|
|
913 /* Private functions ---------------------------------------------------------*/
|
|
914 /** @addtogroup GPIO_Private_Functions
|
|
915 * @{
|
|
916 */
|
|
917
|
|
918 /**
|
|
919 * @}
|
|
920 */
|
|
921
|
|
922 /**
|
|
923 * @}
|
|
924 */
|
|
925
|
|
926 /**
|
|
927 * @}
|
|
928 */
|
|
929
|
|
930 #ifdef __cplusplus
|
|
931 }
|
|
932 #endif
|
|
933
|
|
934 #endif /* __STM32F4xx_HAL_GPIO_EX_H */
|
|
935
|
|
936 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|