Prusa MINI Firmware overview
stm32f4xx_hal_gpio_ex.h
Go to the documentation of this file.
1 /**
2  ******************************************************************************
3  * @file stm32f4xx_hal_gpio_ex.h
4  * @author MCD Application Team
5  * @brief Header file of GPIO HAL Extension module.
6  ******************************************************************************
7  * @attention
8  *
9  * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
10  *
11  * Redistribution and use in source and binary forms, with or without modification,
12  * are permitted provided that the following conditions are met:
13  * 1. Redistributions of source code must retain the above copyright notice,
14  * this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  * 3. Neither the name of STMicroelectronics nor the names of its contributors
19  * may be used to endorse or promote products derived from this software
20  * without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  *
33  ******************************************************************************
34  */
35 
36 /* Define to prevent recursive inclusion -------------------------------------*/
37 #ifndef __STM32F4xx_HAL_GPIO_EX_H
38 #define __STM32F4xx_HAL_GPIO_EX_H
39 
40 #ifdef __cplusplus
41  extern "C" {
42 #endif
43 
44 /* Includes ------------------------------------------------------------------*/
45 #include "stm32f4xx_hal_def.h"
46 
47 /** @addtogroup STM32F4xx_HAL_Driver
48  * @{
49  */
50 
51 /** @defgroup GPIOEx GPIOEx
52  * @{
53  */
54 
55 /* Exported types ------------------------------------------------------------*/
56 /* Exported constants --------------------------------------------------------*/
57 /** @defgroup GPIOEx_Exported_Constants GPIO Exported Constants
58  * @{
59  */
60 
61 /** @defgroup GPIO_Alternate_function_selection GPIO Alternate Function Selection
62  * @{
63  */
64 
65 /*------------------------------------------ STM32F429xx/STM32F439xx ---------*/
66 #if defined(STM32F429xx) || defined(STM32F439xx)
67 /**
68  * @brief AF 0 selection
69  */
70 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
71 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
72 #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
73 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
74 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
75 
76 /**
77  * @brief AF 1 selection
78  */
79 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
80 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
81 
82 /**
83  * @brief AF 2 selection
84  */
85 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
86 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
87 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
88 
89 /**
90  * @brief AF 3 selection
91  */
92 #define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */
93 #define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */
94 #define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */
95 #define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */
96 
97 /**
98  * @brief AF 4 selection
99  */
100 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
101 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
102 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */
103 
104 /**
105  * @brief AF 5 selection
106  */
107 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */
108 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */
109 #define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3/I2S3 Alternate Function mapping */
110 #define GPIO_AF5_SPI4 ((uint8_t)0x05) /* SPI4 Alternate Function mapping */
111 #define GPIO_AF5_SPI5 ((uint8_t)0x05) /* SPI5 Alternate Function mapping */
112 #define GPIO_AF5_SPI6 ((uint8_t)0x05) /* SPI6 Alternate Function mapping */
113 #define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */
114 
115 /**
116  * @brief AF 6 selection
117  */
118 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */
119 #define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */
120 #define GPIO_AF6_SAI1 ((uint8_t)0x06) /* SAI1 Alternate Function mapping */
121 
122 /**
123  * @brief AF 7 selection
124  */
125 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
126 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
127 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */
128 #define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */
129 
130 /**
131  * @brief AF 8 selection
132  */
133 #define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */
134 #define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */
135 #define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */
136 #define GPIO_AF8_UART7 ((uint8_t)0x08) /* UART7 Alternate Function mapping */
137 #define GPIO_AF8_UART8 ((uint8_t)0x08) /* UART8 Alternate Function mapping */
138 
139 /**
140  * @brief AF 9 selection
141  */
142 #define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */
143 #define GPIO_AF9_CAN2 ((uint8_t)0x09) /* CAN2 Alternate Function mapping */
144 #define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */
145 #define GPIO_AF9_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */
146 #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */
147 #define GPIO_AF9_LTDC ((uint8_t)0x09) /* LCD-TFT Alternate Function mapping */
148 
149 /**
150  * @brief AF 10 selection
151  */
152 #define GPIO_AF10_OTG_FS ((uint8_t)0x0A) /* OTG_FS Alternate Function mapping */
153 #define GPIO_AF10_OTG_HS ((uint8_t)0x0A) /* OTG_HS Alternate Function mapping */
154 
155 /**
156  * @brief AF 11 selection
157  */
158 #define GPIO_AF11_ETH ((uint8_t)0x0B) /* ETHERNET Alternate Function mapping */
159 
160 /**
161  * @brief AF 12 selection
162  */
163 #define GPIO_AF12_FMC ((uint8_t)0x0C) /* FMC Alternate Function mapping */
164 #define GPIO_AF12_OTG_HS_FS ((uint8_t)0x0C) /* OTG HS configured in FS, Alternate Function mapping */
165 #define GPIO_AF12_SDIO ((uint8_t)0x0C) /* SDIO Alternate Function mapping */
166 
167 /**
168  * @brief AF 13 selection
169  */
170 #define GPIO_AF13_DCMI ((uint8_t)0x0D) /* DCMI Alternate Function mapping */
171 
172 /**
173  * @brief AF 14 selection
174  */
175 #define GPIO_AF14_LTDC ((uint8_t)0x0E) /* LCD-TFT Alternate Function mapping */
176 
177 /**
178  * @brief AF 15 selection
179  */
180 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
181 #endif /* STM32F429xx || STM32F439xx */
182 /*----------------------------------------------------------------------------*/
183 
184 /*---------------------------------- STM32F427xx/STM32F437xx------------------*/
185 #if defined(STM32F427xx) || defined(STM32F437xx)
186 /**
187  * @brief AF 0 selection
188  */
189 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
190 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
191 #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
192 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
193 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
194 
195 /**
196  * @brief AF 1 selection
197  */
198 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
199 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
200 
201 /**
202  * @brief AF 2 selection
203  */
204 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
205 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
206 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
207 
208 /**
209  * @brief AF 3 selection
210  */
211 #define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */
212 #define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */
213 #define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */
214 #define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */
215 
216 /**
217  * @brief AF 4 selection
218  */
219 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
220 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
221 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */
222 
223 /**
224  * @brief AF 5 selection
225  */
226 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */
227 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */
228 #define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3/I2S3 Alternate Function mapping */
229 #define GPIO_AF5_SPI4 ((uint8_t)0x05) /* SPI4 Alternate Function mapping */
230 #define GPIO_AF5_SPI5 ((uint8_t)0x05) /* SPI5 Alternate Function mapping */
231 #define GPIO_AF5_SPI6 ((uint8_t)0x05) /* SPI6 Alternate Function mapping */
232 /** @brief GPIO_Legacy
233  */
234 #define GPIO_AF5_I2S3ext GPIO_AF5_SPI3 /* I2S3ext_SD Alternate Function mapping */
235 
236 /**
237  * @brief AF 6 selection
238  */
239 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */
240 #define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */
241 #define GPIO_AF6_SAI1 ((uint8_t)0x06) /* SAI1 Alternate Function mapping */
242 
243 /**
244  * @brief AF 7 selection
245  */
246 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
247 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
248 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */
249 #define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */
250 
251 /**
252  * @brief AF 8 selection
253  */
254 #define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */
255 #define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */
256 #define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */
257 #define GPIO_AF8_UART7 ((uint8_t)0x08) /* UART7 Alternate Function mapping */
258 #define GPIO_AF8_UART8 ((uint8_t)0x08) /* UART8 Alternate Function mapping */
259 
260 /**
261  * @brief AF 9 selection
262  */
263 #define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */
264 #define GPIO_AF9_CAN2 ((uint8_t)0x09) /* CAN2 Alternate Function mapping */
265 #define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */
266 #define GPIO_AF9_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */
267 #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */
268 
269 /**
270  * @brief AF 10 selection
271  */
272 #define GPIO_AF10_OTG_FS ((uint8_t)0x0A) /* OTG_FS Alternate Function mapping */
273 #define GPIO_AF10_OTG_HS ((uint8_t)0x0A) /* OTG_HS Alternate Function mapping */
274 
275 /**
276  * @brief AF 11 selection
277  */
278 #define GPIO_AF11_ETH ((uint8_t)0x0B) /* ETHERNET Alternate Function mapping */
279 
280 /**
281  * @brief AF 12 selection
282  */
283 #define GPIO_AF12_FMC ((uint8_t)0x0C) /* FMC Alternate Function mapping */
284 #define GPIO_AF12_OTG_HS_FS ((uint8_t)0x0C) /* OTG HS configured in FS, Alternate Function mapping */
285 #define GPIO_AF12_SDIO ((uint8_t)0x0C) /* SDIO Alternate Function mapping */
286 
287 /**
288  * @brief AF 13 selection
289  */
290 #define GPIO_AF13_DCMI ((uint8_t)0x0D) /* DCMI Alternate Function mapping */
291 
292 /**
293  * @brief AF 15 selection
294  */
295 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
296 #endif /* STM32F427xx || STM32F437xx */
297 /*----------------------------------------------------------------------------*/
298 
299 /*---------------------------------- STM32F407xx/STM32F417xx------------------*/
300 #if defined(STM32F407xx) || defined(STM32F417xx)
301 /**
302  * @brief AF 0 selection
303  */
304 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
305 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
306 #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
307 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
308 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
309 
310 /**
311  * @brief AF 1 selection
312  */
313 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
314 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
315 
316 /**
317  * @brief AF 2 selection
318  */
319 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
320 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
321 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
322 
323 /**
324  * @brief AF 3 selection
325  */
326 #define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */
327 #define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */
328 #define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */
329 #define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */
330 
331 /**
332  * @brief AF 4 selection
333  */
334 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
335 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
336 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */
337 
338 /**
339  * @brief AF 5 selection
340  */
341 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */
342 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */
343 #define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */
344 
345 /**
346  * @brief AF 6 selection
347  */
348 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */
349 #define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */
350 
351 /**
352  * @brief AF 7 selection
353  */
354 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
355 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
356 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */
357 #define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */
358 
359 /**
360  * @brief AF 8 selection
361  */
362 #define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */
363 #define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */
364 #define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */
365 
366 /**
367  * @brief AF 9 selection
368  */
369 #define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */
370 #define GPIO_AF9_CAN2 ((uint8_t)0x09) /* CAN2 Alternate Function mapping */
371 #define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */
372 #define GPIO_AF9_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */
373 #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */
374 
375 /**
376  * @brief AF 10 selection
377  */
378 #define GPIO_AF10_OTG_FS ((uint8_t)0x0A) /* OTG_FS Alternate Function mapping */
379 #define GPIO_AF10_OTG_HS ((uint8_t)0x0A) /* OTG_HS Alternate Function mapping */
380 
381 /**
382  * @brief AF 11 selection
383  */
384 #define GPIO_AF11_ETH ((uint8_t)0x0B) /* ETHERNET Alternate Function mapping */
385 
386 /**
387  * @brief AF 12 selection
388  */
389 #define GPIO_AF12_FSMC ((uint8_t)0x0C) /* FSMC Alternate Function mapping */
390 #define GPIO_AF12_OTG_HS_FS ((uint8_t)0x0C) /* OTG HS configured in FS, Alternate Function mapping */
391 #define GPIO_AF12_SDIO ((uint8_t)0x0C) /* SDIO Alternate Function mapping */
392 
393 /**
394  * @brief AF 13 selection
395  */
396 #define GPIO_AF13_DCMI ((uint8_t)0x0D) /* DCMI Alternate Function mapping */
397 
398 /**
399  * @brief AF 15 selection
400  */
401 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
402 #endif /* STM32F407xx || STM32F417xx */
403 /*----------------------------------------------------------------------------*/
404 
405 /*---------------------------------- STM32F405xx/STM32F415xx------------------*/
406 #if defined(STM32F405xx) || defined(STM32F415xx)
407 /**
408  * @brief AF 0 selection
409  */
410 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
411 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
412 #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
413 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
414 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
415 
416 /**
417  * @brief AF 1 selection
418  */
419 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
420 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
421 
422 /**
423  * @brief AF 2 selection
424  */
425 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
426 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
427 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
428 
429 /**
430  * @brief AF 3 selection
431  */
432 #define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */
433 #define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */
434 #define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */
435 #define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */
436 
437 /**
438  * @brief AF 4 selection
439  */
440 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
441 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
442 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */
443 
444 /**
445  * @brief AF 5 selection
446  */
447 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */
448 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */
449 #define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */
450 
451 /**
452  * @brief AF 6 selection
453  */
454 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */
455 #define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */
456 
457 /**
458  * @brief AF 7 selection
459  */
460 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
461 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
462 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */
463 #define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */
464 
465 /**
466  * @brief AF 8 selection
467  */
468 #define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */
469 #define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */
470 #define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */
471 
472 /**
473  * @brief AF 9 selection
474  */
475 #define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */
476 #define GPIO_AF9_CAN2 ((uint8_t)0x09) /* CAN2 Alternate Function mapping */
477 #define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */
478 #define GPIO_AF9_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */
479 #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */
480 
481 /**
482  * @brief AF 10 selection
483  */
484 #define GPIO_AF10_OTG_FS ((uint8_t)0x0A) /* OTG_FS Alternate Function mapping */
485 #define GPIO_AF10_OTG_HS ((uint8_t)0x0A) /* OTG_HS Alternate Function mapping */
486 
487 /**
488  * @brief AF 12 selection
489  */
490 #define GPIO_AF12_FSMC ((uint8_t)0x0C) /* FSMC Alternate Function mapping */
491 #define GPIO_AF12_OTG_HS_FS ((uint8_t)0x0C) /* OTG HS configured in FS, Alternate Function mapping */
492 #define GPIO_AF12_SDIO ((uint8_t)0x0C) /* SDIO Alternate Function mapping */
493 
494 /**
495  * @brief AF 15 selection
496  */
497 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
498 #endif /* STM32F405xx || STM32F415xx */
499 
500 /*----------------------------------------------------------------------------*/
501 
502 /*---------------------------------------- STM32F401xx------------------------*/
503 #if defined(STM32F401xC) || defined(STM32F401xE)
504 /**
505  * @brief AF 0 selection
506  */
507 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
508 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
509 #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
510 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
511 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
512 
513 /**
514  * @brief AF 1 selection
515  */
516 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
517 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
518 
519 /**
520  * @brief AF 2 selection
521  */
522 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
523 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
524 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
525 
526 /**
527  * @brief AF 3 selection
528  */
529 #define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */
530 #define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */
531 #define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */
532 
533 /**
534  * @brief AF 4 selection
535  */
536 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
537 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
538 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */
539 
540 /**
541  * @brief AF 5 selection
542  */
543 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */
544 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */
545 #define GPIO_AF5_SPI4 ((uint8_t)0x05) /* SPI4 Alternate Function mapping */
546 #define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */
547 
548 /**
549  * @brief AF 6 selection
550  */
551 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */
552 #define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */
553 
554 /**
555  * @brief AF 7 selection
556  */
557 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
558 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
559 #define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */
560 
561 /**
562  * @brief AF 8 selection
563  */
564 #define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */
565 
566 /**
567  * @brief AF 9 selection
568  */
569 #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */
570 #define GPIO_AF9_I2C2 ((uint8_t)0x09) /* I2C2 Alternate Function mapping */
571 #define GPIO_AF9_I2C3 ((uint8_t)0x09) /* I2C3 Alternate Function mapping */
572 
573 
574 /**
575  * @brief AF 10 selection
576  */
577 #define GPIO_AF10_OTG_FS ((uint8_t)0x0A) /* OTG_FS Alternate Function mapping */
578 
579 /**
580  * @brief AF 12 selection
581  */
582 #define GPIO_AF12_SDIO ((uint8_t)0x0C) /* SDIO Alternate Function mapping */
583 
584 /**
585  * @brief AF 15 selection
586  */
587 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
588 #endif /* STM32F401xC || STM32F401xE */
589 /*----------------------------------------------------------------------------*/
590 
591 /*--------------- STM32F412Zx/STM32F412Vx/STM32F412Rx/STM32F412Cx-------------*/
592 #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx)
593 /**
594  * @brief AF 0 selection
595  */
596 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
597 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
598 #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
599 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
600 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
601 
602 /**
603  * @brief AF 1 selection
604  */
605 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
606 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
607 
608 /**
609  * @brief AF 2 selection
610  */
611 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
612 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
613 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
614 
615 /**
616  * @brief AF 3 selection
617  */
618 #define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */
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 #define GPIO_AF4_FMPI2C1 ((uint8_t)0x04) /* FMPI2C1 Alternate Function mapping */
630 
631 /**
632  * @brief AF 5 selection
633  */
634 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1/I2S1 Alternate Function mapping */
635 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */
636 #define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3/I2S3 Alternate Function mapping */
637 #define GPIO_AF5_SPI4 ((uint8_t)0x05) /* SPI4/I2S4 Alternate Function mapping */
638 #define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */
639 
640 /**
641  * @brief AF 6 selection
642  */
643 #define GPIO_AF6_SPI2 ((uint8_t)0x06) /* I2S2 Alternate Function mapping */
644 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */
645 #define GPIO_AF6_SPI4 ((uint8_t)0x06) /* SPI4/I2S4 Alternate Function mapping */
646 #define GPIO_AF6_SPI5 ((uint8_t)0x06) /* SPI5/I2S5 Alternate Function mapping */
647 #define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */
648 #define GPIO_AF6_DFSDM1 ((uint8_t)0x06) /* DFSDM1 Alternate Function mapping */
649 /**
650  * @brief AF 7 selection
651  */
652 #define GPIO_AF7_SPI3 ((uint8_t)0x07) /* SPI3/I2S3 Alternate Function mapping */
653 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
654 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
655 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */
656 #define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */
657 
658 /**
659  * @brief AF 8 selection
660  */
661 #define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */
662 #define GPIO_AF8_USART3 ((uint8_t)0x08) /* USART3 Alternate Function mapping */
663 #define GPIO_AF8_DFSDM1 ((uint8_t)0x08) /* DFSDM1 Alternate Function mapping */
664 #define GPIO_AF8_CAN1 ((uint8_t)0x08) /* CAN1 Alternate Function mapping */
665 
666 /**
667  * @brief AF 9 selection
668  */
669 #define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */
670 #define GPIO_AF9_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */
671 #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */
672 #define GPIO_AF9_I2C2 ((uint8_t)0x09) /* I2C2 Alternate Function mapping */
673 #define GPIO_AF9_I2C3 ((uint8_t)0x09) /* I2C3 Alternate Function mapping */
674 #define GPIO_AF9_FMPI2C1 ((uint8_t)0x09) /* FMPI2C1 Alternate Function mapping */
675 #define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */
676 #define GPIO_AF9_CAN2 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */
677 #define GPIO_AF9_QSPI ((uint8_t)0x09) /* QSPI Alternate Function mapping */
678 
679 /**
680  * @brief AF 10 selection
681  */
682 #define GPIO_AF10_OTG_FS ((uint8_t)0x0A) /* OTG_FS Alternate Function mapping */
683 #define GPIO_AF10_DFSDM1 ((uint8_t)0x0A) /* DFSDM1 Alternate Function mapping */
684 #define GPIO_AF10_QSPI ((uint8_t)0x0A) /* QSPI Alternate Function mapping */
685 #define GPIO_AF10_FMC ((uint8_t)0x0A) /* FMC Alternate Function mapping */
686 
687 /**
688  * @brief AF 12 selection
689  */
690 #define GPIO_AF12_SDIO ((uint8_t)0x0C) /* SDIO Alternate Function mapping */
691 #define GPIO_AF12_FSMC ((uint8_t)0x0C) /* FMC Alternate Function mapping */
692 
693 /**
694  * @brief AF 15 selection
695  */
696 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
697 #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */
698 
699 /*----------------------------------------------------------------------------*/
700 
701 /*--------------- STM32F413xx/STM32F423xx-------------------------------------*/
702 #if defined(STM32F413xx) || defined(STM32F423xx)
703 /**
704  * @brief AF 0 selection
705  */
706 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
707 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
708 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
709 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
710 
711 /**
712  * @brief AF 1 selection
713  */
714 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
715 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
716 #define GPIO_AF1_LPTIM1 ((uint8_t)0x01) /* LPTIM1 Alternate Function mapping */
717 
718 /**
719  * @brief AF 2 selection
720  */
721 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
722 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
723 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
724 
725 /**
726  * @brief AF 3 selection
727  */
728 #define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */
729 #define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */
730 #define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */
731 #define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */
732 #define GPIO_AF3_DFSDM2 ((uint8_t)0x03) /* DFSDM2 Alternate Function mapping */
733 
734 /**
735  * @brief AF 4 selection
736  */
737 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
738 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
739 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */
740 #define GPIO_AF4_FMPI2C1 ((uint8_t)0x04) /* FMPI2C1 Alternate Function mapping */
741 
742 /**
743  * @brief AF 5 selection
744  */
745 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1/I2S1 Alternate Function mapping */
746 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */
747 #define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3/I2S3 Alternate Function mapping */
748 #define GPIO_AF5_SPI4 ((uint8_t)0x05) /* SPI4/I2S4 Alternate Function mapping */
749 #define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */
750 
751 /**
752  * @brief AF 6 selection
753  */
754 #define GPIO_AF6_SPI2 ((uint8_t)0x06) /* I2S2 Alternate Function mapping */
755 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */
756 #define GPIO_AF6_SPI4 ((uint8_t)0x06) /* SPI4/I2S4 Alternate Function mapping */
757 #define GPIO_AF6_SPI5 ((uint8_t)0x06) /* SPI5/I2S5 Alternate Function mapping */
758 #define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */
759 #define GPIO_AF6_DFSDM1 ((uint8_t)0x06) /* DFSDM1 Alternate Function mapping */
760 #define GPIO_AF6_DFSDM2 ((uint8_t)0x06) /* DFSDM2 Alternate Function mapping */
761 /**
762  * @brief AF 7 selection
763  */
764 #define GPIO_AF7_SPI3 ((uint8_t)0x07) /* SPI3/I2S3 Alternate Function mapping */
765 #define GPIO_AF7_SAI1 ((uint8_t)0x07) /* SAI1 Alternate Function mapping */
766 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
767 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
768 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */
769 #define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */
770 #define GPIO_AF7_DFSDM2 ((uint8_t)0x07) /* DFSDM2 Alternate Function mapping */
771 
772 /**
773  * @brief AF 8 selection
774  */
775 #define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */
776 #define GPIO_AF8_USART3 ((uint8_t)0x08) /* USART3 Alternate Function mapping */
777 #define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */
778 #define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */
779 #define GPIO_AF8_UART7 ((uint8_t)0x08) /* UART8 Alternate Function mapping */
780 #define GPIO_AF8_UART8 ((uint8_t)0x08) /* UART8 Alternate Function mapping */
781 #define GPIO_AF8_DFSDM1 ((uint8_t)0x08) /* DFSDM1 Alternate Function mapping */
782 #define GPIO_AF8_CAN1 ((uint8_t)0x08) /* CAN1 Alternate Function mapping */
783 
784 /**
785  * @brief AF 9 selection
786  */
787 #define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */
788 #define GPIO_AF9_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */
789 #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */
790 #define GPIO_AF9_I2C2 ((uint8_t)0x09) /* I2C2 Alternate Function mapping */
791 #define GPIO_AF9_I2C3 ((uint8_t)0x09) /* I2C3 Alternate Function mapping */
792 #define GPIO_AF9_FMPI2C1 ((uint8_t)0x09) /* FMPI2C1 Alternate Function mapping */
793 #define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */
794 #define GPIO_AF9_CAN2 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */
795 #define GPIO_AF9_QSPI ((uint8_t)0x09) /* QSPI Alternate Function mapping */
796 
797 /**
798  * @brief AF 10 selection
799  */
800 #define GPIO_AF10_SAI1 ((uint8_t)0x0A) /* SAI1 Alternate Function mapping */
801 #define GPIO_AF10_OTG_FS ((uint8_t)0x0A) /* OTG_FS Alternate Function mapping */
802 #define GPIO_AF10_DFSDM1 ((uint8_t)0x0A) /* DFSDM1 Alternate Function mapping */
803 #define GPIO_AF10_DFSDM2 ((uint8_t)0x0A) /* DFSDM2 Alternate Function mapping */
804 #define GPIO_AF10_QSPI ((uint8_t)0x0A) /* QSPI Alternate Function mapping */
805 #define GPIO_AF10_FSMC ((uint8_t)0x0A) /* FSMC Alternate Function mapping */
806 
807 /**
808  * @brief AF 11 selection
809  */
810 #define GPIO_AF11_UART4 ((uint8_t)0x0B) /* UART4 Alternate Function mapping */
811 #define GPIO_AF11_UART5 ((uint8_t)0x0B) /* UART5 Alternate Function mapping */
812 #define GPIO_AF11_UART9 ((uint8_t)0x0B) /* UART9 Alternate Function mapping */
813 #define GPIO_AF11_UART10 ((uint8_t)0x0B) /* UART10 Alternate Function mapping */
814 #define GPIO_AF11_CAN3 ((uint8_t)0x0B) /* CAN3 Alternate Function mapping */
815 
816 /**
817  * @brief AF 12 selection
818  */
819 #define GPIO_AF12_SDIO ((uint8_t)0x0C) /* SDIO Alternate Function mapping */
820 #define GPIO_AF12_FSMC ((uint8_t)0x0C) /* FMC Alternate Function mapping */
821 
822 /**
823  * @brief AF 14 selection
824  */
825 #define GPIO_AF14_RNG ((uint8_t)0x0E) /* RNG Alternate Function mapping */
826 
827 /**
828  * @brief AF 15 selection
829  */
830 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
831 #endif /* STM32F413xx || STM32F423xx */
832 
833 /*---------------------------------------- STM32F411xx------------------------*/
834 #if defined(STM32F411xE)
835 /**
836  * @brief AF 0 selection
837  */
838 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
839 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
840 #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
841 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
842 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
843 
844 /**
845  * @brief AF 1 selection
846  */
847 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
848 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
849 
850 /**
851  * @brief AF 2 selection
852  */
853 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
854 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
855 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
856 
857 /**
858  * @brief AF 3 selection
859  */
860 #define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */
861 #define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */
862 #define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */
863 
864 /**
865  * @brief AF 4 selection
866  */
867 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
868 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
869 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */
870 
871 /**
872  * @brief AF 5 selection
873  */
874 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1/I2S1 Alternate Function mapping */
875 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */
876 #define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3/I2S3 Alternate Function mapping */
877 #define GPIO_AF5_SPI4 ((uint8_t)0x05) /* SPI4 Alternate Function mapping */
878 #define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */
879 
880 /**
881  * @brief AF 6 selection
882  */
883 #define GPIO_AF6_SPI2 ((uint8_t)0x06) /* I2S2 Alternate Function mapping */
884 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */
885 #define GPIO_AF6_SPI4 ((uint8_t)0x06) /* SPI4/I2S4 Alternate Function mapping */
886 #define GPIO_AF6_SPI5 ((uint8_t)0x06) /* SPI5/I2S5 Alternate Function mapping */
887 #define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */
888 
889 /**
890  * @brief AF 7 selection
891  */
892 #define GPIO_AF7_SPI3 ((uint8_t)0x07) /* SPI3/I2S3 Alternate Function mapping */
893 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
894 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
895 #define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */
896 
897 /**
898  * @brief AF 8 selection
899  */
900 #define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */
901 
902 /**
903  * @brief AF 9 selection
904  */
905 #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */
906 #define GPIO_AF9_I2C2 ((uint8_t)0x09) /* I2C2 Alternate Function mapping */
907 #define GPIO_AF9_I2C3 ((uint8_t)0x09) /* I2C3 Alternate Function mapping */
908 
909 /**
910  * @brief AF 10 selection
911  */
912 #define GPIO_AF10_OTG_FS ((uint8_t)0x0A) /* OTG_FS Alternate Function mapping */
913 
914 /**
915  * @brief AF 12 selection
916  */
917 #define GPIO_AF12_SDIO ((uint8_t)0x0C) /* SDIO Alternate Function mapping */
918 
919 /**
920  * @brief AF 15 selection
921  */
922 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
923 #endif /* STM32F411xE */
924 
925 /*---------------------------------------- STM32F410xx------------------------*/
926 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
927 /**
928  * @brief AF 0 selection
929  */
930 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
931 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
932 #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
933 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
934 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
935 
936 /**
937  * @brief AF 1 selection
938  */
939 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
940 #define GPIO_AF1_LPTIM1 ((uint8_t)0x01) /* LPTIM1 Alternate Function mapping */
941 
942 /**
943  * @brief AF 2 selection
944  */
945 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
946 
947 /**
948  * @brief AF 3 selection
949  */
950 #define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */
951 #define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */
952 
953 /**
954  * @brief AF 4 selection
955  */
956 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
957 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
958 #define GPIO_AF4_FMPI2C1 ((uint8_t)0x04) /* FMPI2C1 Alternate Function mapping */
959 
960 /**
961  * @brief AF 5 selection
962  */
963 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1/I2S1 Alternate Function mapping */
964 #if defined(STM32F410Cx) || defined(STM32F410Rx)
965 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */
966 #endif /* STM32F410Cx || STM32F410Rx */
967 
968 /**
969  * @brief AF 6 selection
970  */
971 #define GPIO_AF6_SPI1 ((uint8_t)0x06) /* SPI1 Alternate Function mapping */
972 #if defined(STM32F410Cx) || defined(STM32F410Rx)
973 #define GPIO_AF6_SPI2 ((uint8_t)0x06) /* I2S2 Alternate Function mapping */
974 #endif /* STM32F410Cx || STM32F410Rx */
975 #define GPIO_AF6_SPI5 ((uint8_t)0x06) /* SPI5/I2S5 Alternate Function mapping */
976 /**
977  * @brief AF 7 selection
978  */
979 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
980 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
981 
982 /**
983  * @brief AF 8 selection
984  */
985 #define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */
986 
987 /**
988  * @brief AF 9 selection
989  */
990 #define GPIO_AF9_I2C2 ((uint8_t)0x09) /* I2C2 Alternate Function mapping */
991 #define GPIO_AF9_FMPI2C1 ((uint8_t)0x09) /* FMPI2C1 Alternate Function mapping */
992 
993 /**
994  * @brief AF 15 selection
995  */
996 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
997 #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
998 
999 /*---------------------------------------- STM32F446xx -----------------------*/
1000 #if defined(STM32F446xx)
1001 /**
1002  * @brief AF 0 selection
1003  */
1004 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
1005 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
1006 #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
1007 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
1008 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
1009 
1010 /**
1011  * @brief AF 1 selection
1012  */
1013 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
1014 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
1015 
1016 /**
1017  * @brief AF 2 selection
1018  */
1019 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
1020 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
1021 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
1022 
1023 /**
1024  * @brief AF 3 selection
1025  */
1026 #define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */
1027 #define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */
1028 #define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */
1029 #define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */
1030 #define GPIO_AF3_CEC ((uint8_t)0x03) /* CEC Alternate Function mapping */
1031 
1032 /**
1033  * @brief AF 4 selection
1034  */
1035 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
1036 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
1037 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */
1038 #define GPIO_AF4_FMPI2C1 ((uint8_t)0x04) /* FMPI2C1 Alternate Function mapping */
1039 #define GPIO_AF4_CEC ((uint8_t)0x04) /* CEC Alternate Function mapping */
1040 
1041 /**
1042  * @brief AF 5 selection
1043  */
1044 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1/I2S1 Alternate Function mapping */
1045 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */
1046 #define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3/I2S3 Alternate Function mapping */
1047 #define GPIO_AF5_SPI4 ((uint8_t)0x05) /* SPI4 Alternate Function mapping */
1048 
1049 /**
1050  * @brief AF 6 selection
1051  */
1052 #define GPIO_AF6_SPI2 ((uint8_t)0x06) /* SPI2/I2S2 Alternate Function mapping */
1053 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */
1054 #define GPIO_AF6_SPI4 ((uint8_t)0x06) /* SPI4 Alternate Function mapping */
1055 #define GPIO_AF6_SAI1 ((uint8_t)0x06) /* SAI1 Alternate Function mapping */
1056 
1057 /**
1058  * @brief AF 7 selection
1059  */
1060 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
1061 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
1062 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */
1063 #define GPIO_AF7_UART5 ((uint8_t)0x07) /* UART5 Alternate Function mapping */
1064 #define GPIO_AF7_SPI2 ((uint8_t)0x07) /* SPI2/I2S2 Alternate Function mapping */
1065 #define GPIO_AF7_SPI3 ((uint8_t)0x07) /* SPI3/I2S3 Alternate Function mapping */
1066 #define GPIO_AF7_SPDIFRX ((uint8_t)0x07) /* SPDIFRX Alternate Function mapping */
1067 
1068 /**
1069  * @brief AF 8 selection
1070  */
1071 #define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */
1072 #define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */
1073 #define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */
1074 #define GPIO_AF8_SPDIFRX ((uint8_t)0x08) /* SPDIFRX Alternate Function mapping */
1075 #define GPIO_AF8_SAI2 ((uint8_t)0x08) /* SAI2 Alternate Function mapping */
1076 
1077 /**
1078  * @brief AF 9 selection
1079  */
1080 #define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */
1081 #define GPIO_AF9_CAN2 ((uint8_t)0x09) /* CAN2 Alternate Function mapping */
1082 #define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */
1083 #define GPIO_AF9_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */
1084 #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */
1085 #define GPIO_AF9_QSPI ((uint8_t)0x09) /* QSPI Alternate Function mapping */
1086 
1087 /**
1088  * @brief AF 10 selection
1089  */
1090 #define GPIO_AF10_OTG_FS ((uint8_t)0x0A) /* OTG_FS Alternate Function mapping */
1091 #define GPIO_AF10_OTG_HS ((uint8_t)0x0A) /* OTG_HS Alternate Function mapping */
1092 #define GPIO_AF10_SAI2 ((uint8_t)0x0A) /* SAI2 Alternate Function mapping */
1093 #define GPIO_AF10_QSPI ((uint8_t)0x0A) /* QSPI Alternate Function mapping */
1094 
1095 /**
1096  * @brief AF 11 selection
1097  */
1098 #define GPIO_AF11_ETH ((uint8_t)0x0B) /* ETHERNET Alternate Function mapping */
1099 
1100 /**
1101  * @brief AF 12 selection
1102  */
1103 #define GPIO_AF12_FMC ((uint8_t)0x0C) /* FMC Alternate Function mapping */
1104 #define GPIO_AF12_OTG_HS_FS ((uint8_t)0x0C) /* OTG HS configured in FS, Alternate Function mapping */
1105 #define GPIO_AF12_SDIO ((uint8_t)0x0C) /* SDIO Alternate Function mapping */
1106 
1107 /**
1108  * @brief AF 13 selection
1109  */
1110 #define GPIO_AF13_DCMI ((uint8_t)0x0D) /* DCMI Alternate Function mapping */
1111 
1112 /**
1113  * @brief AF 15 selection
1114  */
1115 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
1116 
1117 #endif /* STM32F446xx */
1118 /*----------------------------------------------------------------------------*/
1119 
1120 /*-------------------------------- STM32F469xx/STM32F479xx--------------------*/
1121 #if defined(STM32F469xx) || defined(STM32F479xx)
1122 /**
1123  * @brief AF 0 selection
1124  */
1125 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
1126 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
1127 #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
1128 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
1129 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
1130 
1131 /**
1132  * @brief AF 1 selection
1133  */
1134 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
1135 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
1136 
1137 /**
1138  * @brief AF 2 selection
1139  */
1140 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
1141 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
1142 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
1143 
1144 /**
1145  * @brief AF 3 selection
1146  */
1147 #define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */
1148 #define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */
1149 #define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */
1150 #define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */
1151 
1152 /**
1153  * @brief AF 4 selection
1154  */
1155 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
1156 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
1157 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */
1158 
1159 /**
1160  * @brief AF 5 selection
1161  */
1162 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */
1163 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */
1164 #define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3/I2S3 Alternate Function mapping */
1165 #define GPIO_AF5_SPI4 ((uint8_t)0x05) /* SPI4 Alternate Function mapping */
1166 #define GPIO_AF5_SPI5 ((uint8_t)0x05) /* SPI5 Alternate Function mapping */
1167 #define GPIO_AF5_SPI6 ((uint8_t)0x05) /* SPI6 Alternate Function mapping */
1168 #define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */
1169 
1170 /**
1171  * @brief AF 6 selection
1172  */
1173 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */
1174 #define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */
1175 #define GPIO_AF6_SAI1 ((uint8_t)0x06) /* SAI1 Alternate Function mapping */
1176 
1177 /**
1178  * @brief AF 7 selection
1179  */
1180 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
1181 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
1182 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */
1183 #define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */
1184 
1185 /**
1186  * @brief AF 8 selection
1187  */
1188 #define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */
1189 #define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */
1190 #define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */
1191 #define GPIO_AF8_UART7 ((uint8_t)0x08) /* UART7 Alternate Function mapping */
1192 #define GPIO_AF8_UART8 ((uint8_t)0x08) /* UART8 Alternate Function mapping */
1193 
1194 /**
1195  * @brief AF 9 selection
1196  */
1197 #define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */
1198 #define GPIO_AF9_CAN2 ((uint8_t)0x09) /* CAN2 Alternate Function mapping */
1199 #define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */
1200 #define GPIO_AF9_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */
1201 #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */
1202 #define GPIO_AF9_LTDC ((uint8_t)0x09) /* LCD-TFT Alternate Function mapping */
1203 #define GPIO_AF9_QSPI ((uint8_t)0x09) /* QSPI Alternate Function mapping */
1204 
1205 /**
1206  * @brief AF 10 selection
1207  */
1208 #define GPIO_AF10_OTG_FS ((uint8_t)0x0A) /* OTG_FS Alternate Function mapping */
1209 #define GPIO_AF10_OTG_HS ((uint8_t)0x0A) /* OTG_HS Alternate Function mapping */
1210 #define GPIO_AF10_QSPI ((uint8_t)0x0A) /* QSPI Alternate Function mapping */
1211 
1212 /**
1213  * @brief AF 11 selection
1214  */
1215 #define GPIO_AF11_ETH ((uint8_t)0x0B) /* ETHERNET Alternate Function mapping */
1216 
1217 /**
1218  * @brief AF 12 selection
1219  */
1220 #define GPIO_AF12_FMC ((uint8_t)0x0C) /* FMC Alternate Function mapping */
1221 #define GPIO_AF12_OTG_HS_FS ((uint8_t)0x0C) /* OTG HS configured in FS, Alternate Function mapping */
1222 #define GPIO_AF12_SDIO ((uint8_t)0x0C) /* SDIO Alternate Function mapping */
1223 
1224 /**
1225  * @brief AF 13 selection
1226  */
1227 #define GPIO_AF13_DCMI ((uint8_t)0x0D) /* DCMI Alternate Function mapping */
1228 #define GPIO_AF13_DSI ((uint8_t)0x0D) /* DSI Alternate Function mapping */
1229 
1230 /**
1231  * @brief AF 14 selection
1232  */
1233 #define GPIO_AF14_LTDC ((uint8_t)0x0E) /* LCD-TFT Alternate Function mapping */
1234 
1235 /**
1236  * @brief AF 15 selection
1237  */
1238 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
1239 
1240 #endif /* STM32F469xx || STM32F479xx */
1241 /*----------------------------------------------------------------------------*/
1242 /**
1243  * @}
1244  */
1245 
1246 /**
1247  * @}
1248  */
1249 
1250 /* Exported macro ------------------------------------------------------------*/
1251 /** @defgroup GPIOEx_Exported_Macros GPIO Exported Macros
1252  * @{
1253  */
1254 /**
1255  * @}
1256  */
1257 
1258 /* Exported functions --------------------------------------------------------*/
1259 /** @defgroup GPIOEx_Exported_Functions GPIO Exported Functions
1260  * @{
1261  */
1262 /**
1263  * @}
1264  */
1265 
1266 /* Private types -------------------------------------------------------------*/
1267 /* Private variables ---------------------------------------------------------*/
1268 /* Private constants ---------------------------------------------------------*/
1269 /** @defgroup GPIOEx_Private_Constants GPIO Private Constants
1270  * @{
1271  */
1272 /**
1273  * @}
1274  */
1275 
1276 /* Private macros ------------------------------------------------------------*/
1277 /** @defgroup GPIOEx_Private_Macros GPIO Private Macros
1278  * @{
1279  */
1280 /** @defgroup GPIOEx_Get_Port_Index GPIO Get Port Index
1281  * @{
1282  */
1283 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx)
1284 #define GPIO_GET_INDEX(__GPIOx__) (uint8_t)(((__GPIOx__) == (GPIOA))? 0U :\
1285  ((__GPIOx__) == (GPIOB))? 1U :\
1286  ((__GPIOx__) == (GPIOC))? 2U :\
1287  ((__GPIOx__) == (GPIOD))? 3U :\
1288  ((__GPIOx__) == (GPIOE))? 4U :\
1289  ((__GPIOx__) == (GPIOF))? 5U :\
1290  ((__GPIOx__) == (GPIOG))? 6U :\
1291  ((__GPIOx__) == (GPIOH))? 7U : 8U)
1292 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */
1293 
1294 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
1295  defined(STM32F469xx) || defined(STM32F479xx)
1296 #define GPIO_GET_INDEX(__GPIOx__) (uint8_t)(((__GPIOx__) == (GPIOA))? 0U :\
1297  ((__GPIOx__) == (GPIOB))? 1U :\
1298  ((__GPIOx__) == (GPIOC))? 2U :\
1299  ((__GPIOx__) == (GPIOD))? 3U :\
1300  ((__GPIOx__) == (GPIOE))? 4U :\
1301  ((__GPIOx__) == (GPIOF))? 5U :\
1302  ((__GPIOx__) == (GPIOG))? 6U :\
1303  ((__GPIOx__) == (GPIOH))? 7U :\
1304  ((__GPIOx__) == (GPIOI))? 8U :\
1305  ((__GPIOx__) == (GPIOJ))? 9U : 10U)
1306 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
1307 
1308 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
1309 #define GPIO_GET_INDEX(__GPIOx__) (uint8_t)(((__GPIOx__) == (GPIOA))? 0U :\
1310  ((__GPIOx__) == (GPIOB))? 1U :\
1311  ((__GPIOx__) == (GPIOC))? 2U : 7U)
1312 #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
1313 
1314 #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE)
1315 #define GPIO_GET_INDEX(__GPIOx__) (uint8_t)(((__GPIOx__) == (GPIOA))? 0U :\
1316  ((__GPIOx__) == (GPIOB))? 1U :\
1317  ((__GPIOx__) == (GPIOC))? 2U :\
1318  ((__GPIOx__) == (GPIOD))? 3U :\
1319  ((__GPIOx__) == (GPIOE))? 4U : 7U)
1320 #endif /* STM32F401xC || STM32F401xE || STM32F411xE */
1321 
1322 #if defined(STM32F446xx) || defined(STM32F412Zx) ||defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
1323 #define GPIO_GET_INDEX(__GPIOx__) (uint8_t)(((__GPIOx__) == (GPIOA))? 0U :\
1324  ((__GPIOx__) == (GPIOB))? 1U :\
1325  ((__GPIOx__) == (GPIOC))? 2U :\
1326  ((__GPIOx__) == (GPIOD))? 3U :\
1327  ((__GPIOx__) == (GPIOE))? 4U :\
1328  ((__GPIOx__) == (GPIOF))? 5U :\
1329  ((__GPIOx__) == (GPIOG))? 6U : 7U)
1330 #endif /* STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
1331 
1332 /**
1333  * @}
1334  */
1335 
1336 /** @defgroup GPIOEx_IS_Alternat_function_selection GPIO Check Alternate Function
1337  * @{
1338  */
1339 /*------------------------- STM32F429xx/STM32F439xx---------------------------*/
1340 #if defined(STM32F429xx) || defined(STM32F439xx)
1341 #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \
1342  ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \
1343  ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
1344  ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \
1345  ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
1346  ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \
1347  ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \
1348  ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF5_SPI1) || \
1349  ((AF) == GPIO_AF5_SPI2) || ((AF) == GPIO_AF9_TIM13) || \
1350  ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF9_TIM12) || \
1351  ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
1352  ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF8_UART4) || \
1353  ((AF) == GPIO_AF8_UART5) || ((AF) == GPIO_AF8_USART6) || \
1354  ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \
1355  ((AF) == GPIO_AF10_OTG_FS) || ((AF) == GPIO_AF10_OTG_HS) || \
1356  ((AF) == GPIO_AF11_ETH) || ((AF) == GPIO_AF12_OTG_HS_FS) || \
1357  ((AF) == GPIO_AF12_SDIO) || ((AF) == GPIO_AF13_DCMI) || \
1358  ((AF) == GPIO_AF15_EVENTOUT) || ((AF) == GPIO_AF5_SPI4) || \
1359  ((AF) == GPIO_AF5_SPI5) || ((AF) == GPIO_AF5_SPI6) || \
1360  ((AF) == GPIO_AF8_UART7) || ((AF) == GPIO_AF8_UART8) || \
1361  ((AF) == GPIO_AF12_FMC) || ((AF) == GPIO_AF6_SAI1) || \
1362  ((AF) == GPIO_AF14_LTDC))
1363 
1364 #endif /* STM32F429xx || STM32F439xx */
1365 /*----------------------------------------------------------------------------*/
1366 
1367 /*---------------------------------- STM32F427xx/STM32F437xx------------------*/
1368 #if defined(STM32F427xx) || defined(STM32F437xx)
1369 #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \
1370  ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \
1371  ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
1372  ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \
1373  ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
1374  ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \
1375  ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \
1376  ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF5_SPI1) || \
1377  ((AF) == GPIO_AF5_SPI2) || ((AF) == GPIO_AF9_TIM13) || \
1378  ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF9_TIM12) || \
1379  ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
1380  ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF8_UART4) || \
1381  ((AF) == GPIO_AF8_UART5) || ((AF) == GPIO_AF8_USART6) || \
1382  ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \
1383  ((AF) == GPIO_AF10_OTG_FS) || ((AF) == GPIO_AF10_OTG_HS) || \
1384  ((AF) == GPIO_AF11_ETH) || ((AF) == GPIO_AF12_OTG_HS_FS) || \
1385  ((AF) == GPIO_AF12_SDIO) || ((AF) == GPIO_AF13_DCMI) || \
1386  ((AF) == GPIO_AF15_EVENTOUT) || ((AF) == GPIO_AF5_SPI4) || \
1387  ((AF) == GPIO_AF5_SPI5) || ((AF) == GPIO_AF5_SPI6) || \
1388  ((AF) == GPIO_AF8_UART7) || ((AF) == GPIO_AF8_UART8) || \
1389  ((AF) == GPIO_AF12_FMC) || ((AF) == GPIO_AF6_SAI1))
1390 
1391 #endif /* STM32F427xx || STM32F437xx */
1392 /*----------------------------------------------------------------------------*/
1393 
1394 /*---------------------------------- STM32F407xx/STM32F417xx------------------*/
1395 #if defined(STM32F407xx) || defined(STM32F417xx)
1396 #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \
1397  ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \
1398  ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
1399  ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \
1400  ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
1401  ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \
1402  ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \
1403  ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF5_SPI1) || \
1404  ((AF) == GPIO_AF5_SPI2) || ((AF) == GPIO_AF9_TIM13) || \
1405  ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF9_TIM12) || \
1406  ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
1407  ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF8_UART4) || \
1408  ((AF) == GPIO_AF8_UART5) || ((AF) == GPIO_AF8_USART6) || \
1409  ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \
1410  ((AF) == GPIO_AF10_OTG_FS) || ((AF) == GPIO_AF10_OTG_HS) || \
1411  ((AF) == GPIO_AF11_ETH) || ((AF) == GPIO_AF12_OTG_HS_FS) || \
1412  ((AF) == GPIO_AF12_SDIO) || ((AF) == GPIO_AF13_DCMI) || \
1413  ((AF) == GPIO_AF12_FSMC) || ((AF) == GPIO_AF15_EVENTOUT))
1414 
1415 #endif /* STM32F407xx || STM32F417xx */
1416 /*----------------------------------------------------------------------------*/
1417 
1418 /*---------------------------------- STM32F405xx/STM32F415xx------------------*/
1419 #if defined(STM32F405xx) || defined(STM32F415xx)
1420 #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \
1421  ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \
1422  ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
1423  ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \
1424  ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
1425  ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \
1426  ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \
1427  ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF5_SPI1) || \
1428  ((AF) == GPIO_AF5_SPI2) || ((AF) == GPIO_AF9_TIM13) || \
1429  ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF9_TIM12) || \
1430  ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
1431  ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF8_UART4) || \
1432  ((AF) == GPIO_AF8_UART5) || ((AF) == GPIO_AF8_USART6) || \
1433  ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \
1434  ((AF) == GPIO_AF10_OTG_FS) || ((AF) == GPIO_AF10_OTG_HS) || \
1435  ((AF) == GPIO_AF12_OTG_HS_FS) || ((AF) == GPIO_AF12_SDIO) || \
1436  ((AF) == GPIO_AF12_FSMC) || ((AF) == GPIO_AF15_EVENTOUT))
1437 
1438 #endif /* STM32F405xx || STM32F415xx */
1439 
1440 /*----------------------------------------------------------------------------*/
1441 
1442 /*---------------------------------------- STM32F401xx------------------------*/
1443 #if defined(STM32F401xC) || defined(STM32F401xE)
1444 #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \
1445  ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \
1446  ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
1447  ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \
1448  ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
1449  ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF4_I2C1) || \
1450  ((AF) == GPIO_AF4_I2C2) || ((AF) == GPIO_AF4_I2C3) || \
1451  ((AF) == GPIO_AF5_SPI1) || ((AF) == GPIO_AF5_SPI2) || \
1452  ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF5_SPI4) || \
1453  ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
1454  ((AF) == GPIO_AF8_USART6) || ((AF) == GPIO_AF10_OTG_FS) || \
1455  ((AF) == GPIO_AF9_I2C2) || ((AF) == GPIO_AF9_I2C3) || \
1456  ((AF) == GPIO_AF12_SDIO) || ((AF) == GPIO_AF15_EVENTOUT))
1457 
1458 #endif /* STM32F401xC || STM32F401xE */
1459 /*----------------------------------------------------------------------------*/
1460 /*---------------------------------------- STM32F410xx------------------------*/
1461 #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
1462 #define IS_GPIO_AF(AF) (((AF) < 10U) || ((AF) == 15U))
1463 #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
1464 
1465 /*---------------------------------------- STM32F411xx------------------------*/
1466 #if defined(STM32F411xE)
1467 #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \
1468  ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \
1469  ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
1470  ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \
1471  ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
1472  ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF4_I2C1) || \
1473  ((AF) == GPIO_AF4_I2C2) || ((AF) == GPIO_AF4_I2C3) || \
1474  ((AF) == GPIO_AF5_SPI1) || ((AF) == GPIO_AF5_SPI2) || \
1475  ((AF) == GPIO_AF5_SPI3) || ((AF) == GPIO_AF6_SPI4) || \
1476  ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF5_SPI4) || \
1477  ((AF) == GPIO_AF6_SPI5) || ((AF) == GPIO_AF7_SPI3) || \
1478  ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
1479  ((AF) == GPIO_AF8_USART6) || ((AF) == GPIO_AF10_OTG_FS) || \
1480  ((AF) == GPIO_AF9_I2C2) || ((AF) == GPIO_AF9_I2C3) || \
1481  ((AF) == GPIO_AF12_SDIO) || ((AF) == GPIO_AF15_EVENTOUT))
1482 
1483 #endif /* STM32F411xE */
1484 /*----------------------------------------------------------------------------*/
1485 
1486 /*----------------------------------------------- STM32F446xx ----------------*/
1487 #if defined(STM32F446xx)
1488 #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \
1489  ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \
1490  ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
1491  ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \
1492  ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
1493  ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \
1494  ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \
1495  ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF5_SPI1) || \
1496  ((AF) == GPIO_AF5_SPI2) || ((AF) == GPIO_AF9_TIM13) || \
1497  ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF9_TIM12) || \
1498  ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
1499  ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF8_UART4) || \
1500  ((AF) == GPIO_AF8_UART5) || ((AF) == GPIO_AF8_USART6) || \
1501  ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \
1502  ((AF) == GPIO_AF10_OTG_FS) || ((AF) == GPIO_AF10_OTG_HS) || \
1503  ((AF) == GPIO_AF11_ETH) || ((AF) == GPIO_AF12_OTG_HS_FS) || \
1504  ((AF) == GPIO_AF12_SDIO) || ((AF) == GPIO_AF13_DCMI) || \
1505  ((AF) == GPIO_AF15_EVENTOUT) || ((AF) == GPIO_AF5_SPI4) || \
1506  ((AF) == GPIO_AF12_FMC) || ((AF) == GPIO_AF6_SAI1) || \
1507  ((AF) == GPIO_AF3_CEC) || ((AF) == GPIO_AF4_CEC) || \
1508  ((AF) == GPIO_AF5_SPI3) || ((AF) == GPIO_AF6_SPI2) || \
1509  ((AF) == GPIO_AF6_SPI4) || ((AF) == GPIO_AF7_UART5) || \
1510  ((AF) == GPIO_AF7_SPI2) || ((AF) == GPIO_AF7_SPI3) || \
1511  ((AF) == GPIO_AF7_SPDIFRX) || ((AF) == GPIO_AF8_SPDIFRX) || \
1512  ((AF) == GPIO_AF8_SAI2) || ((AF) == GPIO_AF9_QSPI) || \
1513  ((AF) == GPIO_AF10_SAI2) || ((AF) == GPIO_AF10_QSPI))
1514 
1515 #endif /* STM32F446xx */
1516 /*----------------------------------------------------------------------------*/
1517 
1518 /*------------------------------------------- STM32F469xx/STM32F479xx --------*/
1519 #if defined(STM32F469xx) || defined(STM32F479xx)
1520 #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \
1521  ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \
1522  ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
1523  ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \
1524  ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
1525  ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \
1526  ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \
1527  ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF5_SPI1) || \
1528  ((AF) == GPIO_AF5_SPI2) || ((AF) == GPIO_AF9_TIM13) || \
1529  ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF9_TIM12) || \
1530  ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
1531  ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF8_UART4) || \
1532  ((AF) == GPIO_AF8_UART5) || ((AF) == GPIO_AF8_USART6) || \
1533  ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \
1534  ((AF) == GPIO_AF10_OTG_FS) || ((AF) == GPIO_AF10_OTG_HS) || \
1535  ((AF) == GPIO_AF11_ETH) || ((AF) == GPIO_AF12_OTG_HS_FS) || \
1536  ((AF) == GPIO_AF12_SDIO) || ((AF) == GPIO_AF13_DCMI) || \
1537  ((AF) == GPIO_AF15_EVENTOUT) || ((AF) == GPIO_AF5_SPI4) || \
1538  ((AF) == GPIO_AF5_SPI5) || ((AF) == GPIO_AF5_SPI6) || \
1539  ((AF) == GPIO_AF8_UART7) || ((AF) == GPIO_AF8_UART8) || \
1540  ((AF) == GPIO_AF12_FMC) || ((AF) == GPIO_AF6_SAI1) || \
1541  ((AF) == GPIO_AF14_LTDC) || ((AF) == GPIO_AF13_DSI) || \
1542  ((AF) == GPIO_AF9_QSPI) || ((AF) == GPIO_AF10_QSPI))
1543 
1544 #endif /* STM32F469xx || STM32F479xx */
1545 /*----------------------------------------------------------------------------*/
1546 
1547 /*------------------STM32F412Zx/STM32F412Vx/STM32F412Rx/STM32F412Cx-----------*/
1548 #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx)
1549 #define IS_GPIO_AF(AF) (((AF) < 16U) && ((AF) != 11U) && ((AF) != 14U) && ((AF) != 13U))
1550 #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */
1551 /*----------------------------------------------------------------------------*/
1552 
1553 /*------------------STM32F413xx/STM32F423xx-----------------------------------*/
1554 #if defined(STM32F413xx) || defined(STM32F423xx)
1555 #define IS_GPIO_AF(AF) (((AF) < 16U) && ((AF) != 13U))
1556 #endif /* STM32F413xx || STM32F423xx */
1557 /*----------------------------------------------------------------------------*/
1558 
1559 /**
1560  * @}
1561  */
1562 
1563 /**
1564  * @}
1565  */
1566 
1567 /* Private functions ---------------------------------------------------------*/
1568 /** @defgroup GPIOEx_Private_Functions GPIO Private Functions
1569  * @{
1570  */
1571 
1572 /**
1573  * @}
1574  */
1575 
1576 /**
1577  * @}
1578  */
1579 
1580 /**
1581  * @}
1582  */
1583 
1584 #ifdef __cplusplus
1585 }
1586 #endif
1587 
1588 #endif /* __STM32F4xx_HAL_GPIO_EX_H */
1589 
1590 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
stm32f4xx_hal_def.h
This file contains HAL common defines, enumeration, macros and structures definitions.