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