1 /**
2   ******************************************************************************
3   * @file    stm32h7xx_hal_gpio_ex.h
4   * @author  MCD Application Team
5   * @brief   Header file of GPIO HAL Extension module.
6   ******************************************************************************
7   * @attention
8   *
9   * Copyright (c) 2017 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 STM32H7xx_HAL_GPIO_EX_H
21 #define STM32H7xx_HAL_GPIO_EX_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32h7xx_hal_def.h"
29 
30 /** @addtogroup STM32H7xx_HAL_Driver
31   * @{
32   */
33 
34 /** @addtogroup GPIOEx GPIOEx
35   * @{
36   */
37 
38 /* Exported types ------------------------------------------------------------*/
39 
40 /* Exported constants --------------------------------------------------------*/
41 /** @defgroup GPIOEx_Exported_Constants GPIO Exported Constants
42   * @{
43   */
44 
45 /** @defgroup GPIO_Alternate_function_selection GPIO 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_LCDBIAS       ((uint8_t)0x00)  /* LCDBIAS Alternate Function mapping                                                      */
56 #define GPIO_AF0_TRACE         ((uint8_t)0x00)  /* TRACE Alternate Function mapping                                                        */
57 #if defined (PWR_CPUCR_PDDS_D2) /* PWR D1 and D2 domains exists */
58 #define GPIO_AF0_C1DSLEEP      ((uint8_t)0x00)  /* Cortex-M7 Deep Sleep Alternate Function mapping : available on STM32H7 Rev.B and above  */
59 #define GPIO_AF0_C1SLEEP       ((uint8_t)0x00)  /* Cortex-M7 Sleep Alternate Function mapping : available on STM32H7 Rev.B and above       */
60 #define GPIO_AF0_D1PWREN       ((uint8_t)0x00)  /* Domain 1 PWR enable Alternate Function mapping : available on STM32H7 Rev.B and above   */
61 #define GPIO_AF0_D2PWREN       ((uint8_t)0x00)  /* Domain 2 PWR enable Alternate Function mapping : available on STM32H7 Rev.B and above   */
62 #if defined(DUAL_CORE)
63 #define GPIO_AF0_C2DSLEEP      ((uint8_t)0x00)  /* Cortex-M4 Deep Sleep Alternate Function mapping : available on STM32H7 Rev.B and above  */
64 #define GPIO_AF0_C2SLEEP       ((uint8_t)0x00)  /* Cortex-M4 Sleep Alternate Function mapping : available on STM32H7 Rev.B and above       */
65 #endif /* DUAL_CORE */
66 #endif /* PWR_CPUCR_PDDS_D2 */
67 
68 /**
69   * @brief   AF 1 selection
70   */
71 #define GPIO_AF1_TIM1          ((uint8_t)0x01)  /* TIM1 Alternate Function mapping   */
72 #define GPIO_AF1_TIM2          ((uint8_t)0x01)  /* TIM2 Alternate Function mapping   */
73 #define GPIO_AF1_TIM16         ((uint8_t)0x01)  /* TIM16 Alternate Function mapping  */
74 #define GPIO_AF1_TIM17         ((uint8_t)0x01)  /* TIM17 Alternate Function mapping  */
75 #define GPIO_AF1_LPTIM1        ((uint8_t)0x01)  /* LPTIM1 Alternate Function mapping */
76 #if defined(HRTIM1)
77 #define GPIO_AF1_HRTIM1        ((uint8_t)0x01)  /* HRTIM1 Alternate Function mapping */
78 #endif /* HRTIM1 */
79 #if defined(SAI4)
80 #define GPIO_AF1_SAI4          ((uint8_t)0x01)  /* SAI4 Alternate Function mapping : available on STM32H72xxx/STM32H73xxx */
81 #endif /* SAI4 */
82 #define GPIO_AF1_FMC           ((uint8_t)0x01)  /* FMC Alternate Function mapping : available on STM32H72xxx/STM32H73xxx */
83 
84 
85 /**
86   * @brief   AF 2 selection
87   */
88 #define GPIO_AF2_TIM3          ((uint8_t)0x02)  /* TIM3 Alternate Function mapping   */
89 #define GPIO_AF2_TIM4          ((uint8_t)0x02)  /* TIM4 Alternate Function mapping   */
90 #define GPIO_AF2_TIM5          ((uint8_t)0x02)  /* TIM5 Alternate Function mapping   */
91 #define GPIO_AF2_TIM12         ((uint8_t)0x02)  /* TIM12 Alternate Function mapping  */
92 #define GPIO_AF2_SAI1          ((uint8_t)0x02)  /* SAI1 Alternate Function mapping   */
93 #if defined(HRTIM1)
94 #define GPIO_AF2_HRTIM1        ((uint8_t)0x02)  /* HRTIM1 Alternate Function mapping */
95 #endif /* HRTIM1 */
96 #define GPIO_AF2_TIM15         ((uint8_t)0x02)  /* TIM15 Alternate Function mapping : available on STM32H7A3xxx/STM32H7B3xxx/STM32H7B0xxx and STM32H72xxx/STM32H73xxx */
97 #if defined(FDCAN3)
98 #define GPIO_AF2_FDCAN3        ((uint8_t)0x02)  /* FDCAN3 Alternate Function mapping */
99 #endif /*FDCAN3*/
100 
101 /**
102   * @brief   AF 3 selection
103   */
104 #define GPIO_AF3_TIM8          ((uint8_t)0x03)  /* TIM8 Alternate Function mapping   */
105 #define GPIO_AF3_LPTIM2        ((uint8_t)0x03)  /* LPTIM2 Alternate Function mapping */
106 #define GPIO_AF3_DFSDM1        ((uint8_t)0x03)  /* DFSDM Alternate Function mapping  */
107 #define GPIO_AF3_LPTIM3        ((uint8_t)0x03)  /* LPTIM3 Alternate Function mapping */
108 #define GPIO_AF3_LPTIM4        ((uint8_t)0x03)  /* LPTIM4 Alternate Function mapping */
109 #define GPIO_AF3_LPTIM5        ((uint8_t)0x03)  /* LPTIM5 Alternate Function mapping */
110 #define GPIO_AF3_LPUART        ((uint8_t)0x03)  /* LPUART Alternate Function mapping */
111 #if defined(OCTOSPIM)
112 #define GPIO_AF3_OCTOSPIM_P1   ((uint8_t)0x03)  /* OCTOSPI Manager Port 1 Alternate Function mapping */
113 #define GPIO_AF3_OCTOSPIM_P2   ((uint8_t)0x03)  /* OCTOSPI Manager Port 2 Alternate Function mapping */
114 #endif /* OCTOSPIM */
115 #if defined(HRTIM1)
116 #define GPIO_AF3_HRTIM1        ((uint8_t)0x03)  /* HRTIM1 Alternate Function mapping */
117 #endif /* HRTIM1 */
118 #define GPIO_AF3_LTDC          ((uint8_t)0x03)  /* LTDC Alternate Function mapping : available on STM32H72xxx/STM32H73xxx */
119 
120 /**
121   * @brief   AF 4 selection
122   */
123 #define GPIO_AF4_I2C1          ((uint8_t)0x04)  /* I2C1 Alternate Function mapping   */
124 #define GPIO_AF4_I2C2          ((uint8_t)0x04)  /* I2C2 Alternate Function mapping   */
125 #define GPIO_AF4_I2C3          ((uint8_t)0x04)  /* I2C3 Alternate Function mapping   */
126 #define GPIO_AF4_I2C4          ((uint8_t)0x04)  /* I2C4 Alternate Function mapping   */
127 #if defined(I2C5)
128 #define GPIO_AF4_I2C5          ((uint8_t)0x04)  /* I2C5 Alternate Function mapping   */
129 #endif /* I2C5*/
130 #define GPIO_AF4_TIM15         ((uint8_t)0x04)  /* TIM15 Alternate Function mapping  */
131 #define GPIO_AF4_CEC           ((uint8_t)0x04)  /* CEC Alternate Function mapping    */
132 #define GPIO_AF4_LPTIM2        ((uint8_t)0x04)  /* LPTIM2 Alternate Function mapping */
133 #define GPIO_AF4_USART1        ((uint8_t)0x04)  /* USART1 Alternate Function mapping */
134 #if defined(USART10)
135 #define GPIO_AF4_USART10       ((uint8_t)0x04)  /* USART10 Alternate Function mapping : available on STM32H72xxx/STM32H73xxx */
136 #endif /*USART10*/
137 #define GPIO_AF4_DFSDM1        ((uint8_t)0x04)  /* DFSDM  Alternate Function mapping */
138 #if defined(DFSDM2_BASE)
139 #define GPIO_AF4_DFSDM2        ((uint8_t)0x04)  /* DFSDM2 Alternate Function mapping */
140 #endif /* DFSDM2_BASE */
141 #define GPIO_AF4_DCMI          ((uint8_t)0x04)   /* DCMI Alternate Function mapping : available on STM32H7A3xxx/STM32H7B3xxx/STM32H7B0xxx and STM32H72xxx/STM32H73xxx */
142 #if defined(PSSI)
143 #define GPIO_AF4_PSSI          ((uint8_t)0x04)  /* PSSI Alternate Function mapping   */
144 #endif /* PSSI */
145 #if defined(OCTOSPIM)
146 #define GPIO_AF4_OCTOSPIM_P1   ((uint8_t)0x04)  /* OCTOSPI Manager Port 1 Alternate Function mapping  : available on STM32H72xxx/STM32H73xxx */
147 #endif /* OCTOSPIM */
148 
149 /**
150   * @brief   AF 5 selection
151   */
152 #define GPIO_AF5_SPI1          ((uint8_t)0x05)  /* SPI1 Alternate Function mapping   */
153 #define GPIO_AF5_SPI2          ((uint8_t)0x05)  /* SPI2 Alternate Function mapping   */
154 #define GPIO_AF5_SPI3          ((uint8_t)0x05)  /* SPI3 Alternate Function mapping   */
155 #define GPIO_AF5_SPI4          ((uint8_t)0x05)  /* SPI4 Alternate Function mapping   */
156 #define GPIO_AF5_SPI5          ((uint8_t)0x05)  /* SPI5 Alternate Function mapping   */
157 #define GPIO_AF5_SPI6          ((uint8_t)0x05)  /* SPI6 Alternate Function mapping   */
158 #define GPIO_AF5_CEC           ((uint8_t)0x05)  /* CEC  Alternate Function mapping   */
159 #if defined(FDCAN3)
160 #define GPIO_AF5_FDCAN3        ((uint8_t)0x05)  /* FDCAN3 Alternate Function mapping */
161 #endif /*FDCAN3*/
162 
163 /**
164   * @brief   AF 6 selection
165   */
166 #define GPIO_AF6_SPI2          ((uint8_t)0x06)  /* SPI2 Alternate Function mapping   */
167 #define GPIO_AF6_SPI3          ((uint8_t)0x06)  /* SPI3 Alternate Function mapping   */
168 #define GPIO_AF6_SAI1          ((uint8_t)0x06)  /* SAI1 Alternate Function mapping   */
169 #define GPIO_AF6_I2C4          ((uint8_t)0x06)  /* I2C4 Alternate Function mapping   */
170 #if defined(I2C5)
171 #define GPIO_AF6_I2C5          ((uint8_t)0x06)  /* I2C5 Alternate Function mapping   */
172 #endif /* I2C5*/
173 #define GPIO_AF6_DFSDM1        ((uint8_t)0x06)  /* DFSDM Alternate Function mapping  */
174 #define GPIO_AF6_UART4         ((uint8_t)0x06)  /* UART4 Alternate Function mapping  */
175 #if defined(DFSDM2_BASE)
176 #define GPIO_AF6_DFSDM2        ((uint8_t)0x06)  /* DFSDM2 Alternate Function mapping */
177 #endif /* DFSDM2_BASE */
178 #if defined(SAI3)
179 #define GPIO_AF6_SAI3          ((uint8_t)0x06)  /* SAI3 Alternate Function mapping   */
180 #endif /* SAI3 */
181 #if defined(OCTOSPIM)
182 #define GPIO_AF6_OCTOSPIM_P1   ((uint8_t)0x06)  /* OCTOSPI Manager Port 1 Alternate Function mapping */
183 #endif /* OCTOSPIM */
184 
185 /**
186   * @brief   AF 7 selection
187   */
188 #define GPIO_AF7_SPI2          ((uint8_t)0x07)  /* SPI2 Alternate Function mapping   */
189 #define GPIO_AF7_SPI3          ((uint8_t)0x07)  /* SPI3 Alternate Function mapping   */
190 #define GPIO_AF7_SPI6          ((uint8_t)0x07)  /* SPI6 Alternate Function mapping   */
191 #define GPIO_AF7_USART1        ((uint8_t)0x07)  /* USART1 Alternate Function mapping */
192 #define GPIO_AF7_USART2        ((uint8_t)0x07)  /* USART2 Alternate Function mapping */
193 #define GPIO_AF7_USART3        ((uint8_t)0x07)  /* USART3 Alternate Function mapping */
194 #define GPIO_AF7_USART6        ((uint8_t)0x07)  /* USART6 Alternate Function mapping */
195 #define GPIO_AF7_UART7         ((uint8_t)0x07)  /* UART7 Alternate Function mapping  */
196 #define GPIO_AF7_SDMMC1        ((uint8_t)0x07)  /* SDMMC1 Alternate Function mapping */
197 
198 /**
199   * @brief   AF 8 selection
200   */
201 #define GPIO_AF8_SPI6          ((uint8_t)0x08)  /* SPI6 Alternate Function mapping   */
202 #if defined(SAI2)
203 #define GPIO_AF8_SAI2          ((uint8_t)0x08)  /* SAI2 Alternate Function mapping   */
204 #endif /*SAI2*/
205 #define GPIO_AF8_UART4         ((uint8_t)0x08)  /* UART4 Alternate Function mapping  */
206 #define GPIO_AF8_UART5         ((uint8_t)0x08)  /* UART5 Alternate Function mapping  */
207 #define GPIO_AF8_UART8         ((uint8_t)0x08)  /* UART8 Alternate Function mapping  */
208 #define GPIO_AF8_SPDIF         ((uint8_t)0x08)  /* SPDIF Alternate Function mapping  */
209 #define GPIO_AF8_LPUART        ((uint8_t)0x08)  /* LPUART Alternate Function mapping */
210 #define GPIO_AF8_SDMMC1        ((uint8_t)0x08)  /* SDMMC1 Alternate Function mapping */
211 #if defined(SAI4)
212 #define GPIO_AF8_SAI4          ((uint8_t)0x08)  /* SAI4 Alternate Function mapping   */
213 #endif /* SAI4 */
214 
215 /**
216   * @brief   AF 9 selection
217   */
218 #define GPIO_AF9_FDCAN1        ((uint8_t)0x09)  /* FDCAN1 Alternate Function mapping   */
219 #define GPIO_AF9_FDCAN2        ((uint8_t)0x09)  /* FDCAN2 Alternate Function mapping   */
220 #define GPIO_AF9_TIM13         ((uint8_t)0x09)  /* TIM13 Alternate Function mapping    */
221 #define GPIO_AF9_TIM14         ((uint8_t)0x09)  /* TIM14 Alternate Function mapping    */
222 #define GPIO_AF9_SDMMC2        ((uint8_t)0x09)  /* SDMMC2 Alternate Function mapping   */
223 #define GPIO_AF9_LTDC          ((uint8_t)0x09)  /* LTDC Alternate Function mapping     */
224 #define GPIO_AF9_SPDIF         ((uint8_t)0x09)  /* SPDIF Alternate Function mapping    */
225 #define GPIO_AF9_FMC           ((uint8_t)0x09)  /* FMC Alternate Function mapping      */
226 #if defined(QUADSPI)
227 #define GPIO_AF9_QUADSPI       ((uint8_t)0x09)  /* QUADSPI Alternate Function mapping  */
228 #endif /* QUADSPI */
229 #if defined(SAI4)
230 #define GPIO_AF9_SAI4          ((uint8_t)0x09)  /* SAI4 Alternate Function mapping     */
231 #endif /* SAI4 */
232 #if defined(OCTOSPIM)
233 #define GPIO_AF9_OCTOSPIM_P1   ((uint8_t)0x09)  /* OCTOSPI Manager Port 1 Alternate Function mapping */
234 #define GPIO_AF9_OCTOSPIM_P2   ((uint8_t)0x09)  /* OCTOSPI Manager Port 2 Alternate Function mapping */
235 #endif /* OCTOSPIM */
236 
237 /**
238   * @brief   AF 10 selection
239   */
240 #if defined(SAI2)
241 #define GPIO_AF10_SAI2          ((uint8_t)0x0A)  /* SAI2 Alternate Function mapping                                             */
242 #endif /*SAI2*/
243 #define GPIO_AF10_SDMMC2        ((uint8_t)0x0A)  /* SDMMC2 Alternate Function mapping                                           */
244 #if defined(USB2_OTG_FS)
245 #define GPIO_AF10_OTG2_FS       ((uint8_t)0x0A)  /* OTG2_FS Alternate Function mapping                                          */
246 #endif /*USB2_OTG_FS*/
247 #define GPIO_AF10_COMP1         ((uint8_t)0x0A)  /* COMP1 Alternate Function mapping                                            */
248 #define GPIO_AF10_COMP2         ((uint8_t)0x0A)  /* COMP2 Alternate Function mapping                                            */
249 #if defined(LTDC)
250 #define GPIO_AF10_LTDC          ((uint8_t)0x0A)  /* LTDC Alternate Function mapping                                             */
251 #endif /*LTDC*/
252 #define GPIO_AF10_CRS_SYNC      ((uint8_t)0x0A)  /* CRS Sync Alternate Function mapping : available on STM32H7 Rev.B and above  */
253 #if defined(QUADSPI)
254 #define GPIO_AF10_QUADSPI       ((uint8_t)0x0A)  /* QUADSPI Alternate Function mapping                                          */
255 #endif /* QUADSPI */
256 #if defined(SAI4)
257 #define GPIO_AF10_SAI4          ((uint8_t)0x0A)  /* SAI4 Alternate Function mapping                                             */
258 #endif /* SAI4 */
259 #if !defined(USB2_OTG_FS)
260 #define GPIO_AF10_OTG1_FS       ((uint8_t)0x0A)  /* OTG1_FS Alternate Function mapping : available on STM32H7A3xxx/STM32H7B3xxx/STM32H7B0xxx and STM32H72xxx/STM32H73xxx */
261 #endif /* !USB2_OTG_FS */
262 #define GPIO_AF10_OTG1_HS       ((uint8_t)0x0A)  /* OTG1_HS Alternate Function mapping                                          */
263 #if defined(OCTOSPIM)
264 #define GPIO_AF10_OCTOSPIM_P1   ((uint8_t)0x0A)  /* OCTOSPI Manager Port 1 Alternate Function mapping */
265 #endif /* OCTOSPIM */
266 #define GPIO_AF10_TIM8          ((uint8_t)0x0A)  /* TIM8 Alternate Function mapping                                             */
267 #define GPIO_AF10_FMC           ((uint8_t)0x0A)  /* FMC Alternate Function mapping : available on STM32H7A3xxx/STM32H7B3xxx/STM32H7B0xxx and STM32H72xxx/STM32H73xxx */
268 
269 /**
270   * @brief   AF 11 selection
271   */
272 #define GPIO_AF11_SWP           ((uint8_t)0x0B)  /* SWP Alternate Function mapping     */
273 #define GPIO_AF11_MDIOS         ((uint8_t)0x0B)  /* MDIOS Alternate Function mapping   */
274 #define GPIO_AF11_UART7         ((uint8_t)0x0B)  /* UART7 Alternate Function mapping   */
275 #define GPIO_AF11_SDMMC2        ((uint8_t)0x0B)  /* SDMMC2 Alternate Function mapping  */
276 #define GPIO_AF11_DFSDM1        ((uint8_t)0x0B)  /* DFSDM1 Alternate Function mapping  */
277 #define GPIO_AF11_COMP1         ((uint8_t)0x0B)  /* COMP1 Alternate Function mapping   */
278 #define GPIO_AF11_COMP2         ((uint8_t)0x0B)  /* COMP2 Alternate Function mapping   */
279 #define GPIO_AF11_TIM1          ((uint8_t)0x0B)  /* TIM1 Alternate Function mapping    */
280 #define GPIO_AF11_TIM8          ((uint8_t)0x0B)  /* TIM8 Alternate Function mapping    */
281 #define GPIO_AF11_I2C4          ((uint8_t)0x0B)  /* I2C4 Alternate Function mapping    */
282 #if defined(DFSDM2_BASE)
283 #define GPIO_AF11_DFSDM2        ((uint8_t)0x0B)  /* DFSDM2 Alternate Function mapping  */
284 #endif /* DFSDM2_BASE */
285 #if defined(USART10)
286 #define GPIO_AF11_USART10       ((uint8_t)0x0B)  /* USART10 Alternate Function mapping */
287 #endif /* USART10 */
288 #if defined(UART9)
289 #define GPIO_AF11_UART9         ((uint8_t)0x0B)  /* UART9 Alternate Function mapping   */
290 #endif /* UART9 */
291 #if defined(ETH)
292 #define GPIO_AF11_ETH           ((uint8_t)0x0B)  /* ETH Alternate Function mapping     */
293 #endif /* ETH */
294 #if defined(LTDC)
295 #define GPIO_AF11_LTDC          ((uint8_t)0x0B)  /* LTDC Alternate Function mapping : available on STM32H7A3xxx/STM32H7B3xxx/STM32H7B0xxx and STM32H72xxx/STM32H73xxx */
296 #endif /*LTDC*/
297 #if defined(OCTOSPIM)
298 #define GPIO_AF11_OCTOSPIM_P1   ((uint8_t)0x0B)  /* OCTOSPI Manager Port 1 Alternate Function mapping */
299 #endif /* OCTOSPIM */
300 
301 /**
302   * @brief   AF 12 selection
303   */
304 #define GPIO_AF12_FMC           ((uint8_t)0x0C)  /* FMC Alternate Function mapping     */
305 #define GPIO_AF12_SDMMC1        ((uint8_t)0x0C)  /* SDMMC1 Alternate Function mapping  */
306 #define GPIO_AF12_MDIOS         ((uint8_t)0x0C)  /* MDIOS Alternate Function mapping   */
307 #define GPIO_AF12_COMP1         ((uint8_t)0x0C)  /* COMP1 Alternate Function mapping   */
308 #define GPIO_AF12_COMP2         ((uint8_t)0x0C)  /* COMP2 Alternate Function mapping   */
309 #define GPIO_AF12_TIM1          ((uint8_t)0x0C)  /* TIM1 Alternate Function mapping    */
310 #define GPIO_AF12_TIM8          ((uint8_t)0x0C)  /* TIM8 Alternate Function mapping    */
311 #if defined(LTDC)
312 #define GPIO_AF12_LTDC          ((uint8_t)0x0C)  /* LTDC Alternate Function mapping    */
313 #endif /*LTDC*/
314 #if defined(USB2_OTG_FS)
315 #define GPIO_AF12_OTG1_FS       ((uint8_t)0x0C)  /* OTG1_FS Alternate Function mapping */
316 #endif /* USB2_OTG_FS */
317 #if defined(OCTOSPIM)
318 #define GPIO_AF12_OCTOSPIM_P1   ((uint8_t)0x0C)  /* OCTOSPI Manager Port 1 Alternate Function mapping */
319 #endif /* OCTOSPIM */
320 
321 /**
322   * @brief   AF 13 selection
323   */
324 #define GPIO_AF13_DCMI          ((uint8_t)0x0D)   /* DCMI Alternate Function mapping  */
325 #define GPIO_AF13_COMP1         ((uint8_t)0x0D)   /* COMP1 Alternate Function mapping */
326 #define GPIO_AF13_COMP2         ((uint8_t)0x0D)   /* COMP2 Alternate Function mapping */
327 #if defined(LTDC)
328 #define GPIO_AF13_LTDC          ((uint8_t)0x0D)   /* LTDC Alternate Function mapping  */
329 #endif /*LTDC*/
330 #if defined(DSI)
331 #define GPIO_AF13_DSI           ((uint8_t)0x0D)   /* DSI Alternate Function mapping   */
332 #endif /* DSI */
333 #if defined(PSSI)
334 #define GPIO_AF13_PSSI          ((uint8_t)0x0D)   /* PSSI Alternate Function mapping  */
335 #endif /* PSSI */
336 #define GPIO_AF13_TIM1          ((uint8_t)0x0D)    /* TIM1 Alternate Function mapping */
337 #if defined(TIM23)
338 #define GPIO_AF13_TIM23         ((uint8_t)0x0D)    /* TIM23 Alternate Function mapping */
339 #endif  /*TIM23*/
340 
341 /**
342   * @brief   AF 14 selection
343   */
344 #define GPIO_AF14_LTDC         ((uint8_t)0x0E)   /* LTDC Alternate Function mapping  */
345 #define GPIO_AF14_UART5        ((uint8_t)0x0E)   /* UART5 Alternate Function mapping */
346 #if defined(TIM24)
347 #define GPIO_AF14_TIM24        ((uint8_t)0x0E)   /* TIM24 Alternate Function mapping */
348 #endif  /*TIM24*/
349 
350 /**
351   * @brief   AF 15 selection
352   */
353 #define GPIO_AF15_EVENTOUT      ((uint8_t)0x0F)  /* EVENTOUT Alternate Function mapping */
354 
355 #define IS_GPIO_AF(AF)   ((AF) <= (uint8_t)0x0F)
356 
357 
358 
359 /**
360   * @}
361   */
362 
363 /**
364   * @}
365   */
366 
367 /* Exported macro ------------------------------------------------------------*/
368 /** @defgroup GPIOEx_Exported_Macros GPIO Exported Macros
369   * @{
370   */
371 /**
372   * @}
373   */
374 
375 /* Exported functions --------------------------------------------------------*/
376 /** @defgroup GPIOEx_Exported_Functions GPIO Exported Functions
377   * @{
378   */
379 /**
380   * @}
381   */
382 /* Private types -------------------------------------------------------------*/
383 /* Private variables ---------------------------------------------------------*/
384 /* Private constants ---------------------------------------------------------*/
385 /** @defgroup GPIOEx_Private_Constants GPIO Private Constants
386   * @{
387   */
388 
389 /**
390   * @brief   GPIO pin available on the platform
391   */
392 /* Defines the available pins per GPIOs */
393 #define GPIOA_PIN_AVAILABLE  GPIO_PIN_All
394 #define GPIOB_PIN_AVAILABLE  GPIO_PIN_All
395 #define GPIOC_PIN_AVAILABLE  GPIO_PIN_All
396 #define GPIOD_PIN_AVAILABLE  GPIO_PIN_All
397 #define GPIOE_PIN_AVAILABLE  GPIO_PIN_All
398 #define GPIOF_PIN_AVAILABLE  GPIO_PIN_All
399 #define GPIOG_PIN_AVAILABLE  GPIO_PIN_All
400 #if defined(GPIOI)
401 #define GPIOI_PIN_AVAILABLE  GPIO_PIN_All
402 #endif /*GPIOI*/
403 #if defined(GPIOI)
404 #define GPIOJ_PIN_AVAILABLE  GPIO_PIN_All
405 #else
406 #define GPIOJ_PIN_AVAILABLE  (GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 )
407 #endif /* GPIOI */
408 #define GPIOH_PIN_AVAILABLE  GPIO_PIN_All
409 #if defined(GPIOI)
410 #define GPIOK_PIN_AVAILABLE  (GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | \
411                               GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7)
412 #else
413 #define GPIOK_PIN_AVAILABLE  (GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 )
414 #endif /* GPIOI */
415 
416 /**
417   * @}
418   */
419 
420 /* Private macros ------------------------------------------------------------*/
421 /** @defgroup GPIOEx_Private_Macros GPIO Private Macros
422   * @{
423   */
424 /** @defgroup GPIOEx_Get_Port_Index GPIO Get Port Index
425   * @{
426   */
427 #if defined(GPIOI)
428 #define GPIO_GET_INDEX(__GPIOx__)  (((__GPIOx__) == (GPIOA))? 0UL :\
429                                     ((__GPIOx__) == (GPIOB))? 1UL :\
430                                     ((__GPIOx__) == (GPIOC))? 2UL :\
431                                     ((__GPIOx__) == (GPIOD))? 3UL :\
432                                     ((__GPIOx__) == (GPIOE))? 4UL :\
433                                     ((__GPIOx__) == (GPIOF))? 5UL :\
434                                     ((__GPIOx__) == (GPIOG))? 6UL :\
435                                     ((__GPIOx__) == (GPIOH))? 7UL :\
436                                     ((__GPIOx__) == (GPIOI))? 8UL :\
437                                     ((__GPIOx__) == (GPIOJ))? 9UL : 10UL)
438 #else
439 #define GPIO_GET_INDEX(__GPIOx__)  (((__GPIOx__) == (GPIOA))? 0UL :\
440                                     ((__GPIOx__) == (GPIOB))? 1UL :\
441                                     ((__GPIOx__) == (GPIOC))? 2UL :\
442                                     ((__GPIOx__) == (GPIOD))? 3UL :\
443                                     ((__GPIOx__) == (GPIOE))? 4UL :\
444                                     ((__GPIOx__) == (GPIOF))? 5UL :\
445                                     ((__GPIOx__) == (GPIOG))? 6UL :\
446                                     ((__GPIOx__) == (GPIOH))? 7UL :\
447                                     ((__GPIOx__) == (GPIOJ))? 9UL : 10UL)
448 #endif /* GPIOI */
449 
450 /**
451   * @}
452   */
453 
454 /** @defgroup GPIOEx_IS_Alternat_function_selection GPIO Check Alternate Function
455   * @{
456   */
457 /**
458   * @}
459   */
460 
461 /**
462   * @}
463   */
464 
465 /* Private functions ---------------------------------------------------------*/
466 /** @defgroup GPIOEx_Private_Functions GPIO Private Functions
467   * @{
468   */
469 
470 /**
471   * @}
472   */
473 
474 /**
475   * @}
476   */
477 
478 /**
479   * @}
480   */
481 
482 #ifdef __cplusplus
483 }
484 #endif
485 
486 #endif /* STM32H7xx_HAL_GPIO_EX_H */
487 
488