1 /**
2   ******************************************************************************
3   * @file    stm32h5xx_hal_gpio_ex.h
4   * @author  MCD Application Team
5   * @brief   Header file of GPIO HAL Extended module.
6   ******************************************************************************
7   * @attention
8   *
9   * Copyright (c) 2023 STMicroelectronics.
10   * All rights reserved.
11   *
12   * This software is licensed under terms that can be found in the LICENSE file
13   * in the root directory of this software component.
14   * If no LICENSE file comes with this software, it is provided AS-IS.
15   *
16   ******************************************************************************
17   */
18 
19 /* Define to prevent recursive inclusion -------------------------------------*/
20 #ifndef STM32H5xx_HAL_GPIO_EX_H
21 #define STM32H5xx_HAL_GPIO_EX_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32h5xx_hal_def.h"
29 
30 /** @addtogroup STM32H5xx_HAL_Driver
31   * @{
32   */
33 
34 /** @defgroup GPIOEx GPIOEx
35   * @brief GPIO Extended HAL module driver
36   * @{
37   */
38 
39 /* Exported types ------------------------------------------------------------*/
40 /* Exported constants --------------------------------------------------------*/
41 /** @defgroup GPIOEx_Exported_Constants GPIOEx Exported Constants
42   * @{
43   */
44 
45 /** @defgroup GPIOEx_Alternate_function_selection GPIOEx Alternate function selection
46   * @{
47   */
48 
49 /**
50   * @brief   AF 0 selection
51   */
52 #define GPIO_AF0_RTC_50HZ      ((uint8_t)0x00)  /* RTC_50Hz Alternate Function mapping                       */
53 #define GPIO_AF0_MCO           ((uint8_t)0x00)  /* MCO (MCO1 and MCO2) Alternate Function mapping            */
54 #define GPIO_AF0_SWJ           ((uint8_t)0x00)  /* SWJ (SWD and JTAG) Alternate Function mapping             */
55 #define GPIO_AF0_TRACE         ((uint8_t)0x00)  /* TRACE Alternate Function mapping                          */
56 #define GPIO_AF0_CSLEEP        ((uint8_t)0x00)  /* CSLEEP Alternate Function mapping                         */
57 #define GPIO_AF0_CSTOP         ((uint8_t)0x00)  /* CSTOP Alternate Function mapping                          */
58 #define GPIO_AF0_CRS           ((uint8_t)0x00)  /* CRS Alternate Function mapping                            */
59 
60 /**
61   * @brief   AF 1 selection
62   */
63 #define GPIO_AF1_TIM1          ((uint8_t)0x01)  /* TIM1 Alternate Function mapping                           */
64 #define GPIO_AF1_TIM2          ((uint8_t)0x01)  /* TIM2 Alternate Function mapping                           */
65 #if defined(TIM16)
66 #define GPIO_AF1_TIM16         ((uint8_t)0x01)  /* TIM16 Alternate Function mapping                          */
67 #endif /* TIM16 */
68 #if defined(TIM17)
69 #define GPIO_AF1_TIM17         ((uint8_t)0x01)  /* TIM17 Alternate Function mapping                          */
70 #endif /* TIM17 */
71 #if !defined(STM32H503xx)
72 #define GPIO_AF1_LPTIM1        ((uint8_t)0x01)  /* LPTIM1 Alternate Function mapping                         */
73 #endif /* STM32H503xx */
74 
75 /**
76   * @brief   AF 2 selection
77   */
78 #if defined(STM32H503xx)
79 #define GPIO_AF2_LPTIM1        ((uint8_t)0x02)  /* LPTIM1 Alternate Function mapping                         */
80 #endif /* STM32H503xx */
81 #if defined(LPTIM3)
82 #define GPIO_AF2_LPTIM3        ((uint8_t)0x02)  /* LPTIM3 Alternate Function mapping                         */
83 #endif /* LPTIM3 */
84 #if defined(SAI1)
85 #define GPIO_AF2_SAI1          ((uint8_t)0x02)  /* SAI1 Alternate Function mapping                           */
86 #endif /* SAI1 */
87 #define GPIO_AF2_TIM3          ((uint8_t)0x02)  /* TIM3 Alternate Function mapping                           */
88 #if defined(TIM4)
89 #define GPIO_AF2_TIM4          ((uint8_t)0x02)  /* TIM4 Alternate Function mapping                           */
90 #endif /* TIM4 */
91 #if defined(TIM5)
92 #define GPIO_AF2_TIM5          ((uint8_t)0x02)  /* TIM5 Alternate Function mapping                           */
93 #endif /* TIM5 */
94 #if (defined(STM32H533xx) || defined(STM32H523xx))
95 #define GPIO_AF2_TIM8          ((uint8_t)0x02)  /* TIM8 Alternate Function mapping                           */
96 #endif /* STM32H533xx || STM32H523xx */
97 #if defined(TIM12)
98 #define GPIO_AF2_TIM12         ((uint8_t)0x02)  /* TIM12 Alternate Function mapping                          */
99 #endif /* TIM12 */
100 #if defined(TIM15)
101 #define GPIO_AF2_TIM15         ((uint8_t)0x02)  /* TIM15 Alternate Function mapping                          */
102 #endif /* TIM15 */
103 
104 /**
105   * @brief   AF 3 selection
106   */
107 #define GPIO_AF3_I3C1          ((uint8_t)0x03)  /* I3C1 Alternate Function mapping                           */
108 #if defined(I3C2)
109 #define GPIO_AF3_I3C2          ((uint8_t)0x03)  /* I3C2 Alternate Function mapping                           */
110 #endif /* I3C2 */
111 #define GPIO_AF3_LPTIM2        ((uint8_t)0x03)  /* LPTIM2 Alternate Function mapping                         */
112 #if defined(LPTIM3)
113 #define GPIO_AF3_LPTIM3        ((uint8_t)0x03)  /* LPTIM3 Alternate Function mapping                         */
114 #endif /* LPTIM3 */
115 #define GPIO_AF3_LPUART1       ((uint8_t)0x03)  /* LPUART1 Alternate Function mapping                        */
116 #if defined(OCTOSPI1)
117 #define GPIO_AF3_OCTOSPI1      ((uint8_t)0x03)  /* OCTOSPI1 Alternate Function mapping                       */
118 #endif /* OCTOSPI1 */
119 #if !defined(STM32H503xx)
120 #define GPIO_AF3_TIM1          ((uint8_t)0x03)  /* TIM1 Alternate Function mapping                           */
121 #endif /* STM32H503xx */
122 #if defined(TIM8)
123 #define GPIO_AF3_TIM8          ((uint8_t)0x03)  /* TIM8 Alternate Function mapping                           */
124 #endif /* TIM8 */
125 
126 /**
127   * @brief   AF 4 selection
128   */
129 #if defined(CEC)
130 #define GPIO_AF4_CEC           ((uint8_t)0x04)  /* CEC Alternate Function mapping                            */
131 #endif /* CEC */
132 #if defined(DCMI)
133 #define GPIO_AF4_DCMI          ((uint8_t)0x04)  /* DCMI Alternate Function mapping                           */
134 #endif /* DCMI */
135 #if defined(PSSI)
136 #define GPIO_AF4_PSSI          ((uint8_t)0x04)  /* PSSI Alternate Function mapping                           */
137 #endif /* PSSI */
138 #define GPIO_AF4_I2C1          ((uint8_t)0x04)  /* I2C1 Alternate Function mapping                           */
139 #define GPIO_AF4_I2C2          ((uint8_t)0x04)  /* I2C2 Alternate Function mapping                           */
140 #if defined(I2C3)
141 #define GPIO_AF4_I2C3          ((uint8_t)0x04)  /* I2C3 Alternate Function mapping                           */
142 #endif /* I2C3 */
143 #if defined(I2C4)
144 #define GPIO_AF4_I2C4          ((uint8_t)0x04)  /* I2C4 Alternate Function mapping                           */
145 #endif /* I2C4 */
146 #define GPIO_AF4_LPTIM1        ((uint8_t)0x04)  /* LPTIM1 Alternate Function mapping                         */
147 #define GPIO_AF4_LPTIM2        ((uint8_t)0x04)  /* LPTIM2 Alternate Function mapping                         */
148 #define GPIO_AF4_SPI1          ((uint8_t)0x04)  /* SPI1 Alternate Function mapping                           */
149 #if (defined(STM32H533xx) || defined(STM32H523xx))
150 #define GPIO_AF4_SPI3          ((uint8_t)0x04)  /* SPI3 Alternate Function mapping                           */
151 #endif /* STM32H533xx || STM32H523xx */
152 #if defined(TIM15)
153 #define GPIO_AF4_TIM15         ((uint8_t)0x04)  /* TIM15 Alternate Function mapping                          */
154 #endif /* TIM15 */
155 #define GPIO_AF4_USART1        ((uint8_t)0x04)  /* USART1 Alternate Function mapping                         */
156 #if defined(STM32H503xx)
157 #define GPIO_AF4_USART2        ((uint8_t)0x04)  /* USART2 Alternate Function mapping                         */
158 #endif /* STM32H503xx */
159 
160 /**
161   * @brief   AF 5 selection
162   */
163 #if defined(CEC)
164 #define GPIO_AF5_CEC           ((uint8_t)0x05)  /* CEC Alternate Function mapping                            */
165 #endif /* CEC */
166 #if !defined(STM32H503xx)
167 #define GPIO_AF5_I3C1          ((uint8_t)0x05)  /* I3C1 Alternate Function mapping                           */
168 #define GPIO_AF5_SPI3          ((uint8_t)0x05)  /* SPI3 Alternate Function mapping                           */
169 #endif /* STM32H503xx */
170 #define GPIO_AF5_LPTIM1        ((uint8_t)0x05)  /* LPTIM1 Alternate Function mapping                         */
171 #define GPIO_AF5_SPI1          ((uint8_t)0x05)  /* SPI1 Alternate Function mapping                           */
172 #define GPIO_AF5_SPI2          ((uint8_t)0x05)  /* SPI2 Alternate Function mapping                           */
173 #if defined(SPI4)
174 #define GPIO_AF5_SPI4          ((uint8_t)0x05)  /* SPI4 Alternate Function mapping                           */
175 #endif /* SPI4 */
176 #if defined(SPI5)
177 #define GPIO_AF5_SPI5          ((uint8_t)0x05)  /* SPI5 Alternate Function mapping                           */
178 #endif /* SPI5 */
179 #if defined(SPI6)
180 #define GPIO_AF5_SPI6          ((uint8_t)0x05)  /* SPI6 Alternate Function mapping                           */
181 #endif /* SPI6 */
182 
183 /**
184   * @brief   AF 6 selection
185   */
186 #if defined(I2C4)
187 #define GPIO_AF6_I2C4          ((uint8_t)0x06)  /* I2C4 Alternate Function mapping                           */
188 #endif /* I2C4 */
189 #if defined(OCTOSPI1)
190 #define GPIO_AF6_OCTOSPI1      ((uint8_t)0x06)  /* OCTOSPI1 Alternate Function mapping                       */
191 #endif /* OCTOSPI1 */
192 #if defined(SAI1)
193 #define GPIO_AF6_SAI1          ((uint8_t)0x06)  /* SAI1 Alternate Function mapping                           */
194 #endif /* SAI1 */
195 #if (defined(STM32H503xx) || defined(STM32H533xx) || defined(STM32H523xx))
196 #define GPIO_AF6_SPI1          ((uint8_t)0x06)  /* SPI1 Alternate Function mapping                           */
197 #define GPIO_AF6_SPI2          ((uint8_t)0x06)  /* SPI2 Alternate Function mapping                           */
198 #endif /* STM32H503xx || STM32H533xx || STM32H523xx */
199 #define GPIO_AF6_SPI3          ((uint8_t)0x06)  /* SPI3 Alternate Function mapping                           */
200 #if defined(SPI4)
201 #define GPIO_AF6_SPI4          ((uint8_t)0x06)  /* SPI4 Alternate Function mapping                           */
202 #endif /* SPI4 */
203 #if defined(UART4)
204 #define GPIO_AF6_UART4         ((uint8_t)0x06)  /* UART4 Alternate Function mapping                          */
205 #endif /* UART4 */
206 #if (defined(STM32H533xx) || defined(STM32H523xx))
207 #define GPIO_AF6_USART6        ((uint8_t)0x06)  /* USART6 Alternate Function mapping                         */
208 #endif /* STM32H533xx || STM32H523xx */
209 #if defined(UART12)
210 #define GPIO_AF6_UART12        ((uint8_t)0x06)  /* UART12 Alternate Function mapping                         */
211 #endif /* UART12 */
212 #if defined(USART10)
213 #define GPIO_AF6_USART10       ((uint8_t)0x06)  /* USART10 Alternate Function mapping                        */
214 #endif /* USART10 */
215 #if defined(UCPD1)
216 #define GPIO_AF6_UCPD1         ((uint8_t)0x06)  /* UCPD1 Alternate Function mapping                          */
217 #endif /* UCPD1 */
218 
219 /**
220   * @brief   AF 7 selection
221   */
222 #if defined(SDMMC1)
223 #define GPIO_AF7_SDMMC1        ((uint8_t)0x07)  /* SDMMC1 Alternate Function mapping                         */
224 #endif /* SDMMC1 */
225 #define GPIO_AF7_SPI2          ((uint8_t)0x07)  /* SPI2 Alternate Function mapping                           */
226 #define GPIO_AF7_SPI3          ((uint8_t)0x07)  /* SPI3 Alternate Function mapping                           */
227 #if defined(SPI6)
228 #define GPIO_AF7_SPI6          ((uint8_t)0x07)  /* SPI6 Alternate Function mapping                           */
229 #endif /* SPI6 */
230 #if defined(UART7)
231 #define GPIO_AF7_UART7         ((uint8_t)0x07)  /* UART7 Alternate Function mapping                          */
232 #endif /* UART7 */
233 #if defined(UART8)
234 #define GPIO_AF7_UART8         ((uint8_t)0x07)  /* UART8 Alternate Function mapping                          */
235 #endif /* UART8 */
236 #if defined(UART12)
237 #define GPIO_AF7_UART12        ((uint8_t)0x07)  /* UART12 Alternate Function mapping                         */
238 #endif /* UART12 */
239 #define GPIO_AF7_USART1        ((uint8_t)0x07)  /* USART1 Alternate Function mapping                         */
240 #define GPIO_AF7_USART2        ((uint8_t)0x07)  /* USART2 Alternate Function mapping                         */
241 #define GPIO_AF7_USART3        ((uint8_t)0x07)  /* USART3 Alternate Function mapping                         */
242 #if defined(USART6)
243 #define GPIO_AF7_USART6        ((uint8_t)0x07)  /* USART6 Alternate Function mapping                         */
244 #endif /* USART6 */
245 #if defined(USART10)
246 #define GPIO_AF7_USART10       ((uint8_t)0x07)  /* USART10 Alternate Function mapping                        */
247 #endif /* USART10 */
248 #if defined(USART11)
249 #define GPIO_AF7_USART11       ((uint8_t)0x07)  /* USART11 Alternate Function mapping                        */
250 #endif /* USART11 */
251 #define GPIO_AF7_ETH           ((uint8_t)0x07)  /* ETH Alternate Function mapping                         */
252 /**
253   * @brief   AF 8 selection
254   */
255 #if defined(STM32H503xx)
256 #define GPIO_AF8_I2C2          ((uint8_t)0x08)  /* I2C2 Alternate Function mapping                           */
257 #define GPIO_AF8_I3C1          ((uint8_t)0x08)  /* I3C1 Alternate Function mapping                           */
258 #define GPIO_AF8_USART1        ((uint8_t)0x08)  /* USART1 Alternate Function mapping                         */
259 #endif /* STM32H503xx */
260 #define GPIO_AF8_LPUART1       ((uint8_t)0x08)  /* LPUART1 Alternate Function mapping                        */
261 #if defined(SAI2)
262 #define GPIO_AF8_SAI2          ((uint8_t)0x08)  /* SAI2 Alternate Function mapping                           */
263 #endif /* SAI2 */
264 #if defined(SDMMC1)
265 #define GPIO_AF8_SDMMC1        ((uint8_t)0x08)  /* SDMMC1 Alternate Function mapping                         */
266 #endif /* SDMMC1 */
267 #if defined(SPI6)
268 #define GPIO_AF8_SPI6          ((uint8_t)0x08)  /* SPI6 Alternate Function mapping                           */
269 #endif /* SPI6 */
270 #if defined(UART4)
271 #define GPIO_AF8_UART4         ((uint8_t)0x08)  /* UART4 Alternate Function mapping                          */
272 #endif /* UART4 */
273 #if defined(UART5)
274 #define GPIO_AF8_UART5         ((uint8_t)0x08)  /* UART5 Alternate Function mapping                          */
275 #endif /* UART5 */
276 #if defined(UART8)
277 #define GPIO_AF8_UART8         ((uint8_t)0x08)  /* UART8 Alternate Function mapping                          */
278 #endif /* UART8 */
279 
280 /**
281   * @brief   AF 9 selection
282   */
283 #define GPIO_AF9_FDCAN1        ((uint8_t)0x09)  /* FDCAN1 Alternate Function mapping                         */
284 #if defined(FDCAN2)
285 #define GPIO_AF9_FDCAN2        ((uint8_t)0x09)  /* FDCAN2 Alternate Function mapping                         */
286 #endif /* FDCAN2 */
287 #if defined(FMC_BANK1)
288 #define GPIO_AF9_FMC           ((uint8_t)0x09)  /* FMC Alternate Function mapping                            */
289 #endif /* FMC_BANK1 */
290 #if defined(OCTOSPI1)
291 #define GPIO_AF9_OCTOSPI1      ((uint8_t)0x09)  /* OCTOSPI1 Alternate Function mapping                       */
292 #endif /* OCTOSPI1 */
293 #if defined(SDMMC2)
294 #define GPIO_AF9_SDMMC2        ((uint8_t)0x09)  /* SDMMC2 Alternate Function mapping                         */
295 #endif /* SDMMC2 */
296 #if defined(TIM13)
297 #define GPIO_AF9_TIM13         ((uint8_t)0x09)  /* TIM13 Alternate Function mapping                          */
298 #endif /* TIM13 */
299 #if defined(TIM14)
300 #define GPIO_AF9_TIM14         ((uint8_t)0x09)  /* TIM14 Alternate Function mapping                          */
301 #endif /* TIM14 */
302 #if defined(STM32H503xx)
303 #define GPIO_AF9_USART2        ((uint8_t)0x09)  /* USART2 Alternate Function mapping                         */
304 #define GPIO_AF9_USART3        ((uint8_t)0x09)  /* USART3 Alternate Function mapping                         */
305 #endif /* STM32H503xx */
306 #if (defined(STM32H533xx) || defined(STM32H523xx))
307 #define GPIO_AF9_I2C3          ((uint8_t)0x09)  /* I2C3 Alternate Function mapping                           */
308 #define GPIO_AF9_I3C2          ((uint8_t)0x09)  /* I3C2 Alternate Function mapping                           */
309 #endif /* STM32H533xx || STM32H523xx */
310 
311 /**
312   * @brief   AF 10 selection
313   */
314 #define GPIO_AF10_CRS          ((uint8_t)0x0A)  /* CRS Alternate Function mapping                            */
315 #if defined(STM32H503xx)
316 #define GPIO_AF10_I3C1         ((uint8_t)0x0A)  /* I3C1 Alternate Function mapping                           */
317 #define GPIO_AF10_SPI3         ((uint8_t)0x0A)  /* SPI3 Alternate Function mapping                           */
318 #endif /* STM32H503xx */
319 #if (defined(STM32H503xx) || defined(STM32H533xx) || defined(STM32H523xx))
320 #define GPIO_AF10_I3C2         ((uint8_t)0x0A)  /* I3C2 Alternate Function mapping                           */
321 #endif /* STM32H503xx || STM32H533xx || STM32H523xx */
322 #if defined(FMC_BANK1)
323 #define GPIO_AF10_FMC          ((uint8_t)0x0A)  /* FMC Alternate Function mapping                            */
324 #endif /* FMC_BANK1 */
325 #if defined(OCTOSPI1)
326 #define GPIO_AF10_OCTOSPI1     ((uint8_t)0x0A)  /* OCTOSPI1 Alternate Function mapping                       */
327 #endif /* OCTOSPI1 */
328 #if defined(SAI2)
329 #define GPIO_AF10_SAI2         ((uint8_t)0x0A)  /* SAI2 Alternate Function mapping                           */
330 #endif /* SAI2 */
331 #if (defined(STM32H533xx) || defined(STM32H523xx))
332 #define GPIO_AF10_SDMMC1       ((uint8_t)0x0A)  /* SDMMC1 Alternate Function mapping                         */
333 #endif /* STM32H533xx || STM32H523xx */
334 #if defined(SDMMC2)
335 #define GPIO_AF10_SDMMC2       ((uint8_t)0x0A)  /* SDMMC2 Alternate Function mapping                         */
336 #endif /* SDMMC2 */
337 #if defined(TIM8)
338 #define GPIO_AF10_TIM8         ((uint8_t)0x0A)  /* TIM8 Alternate Function mapping                           */
339 #endif /* TIM8 */
340 #if defined(USB_DRD_FS)
341 #define GPIO_AF10_USB          ((uint8_t)0x0A)  /* USB Alternate Function mapping                            */
342 #endif /* USB_DRD_FS */
343 
344 /**
345   * @brief   AF 11 selection
346   */
347 #if defined(ETH)
348 #define GPIO_AF11_ETH          ((uint8_t)0x0B)  /* ETH Alternate Function mapping                            */
349 #endif /* ETH */
350 #if defined(FMC_BANK1)
351 #define GPIO_AF11_FMC          ((uint8_t)0x0B)  /* FMC Alternate Function mapping                            */
352 #endif /* FMC_BANK1 */
353 #if defined(OCTOSPI1)
354 #define GPIO_AF11_OCTOSPI1     ((uint8_t)0x0B)  /* OCTOSPI1 Alternate Function mapping                       */
355 #endif /* OCTOSPI1 */
356 #if (defined(STM32H533xx) || defined(STM32H523xx))
357 #define GPIO_AF11_SDMMC1       ((uint8_t)0x0B)  /* SDMMC1 Alternate Function mapping                         */
358 #endif /* STM32H533xx || STM32H523xx */
359 #if defined(SDMMC2)
360 #define GPIO_AF11_SDMMC2       ((uint8_t)0x0B)  /* SDMMC2 Alternate Function mapping                         */
361 #endif /* SDMMC2 */
362 #if defined(UART7)
363 #define GPIO_AF11_UART7        ((uint8_t)0x0B)  /* UART7 Alternate Function mapping                          */
364 #endif /* UART7 */
365 #if defined(UART9)
366 #define GPIO_AF11_UART9        ((uint8_t)0x0B)  /* UART9 Alternate Function mapping                          */
367 #endif /* UART9 */
368 #if defined(UCPD1)
369 #define GPIO_AF11_UCPD1        ((uint8_t)0x0B)  /* UCPD1 Alternate Function mapping                          */
370 #endif /* UCPD1 */
371 #if defined(STM32H503xx)
372 #define GPIO_AF11_I2C1         ((uint8_t)0x0B)  /* I2C1 Alternate Function mapping                           */
373 #define GPIO_AF11_I2C2         ((uint8_t)0x0B)  /* I2C2 Alternate Function mapping                           */
374 #define GPIO_AF11_SPI2         ((uint8_t)0x0B)  /* SPI2 Alternate Function mapping                           */
375 #define GPIO_AF11_USART2       ((uint8_t)0x0B)  /* USART2 Alternate Function mapping                         */
376 #endif /* STM32H503xx */
377 
378 /**
379   * @brief   AF 12 selection
380   */
381 #if defined(FMC_BANK1)
382 #define GPIO_AF12_FMC          ((uint8_t)0x0C)  /* FMC Alternate Function mapping                            */
383 #endif /* FMC_BANK1 */
384 #if defined(SDMMC1)
385 #define GPIO_AF12_SDMMC1       ((uint8_t)0x0C)  /* SDMMC1 Alternate Function mapping                         */
386 #endif /* SDMMC1 */
387 #if defined(STM32H503xx)
388 #define GPIO_AF12_COMP1        ((uint8_t)0x0C)  /* COMP1 Alternate Function mapping                          */
389 #define GPIO_AF12_SPI1         ((uint8_t)0x0C)  /* SPI1 Alternate Function mapping                           */
390 #endif /* STM32H503xx */
391 
392 /**
393   * @brief   AF 13 selection
394   */
395 #if defined(DCMI)
396 #define GPIO_AF13_DCMI         ((uint8_t)0x0D)  /* DCMI Alternate Function mapping                           */
397 #define GPIO_AF13_PSSI         ((uint8_t)0x0D)  /* PSSI Alternate Function mapping                           */
398 #endif /* DCMI */
399 #if defined(FMC_BANK1)
400 #define GPIO_AF13_FMC          ((uint8_t)0x0D)  /* FMC Alternate Function mapping                            */
401 #endif /* FMC_BANK1 */
402 #if defined(LPTIM5)
403 #define GPIO_AF13_LPTIM5       ((uint8_t)0x0D)  /* LPTIM5 Alternate Function mapping                         */
404 #endif /* LPTIM5 */
405 #if defined(STM32H503xx)
406 #define GPIO_AF13_USART2       ((uint8_t)0x0D)  /* USART2 Alternate Function mapping                         */
407 #define GPIO_AF13_USART3       ((uint8_t)0x0D)  /* USART3 Alternate Function mapping                         */
408 #endif /* STM32H503xx */
409 
410 /**
411   * @brief   AF 14 selection
412   */
413 #if defined(STM32H503xx)
414 #define GPIO_AF14_LPTIM1       ((uint8_t)0x0E)  /* LPTIM1 Alternate Function mapping                         */
415 #define GPIO_AF14_LPTIM2       ((uint8_t)0x0E)  /* LPTIM2 Alternate Function mapping                         */
416 #define GPIO_AF14_TIM1         ((uint8_t)0x0E)  /* TIM1 Alternate Function mapping                           */
417 #define GPIO_AF14_TIM2         ((uint8_t)0x0E)  /* TIM2 Alternate Function mapping                           */
418 #define GPIO_AF14_TIM3         ((uint8_t)0x0E)  /* TIM3 Alternate Function mapping                           */
419 #endif /* STM32H503xx */
420 #if defined(LPTIM3)
421 #define GPIO_AF14_LPTIM3       ((uint8_t)0x0E)  /* LPTIM3 Alternate Function mapping                         */
422 #endif /* LPTIM3 */
423 #if defined(LPTIM4)
424 #define GPIO_AF14_LPTIM4       ((uint8_t)0x0E)  /* LPTIM4 Alternate Function mapping                         */
425 #endif /* LPTIM4 */
426 #if defined(LPTIM5)
427 #define GPIO_AF14_LPTIM5       ((uint8_t)0x0E)  /* LPTIM5 Alternate Function mapping                         */
428 #endif /* LPTIM5 */
429 #if defined(LPTIM6)
430 #define GPIO_AF14_LPTIM6       ((uint8_t)0x0E)  /* LPTIM6 Alternate Function mapping                         */
431 #endif /* LPTIM6 */
432 #if defined(STM32H573xx) || defined(STM32H563xx) || defined(STM32H562xx) || defined(STM32H533xx) || defined(STM32H523xx)
433 #define GPIO_AF14_TIM2         ((uint8_t)0x0E)  /* TIM2 Alternate Function mapping                           */
434 #endif /* STM32H573xx || STM32H563xx || STM32H562xx || STM32H533xx || STM32H523xx */
435 #if defined(UART5)
436 #define GPIO_AF14_UART5        ((uint8_t)0x0E)  /* UART5 Alternate Function mapping                          */
437 #endif /* UART5 */
438 #if (defined(STM32H533xx) || defined(STM32H523xx))
439 #define GPIO_AF14_USART6       ((uint8_t)0x0E)  /* USART6 Alternate Function mapping                         */
440 #endif /* STM32H533xx || STM32H523xx */
441 
442 /**
443   * @brief   AF 15 selection
444   */
445 #define GPIO_AF15_EVENTOUT     ((uint8_t)0x0F)  /* EVENTOUT Alternate Function mapping */
446 
447 #define IS_GPIO_AF(AF)   ((AF) <= (uint8_t)0x0F)
448 
449 
450 /**
451   * @}
452   */
453 
454 /**
455   * @}
456   */
457 
458 /* Exported macro ------------------------------------------------------------*/
459 /** @defgroup GPIOEx_Exported_Macros GPIOEx Exported Macros
460   * @{
461   */
462 
463 /** @defgroup GPIOEx_Get_Port_Index GPIOEx_Get Port Index
464   * @{
465   */
466 
467 
468 /* GPIO_Peripheral_Memory_Mapping Peripheral Memory Mapping */
469 
470 #if defined(STM32H573xx) || defined(STM32H563xx) || defined(STM32H562xx) || defined(STM32H533xx) || \
471     defined(STM32H523xx) || defined(STM32H503xx)
472 #define GPIO_GET_INDEX(__GPIOx__)           (((uint32_t )(__GPIOx__) & (~GPIOA_BASE)) >> 10)
473 #endif /* (defined(STM32H573xx) || defined(STM32H563xx) || defined(STM32H562xx) || defined(STM32H533xx) || \
474           defined(STM32H523xx) || defined(STM32H503xx) */
475 
476 
477 /**
478   * @}
479   */
480 
481 /**
482   * @}
483   */
484 
485 /* Exported functions --------------------------------------------------------*/
486 
487 /**
488   * @}
489   */
490 
491 /**
492   * @}
493   */
494 
495 #ifdef __cplusplus
496 }
497 #endif
498 
499 #endif /* STM32H5xx_HAL_GPIO_EX_H */
500