1 /**
2   ******************************************************************************
3   * @file    stm32u5xx_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) 2021 STMicroelectronics.
10   * All rights reserved.
11   *
12   * This software component is licensed by ST under BSD 3-Clause license,
13   * the "License"; You may not use this file except in compliance with the
14   * License. You may obtain a copy of the License at:
15   *                        opensource.org/licenses/BSD-3-Clause
16   *
17   ******************************************************************************
18   */
19 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef STM32U5xx_HAL_GPIO_EX_H
22 #define STM32U5xx_HAL_GPIO_EX_H
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32u5xx_hal_def.h"
30 
31 /** @addtogroup STM32U5xx_HAL_Driver
32   * @{
33   */
34 
35 /** @defgroup GPIOEx GPIOEx
36   * @brief GPIO Extended HAL module driver
37   * @{
38   */
39 
40 /* Exported types ------------------------------------------------------------*/
41 /** @defgroup LPGPIO_MapTypeDef GPIO/Ex Exported Types
42   * @{
43   */
44 typedef struct
45 {
46   GPIO_TypeDef *GPIO_PORT;
47   uint32_t Pin_Pos;
48 } LPGPIO_MapTypeDef;
49 /**
50   * @}
51   */
52 
53 /* Exported constants --------------------------------------------------------*/
54 
55 /** @defgroup GPIOEx_Exported_Constants GPIOEx Exported Constants
56   * @{
57   */
58 
59 /** @defgroup GPIOEx_Alternate_function_selection GPIOEx Alternate function selection
60   * @{
61   */
62 
63 #if (defined(STM32U575xx) || defined(STM32U585xx))
64 /*--------------STM32U575xx/STM32U585xx---------------------------*/
65 /**
66   * @brief   AF 0 selection
67   */
68 #define GPIO_AF0_RTC_50Hz      ((uint8_t)0x00)  /* RTC_50Hz Alternate Function mapping                       */
69 #define GPIO_AF0_MCO           ((uint8_t)0x00)  /* MCO (MCO1 and MCO2) Alternate Function mapping            */
70 #define GPIO_AF0_SWJ           ((uint8_t)0x00)  /* SWJ (SWD and JTAG) Alternate Function mapping             */
71 #define GPIO_AF0_TRACE         ((uint8_t)0x00)  /* TRACE Alternate Function mapping                          */
72 #define GPIO_AF0_LPTIM1        ((uint8_t)0x00)  /* LPTIM1 Alternate Function mapping                         */
73 #define GPIO_AF0_CSLEEP        ((uint8_t)0x00)  /* CSLEEP Alternate Function mapping                         */
74 #define GPIO_AF0_CSTOP         ((uint8_t)0x00)  /* CSTOP Alternate Function mapping                          */
75 #define GPIO_AF0_SRDSTOP       ((uint8_t)0x00)  /* SRDSTOP Alternate Function mapping                        */
76 #define GPIO_AF0_CRS           ((uint8_t)0x00)  /* CRS Alternate Function mapping                            */
77 
78 /**
79   * @brief   AF 1 selection
80   */
81 #define GPIO_AF1_TIM1          ((uint8_t)0x01)  /* TIM1 Alternate Function mapping                           */
82 #define GPIO_AF1_TIM2          ((uint8_t)0x01)  /* TIM2 Alternate Function mapping                           */
83 #define GPIO_AF1_TIM5          ((uint8_t)0x01)  /* TIM5 Alternate Function mapping                           */
84 #define GPIO_AF1_TIM8          ((uint8_t)0x01)  /* TIM8 Alternate Function mapping                           */
85 #define GPIO_AF1_LPTIM1        ((uint8_t)0x01)  /* LPTIM1 Alternate Function mapping                         */
86 #define GPIO_AF1_IR            ((uint8_t)0x01)  /* IR Alternate Function mapping                             */
87 
88 /**
89   * @brief   AF 2 selection
90   */
91 #define GPIO_AF2_TIM1          ((uint8_t)0x02)  /* TIM1 Alternate Function mapping                           */
92 #define GPIO_AF2_TIM2          ((uint8_t)0x02)  /* TIM2 Alternate Function mapping                           */
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_LPTIM2        ((uint8_t)0x02)  /* LPTIM2 Alternate Function mapping                         */
97 #define GPIO_AF2_LPTIM3        ((uint8_t)0x02)  /* LPTIM3 Alternate Function mapping                         */
98 
99 /**
100   * @brief   AF 3 selection
101   */
102 #define GPIO_AF3_I2C4          ((uint8_t)0x03)  /* I2C4 Alternate Function mapping                           */
103 #define GPIO_AF3_OCTOSPI1      ((uint8_t)0x03)  /* OCTOSPI1 Alternate Function mapping                       */
104 #define GPIO_AF3_SAI1          ((uint8_t)0x03)  /* SAI1 Alternate Function mapping                           */
105 #define GPIO_AF3_SPI2          ((uint8_t)0x03)  /* SPI2 Alternate Function mapping                           */
106 #define GPIO_AF3_TIM8          ((uint8_t)0x03)  /* TIM8 Alternate Function mapping                           */
107 #define GPIO_AF3_TIM8_COMP1    ((uint8_t)0x03)  /* TIM8/COMP1 Break in Alternate Function mapping            */
108 #define GPIO_AF3_TIM8_COMP2    ((uint8_t)0x03)  /* TIM8/COMP2 Break in Alternate Function mapping            */
109 #define GPIO_AF3_TIM1_COMP1    ((uint8_t)0x03)  /* TIM1/COMP1 Break in Alternate Function mapping            */
110 #define GPIO_AF3_TIM1_COMP2    ((uint8_t)0x03)  /* TIM1/COMP2 Break in Alternate Function mapping            */
111 #define GPIO_AF3_USART2        ((uint8_t)0x03)  /* USART2 Alternate Function mapping                         */
112 #define GPIO_AF3_ADF1          ((uint8_t)0x03)  /* ADF1 Alternate Function mapping                           */
113 
114 /**
115   * @brief   AF 4 selection
116   */
117 #define GPIO_AF4_I2C1          ((uint8_t)0x04)  /* I2C1 Alternate Function mapping                           */
118 #define GPIO_AF4_I2C2          ((uint8_t)0x04)  /* I2C2 Alternate Function mapping                           */
119 #define GPIO_AF4_I2C3          ((uint8_t)0x04)  /* I2C3 Alternate Function mapping                           */
120 #define GPIO_AF4_I2C4          ((uint8_t)0x04)  /* I2C4 Alternate Function mapping                           */
121 #define GPIO_AF4_USART1        ((uint8_t)0x04)  /* USART1 Alternate Function mapping                         */
122 #define GPIO_AF4_PSSI          ((uint8_t)0x04)  /* PSSI Alternate Function mapping                           */
123 #define GPIO_AF4_DCMI          ((uint8_t)0x04)  /* DCMI Alternate Function mapping                           */
124 #define GPIO_AF4_LPTIM3        ((uint8_t)0x04)  /* LPTIM3 Alternate Function mapping                         */
125 
126 /**
127   * @brief   AF 5 selection
128   */
129 #define GPIO_AF5_DFSDM1        ((uint8_t)0x05)  /* DFSDM1 Alternate Function mapping                         */
130 #define GPIO_AF5_I2C4          ((uint8_t)0x05)  /* I2C4 Alternate Function mapping                           */
131 #define GPIO_AF5_PSSI          ((uint8_t)0x05)  /* PSSI Alternate Function mapping                           */
132 #define GPIO_AF5_OCTOSPI1      ((uint8_t)0x05)  /* OCTOSPI1 Alternate Function mapping                       */
133 #define GPIO_AF5_OCTOSPI2      ((uint8_t)0x05)  /* OCTOSPI2 Alternate Function mapping                       */
134 #define GPIO_AF5_SPI1          ((uint8_t)0x05)  /* SPI1 Alternate Function mapping                           */
135 #define GPIO_AF5_SPI2          ((uint8_t)0x05)  /* SPI2 Alternate Function mapping                           */
136 #define GPIO_AF5_SPI3          ((uint8_t)0x05)  /* SPI3 Alternate Function mapping                           */
137 #define GPIO_AF5_DCMI          ((uint8_t)0x05)  /* DCMI Alternate Function mapping                           */
138 #define GPIO_AF5_MDF1          ((uint8_t)0x05)  /* MDF1 Alternate Function mapping                           */
139 
140 /**
141   * @brief   AF 6 selection
142   */
143 #define GPIO_AF6_OCTOSPI1      ((uint8_t)0x06)  /* OCTOSPI1 Alternate Function mapping                       */
144 #define GPIO_AF6_OCTOSPI2      ((uint8_t)0x06)  /* OCTOSPI2 Alternate Function mapping                       */
145 #define GPIO_AF6_MDF1          ((uint8_t)0x06)  /* MDF1 Alternate Function mapping                           */
146 #define GPIO_AF6_SPI3          ((uint8_t)0x06)  /* SPI3 Alternate Function mapping                           */
147 
148 /**
149   * @brief   AF 7 selection
150   */
151 #define GPIO_AF7_USART1        ((uint8_t)0x07)  /* USART1 Alternate Function mapping                         */
152 #define GPIO_AF7_USART2        ((uint8_t)0x07)  /* USART2 Alternate Function mapping                         */
153 #define GPIO_AF7_USART3        ((uint8_t)0x07)  /* USART3 Alternate Function mapping                         */
154 
155 /**
156   * @brief   AF 8 selection
157   */
158 #define GPIO_AF8_LPUART1       ((uint8_t)0x08)  /* LPUART1 Alternate Function mapping                        */
159 #define GPIO_AF8_UART4         ((uint8_t)0x08)  /* UART4 Alternate Function mapping                          */
160 #define GPIO_AF8_UART5         ((uint8_t)0x08)  /* UART5 Alternate Function mapping                          */
161 #define GPIO_AF8_SDMMC1        ((uint8_t)0x08)  /* SDMMC1 Alternate Function mapping                         */
162 
163 /**
164   * @brief   AF 9 selection
165   */
166 #define GPIO_AF9_FDCAN1        ((uint8_t)0x09)  /* FDCAN1 Alternate Function mapping                         */
167 #define GPIO_AF9_TSC           ((uint8_t)0x09)  /* TSC Alternate Function mapping                            */
168 
169 /**
170   * @brief   AF 10 selection
171   */
172 #define GPIO_AF10_DCMI         ((uint8_t)0x0A)  /* DCMI Alternate Function mapping                           */
173 #define GPIO_AF10_PSSI         ((uint8_t)0x0A)  /* PSSI Alternate Function mapping                           */
174 #define GPIO_AF10_USB          ((uint8_t)0x0A)  /* USB Alternate Function mapping                            */
175 #define GPIO_AF10_OCTOSPI1     ((uint8_t)0x0A)  /* OCTOSPI1 Alternate Function mapping                       */
176 #define GPIO_AF10_OCTOSPI2     ((uint8_t)0x0A)  /* OCTOSPI2 Alternate Function mapping                       */
177 #define GPIO_AF10_CRS          ((uint8_t)0x0A)  /* CRS Alternate Function mapping                            */
178 
179 /**
180   * @brief   AF 11 selection
181   */
182 #define GPIO_AF11_UCPD1        ((uint8_t)0x0B)  /* UCPD1 Alternate Function mapping                          */
183 #define GPIO_AF11_SDMMC2        ((uint8_t)0x0B)    /*!< SDMMC2 Alternate Function mapping                    */
184 #define GPIO_AF11_LPGPIO       ((uint8_t)0x0B)  /* LPGPIO Alternate Function mapping                         */
185 #define GPIO_AF11_SDMMC2       ((uint8_t)0x0B)  /* SDMMC2 Alternate Function mapping                         */
186 
187 /**
188   * @brief   AF 12 selection
189   */
190 #define GPIO_AF12_COMP1        ((uint8_t)0x0C)  /* COMP1 Alternate Function mapping                          */
191 #define GPIO_AF12_COMP2        ((uint8_t)0x0C)  /* COMP2 Alternate Function mapping                          */
192 #define GPIO_AF12_FMC          ((uint8_t)0x0C)  /* FMC Alternate Function mapping                            */
193 #define GPIO_AF12_TIM1_COMP1   ((uint8_t)0x0C)  /* TIM1/COMP1 Break in Alternate Function mapping            */
194 #define GPIO_AF12_TIM1_COMP2   ((uint8_t)0x0C)  /* TIM1/COMP2 Break in Alternate Function mapping            */
195 #define GPIO_AF12_TIM8_COMP2   ((uint8_t)0x0C)  /* TIM8/COMP2 Break in Alternate Function mapping            */
196 #define GPIO_AF12_SDMMC1       ((uint8_t)0x0C)  /* SDMMC1 Alternate Function mapping                         */
197 #define GPIO_AF12_SDMMC2       ((uint8_t)0x0C)  /* SDMMC2 Alternate Function mapping                         */
198 
199 /**
200   * @brief   AF 13 selection
201   */
202 #define GPIO_AF13_SAI1         ((uint8_t)0x0D)  /* SAI1 Alternate Function mapping                           */
203 #define GPIO_AF13_SAI2         ((uint8_t)0x0D)  /* SAI2 Alternate Function mapping                           */
204 #define GPIO_AF13_TIM8_COMP1   ((uint8_t)0x0D)  /* TIM8/COMP1 Break in Alternate Function mapping            */
205 #define GPIO_AF13_LPTIM4       ((uint8_t)0x0D)  /* LPTIM4 Alternate Function mapping                         */
206 #define GPIO_AF13_LPTIM2       ((uint8_t)0x0D)  /* LPTIM2 Alternate Function mapping                         */
207 
208 /**
209   * @brief   AF 14 selection
210   */
211 #define GPIO_AF14_LPTIM2       ((uint8_t)0x0E)  /* LPTIM2 Alternate Function mapping                         */
212 #define GPIO_AF14_LPTIM3       ((uint8_t)0x0E)  /* LPTIM3 Alternate Function mapping                         */
213 #define GPIO_AF14_TIM2         ((uint8_t)0x0E)  /* TIM2 Alternate Function mapping                           */
214 #define GPIO_AF14_TIM8_COMP2   ((uint8_t)0x0E)  /* TIM8/COMP2 Break in Alternate Function mapping            */
215 #define GPIO_AF14_TIM15        ((uint8_t)0x0E)  /* TIM15 Alternate Function mapping                          */
216 #define GPIO_AF14_TIM15_COMP1  ((uint8_t)0x0E)  /* TIM15/COMP1 Alternate Function mapping                    */
217 #define GPIO_AF14_TIM16        ((uint8_t)0x0E)  /* TIM16 Alternate Function mapping                          */
218 #define GPIO_AF14_TIM16_COMP1  ((uint8_t)0x0E)  /* TIM16/COMP1 Alternate Function mapping                    */
219 #define GPIO_AF14_TIM17        ((uint8_t)0x0E)  /* TIM17 Alternate Function mapping                          */
220 #define GPIO_AF14_TIM17_COMP1  ((uint8_t)0x0E)  /* TIM17/COMP1 Alternate Function mapping                    */
221 #define GPIO_AF14_SDMMC2       ((uint8_t)0x0E)  /* SDMMC2 Alternate Function mapping                         */
222 
223 
224 /**
225   * @brief   AF 15 selection
226   */
227 #define GPIO_AF15_EVENTOUT     ((uint8_t)0x0F)  /* EVENTOUT Alternate Function mapping                       */
228 
229 #define IS_GPIO_AF(AF)   ((AF) <= (uint8_t)0x0F)
230 
231 #elif (defined(STM32U599xx) || defined(STM32U5A9xx) || defined(STM32U595xx) || defined(STM32U5A5xx))
232 
233 /*--------------STM32U5xxxx---*/
234 /**
235   * @brief   AF 0 selection
236   */
237 #define GPIO_AF0_RTC_50Hz      ((uint8_t)0x00)  /* RTC_50Hz Alternate Function mapping                       */
238 #define GPIO_AF0_MCO           ((uint8_t)0x00)  /* MCO (MCO1 and MCO2) Alternate Function mapping            */
239 #define GPIO_AF0_SWJ           ((uint8_t)0x00)  /* SWJ (SWD and JTAG) Alternate Function mapping             */
240 #define GPIO_AF0_TRACE         ((uint8_t)0x00)  /* TRACE Alternate Function mapping                          */
241 #define GPIO_AF0_LPTIM1        ((uint8_t)0x00)  /* LPTIM1 Alternate Function mapping                         */
242 #define GPIO_AF0_CSLEEP        ((uint8_t)0x00)  /* CSLEEP Alternate Function mapping                         */
243 #define GPIO_AF0_CSTOP         ((uint8_t)0x00)  /* CSTOP Alternate Function mapping                          */
244 #define GPIO_AF0_S2DSTOP       ((uint8_t)0x00)  /* S2DSTOP Alternate Function mapping                        */
245 #define GPIO_AF0_CRS           ((uint8_t)0x00)  /* CRS Alternate Function mapping                            */
246 
247 /**
248   * @brief   AF 1 selection
249   */
250 #define GPIO_AF1_TIM1          ((uint8_t)0x01)  /* TIM1 Alternate Function mapping                           */
251 #define GPIO_AF1_TIM2          ((uint8_t)0x01)  /* TIM2 Alternate Function mapping                           */
252 #define GPIO_AF1_TIM5          ((uint8_t)0x01)  /* TIM5 Alternate Function mapping                           */
253 #define GPIO_AF1_TIM8          ((uint8_t)0x01)  /* TIM8 Alternate Function mapping                           */
254 #define GPIO_AF1_LPTIM1        ((uint8_t)0x01)  /* LPTIM1 Alternate Function mapping                         */
255 #define GPIO_AF1_IR            ((uint8_t)0x01)  /* IR Alternate Function mapping                             */
256 
257 /**
258   * @brief   AF 2 selection
259   */
260 #define GPIO_AF2_TIM1          ((uint8_t)0x02)  /* TIM1 Alternate Function mapping                           */
261 #define GPIO_AF2_TIM2          ((uint8_t)0x02)  /* TIM2 Alternate Function mapping                           */
262 #define GPIO_AF2_TIM3          ((uint8_t)0x02)  /* TIM3 Alternate Function mapping                           */
263 #define GPIO_AF2_TIM4          ((uint8_t)0x02)  /* TIM4 Alternate Function mapping                           */
264 #define GPIO_AF2_TIM5          ((uint8_t)0x02)  /* TIM5 Alternate Function mapping                           */
265 #define GPIO_AF2_LPTIM1        ((uint8_t)0x02)  /* LPTIM1 Alternate Function mapping                         */
266 #define GPIO_AF2_LPTIM2        ((uint8_t)0x02)  /* LPTIM2 Alternate Function mapping                         */
267 #define GPIO_AF2_LPTIM3        ((uint8_t)0x02)  /* LPTIM3 Alternate Function mapping                         */
268 #define GPIO_AF2_I2C5          ((uint8_t)0x02)  /* I2C4 Alternate Function mapping                           */
269 #define GPIO_AF2_I2C6          ((uint8_t)0x02)  /* I2C4 Alternate Function mapping                           */
270 
271 /**
272   * @brief   AF 3 selection
273   */
274 #define GPIO_AF3_I2C4          ((uint8_t)0x03)  /* I2C4 Alternate Function mapping                           */
275 #define GPIO_AF3_OCTOSPI1      ((uint8_t)0x03)  /* OCTOSPI1 Alternate Function mapping                       */
276 #define GPIO_AF3_SAI1          ((uint8_t)0x03)  /* SAI1 Alternate Function mapping                           */
277 #define GPIO_AF3_SPI2          ((uint8_t)0x03)  /* SPI2 Alternate Function mapping                           */
278 #define GPIO_AF3_TIM8          ((uint8_t)0x03)  /* TIM8 Alternate Function mapping                           */
279 #define GPIO_AF3_TIM8_COMP1    ((uint8_t)0x03)  /* TIM8/COMP1 Break in Alternate Function mapping            */
280 #define GPIO_AF3_TIM8_COMP2    ((uint8_t)0x03)  /* TIM8/COMP2 Break in Alternate Function mapping            */
281 #define GPIO_AF3_TIM1_COMP1    ((uint8_t)0x03)  /* TIM1/COMP1 Break in Alternate Function mapping            */
282 #define GPIO_AF3_TIM1_COMP2    ((uint8_t)0x03)  /* TIM1/COMP2 Break in Alternate Function mapping            */
283 #define GPIO_AF3_USART2        ((uint8_t)0x03)  /* USART2 Alternate Function mapping                         */
284 #define GPIO_AF3_ADF1          ((uint8_t)0x03)  /* ADF1 Alternate Function mapping                           */
285 #define GPIO_AF3_USB_HS        ((uint8_t)0x03)  /* USB_HS Alternate Function mapping                         */
286 
287 /**
288   * @brief   AF 4 selection
289   */
290 #define GPIO_AF4_I2C1          ((uint8_t)0x04)  /* I2C1 Alternate Function mapping                           */
291 #define GPIO_AF4_I2C2          ((uint8_t)0x04)  /* I2C2 Alternate Function mapping                           */
292 #define GPIO_AF4_I2C3          ((uint8_t)0x04)  /* I2C3 Alternate Function mapping                           */
293 #define GPIO_AF4_I2C4          ((uint8_t)0x04)  /* I2C4 Alternate Function mapping                           */
294 #define GPIO_AF4_I2C5          ((uint8_t)0x04)  /* I2C5 Alternate Function mapping                           */
295 #define GPIO_AF4_PSSI          ((uint8_t)0x04)  /* PSSI Alternate Function mapping                           */
296 #define GPIO_AF4_DCMI          ((uint8_t)0x04)  /* DCMI Alternate Function mapping                           */
297 #define GPIO_AF4_LPTIM3        ((uint8_t)0x04)  /* LPTIM3 Alternate Function mapping                         */
298 
299 /**
300   * @brief   AF 5 selection
301   */
302 #define GPIO_AF5_I2C4          ((uint8_t)0x05)  /* I2C4 Alternate Function mapping                           */
303 #define GPIO_AF5_OCTOSPI1      ((uint8_t)0x05)  /* OCTOSPI1 Alternate Function mapping                       */
304 #define GPIO_AF5_OCTOSPI2      ((uint8_t)0x05)  /* OCTOSPI2 Alternate Function mapping                       */
305 #define GPIO_AF5_SPI1          ((uint8_t)0x05)  /* SPI1 Alternate Function mapping                           */
306 #define GPIO_AF5_SPI2          ((uint8_t)0x05)  /* SPI2 Alternate Function mapping                           */
307 #define GPIO_AF5_SPI3          ((uint8_t)0x05)  /* SPI3 Alternate Function mapping                           */
308 #define GPIO_AF5_DCMI          ((uint8_t)0x05)  /* DCMI Alternate Function mapping                           */
309 #define GPIO_AF5_MDF1          ((uint8_t)0x05)  /* MDF1 Alternate Function mapping                           */
310 
311 /**
312   * @brief   AF 6 selection
313   */
314 #define GPIO_AF6_I2C3          ((uint8_t)0x05)  /* I2C3 Alternate Function mapping                           */
315 #define GPIO_AF6_OCTOSPI2      ((uint8_t)0x06)  /* OCTOSPI2 Alternate Function mapping                       */
316 #define GPIO_AF6_MDF1          ((uint8_t)0x06)  /* MDF1 Alternate Function mapping                           */
317 #define GPIO_AF6_SPI3          ((uint8_t)0x06)  /* SPI3 Alternate Function mapping                           */
318 
319 /**
320   * @brief   AF 7 selection
321   */
322 #define GPIO_AF7_USART1        ((uint8_t)0x07)  /* USART1 Alternate Function mapping                         */
323 #define GPIO_AF7_USART2        ((uint8_t)0x07)  /* USART2 Alternate Function mapping                         */
324 #define GPIO_AF7_USART3        ((uint8_t)0x07)  /* USART3 Alternate Function mapping                         */
325 #define GPIO_AF7_USART6        ((uint8_t)0x07)  /* USART6 Alternate Function mapping                         */
326 #define GPIO_AF7_LTDC          ((uint8_t)0x07)  /* LTDC Alternate Function mapping                           */
327 
328 /**
329   * @brief   AF 8 selection
330   */
331 #define GPIO_AF8_LPUART1       ((uint8_t)0x08)  /* LPUART1 Alternate Function mapping                        */
332 #define GPIO_AF8_UART4         ((uint8_t)0x08)  /* UART4 Alternate Function mapping                          */
333 #define GPIO_AF8_UART5         ((uint8_t)0x08)  /* UART5 Alternate Function mapping                          */
334 #define GPIO_AF8_SDMMC1        ((uint8_t)0x08)  /* SDMMC1 Alternate Function mapping                         */
335 #define GPIO_AF8_LTDC          ((uint8_t)0x08)  /* LTDC Alternate Function mapping                           */
336 #define GPIO_AF8_HSPI1         ((uint8_t)0x08)  /* HSPI1 Alternate Function mapping                          */
337 
338 /**
339   * @brief   AF 9 selection
340   */
341 #define GPIO_AF9_FDCAN1        ((uint8_t)0x09)  /* FDCAN1 Alternate Function mapping                         */
342 #define GPIO_AF9_TSC           ((uint8_t)0x09)  /* TSC Alternate Function mapping                            */
343 
344 /**
345   * @brief   AF 10 selection
346   */
347 #define GPIO_AF10_DCMI         ((uint8_t)0x0A)  /* DCMI Alternate Function mapping                           */
348 #define GPIO_AF10_PSSI         ((uint8_t)0x0A)  /* PSSI Alternate Function mapping                           */
349 #define GPIO_AF10_USB          ((uint8_t)0x0A)  /* USB Alternate Function mapping                            */
350 #define GPIO_AF10_OCTOSPI1     ((uint8_t)0x0A)  /* OCTOSPI1 Alternate Function mapping                       */
351 #define GPIO_AF10_OCTOSPI2     ((uint8_t)0x0A)  /* OCTOSPI2 Alternate Function mapping                       */
352 #define GPIO_AF10_CRS          ((uint8_t)0x0A)  /* CRS Alternate Function mapping                            */
353 #define GPIO_AF10_USB_HS       ((uint8_t)0x0A)  /* USB_HS Alternate Function mapping                         */
354 
355 /**
356   * @brief   AF 11 selection
357   */
358 #define GPIO_AF11_UCPD1        ((uint8_t)0x0B)  /* UCPD1 Alternate Function mapping                          */
359 #define GPIO_AF11_LPGPIO       ((uint8_t)0x0B)  /* LPGPIO Alternate Function mapping                         */
360 #define GPIO_AF11_SDMMC2       ((uint8_t)0x0B)  /* SDMMC2 Alternate Function mapping                         */
361 #define GPIO_AF11_DSI          ((uint8_t)0x0B)  /* DSI Alternate Function mapping                            */
362 
363 /**
364   * @brief   AF 12 selection
365   */
366 #define GPIO_AF12_COMP1        ((uint8_t)0x0C)  /* COMP1 Alternate Function mapping                          */
367 #define GPIO_AF12_COMP2        ((uint8_t)0x0C)  /* COMP2 Alternate Function mapping                          */
368 #define GPIO_AF12_FMC          ((uint8_t)0x0C)  /* FMC Alternate Function mapping                            */
369 #define GPIO_AF12_TIM1_COMP1   ((uint8_t)0x0C)  /* TIM1/COMP1 Break in Alternate Function mapping            */
370 #define GPIO_AF12_TIM1_COMP2   ((uint8_t)0x0C)  /* TIM1/COMP2 Break in Alternate Function mapping            */
371 #define GPIO_AF12_TIM8_COMP2   ((uint8_t)0x0C)  /* TIM8/COMP2 Break in Alternate Function mapping            */
372 #define GPIO_AF12_SDMMC1       ((uint8_t)0x0C)  /* SDMMC1 Alternate Function mapping                         */
373 #define GPIO_AF12_SDMMC2       ((uint8_t)0x0C)  /* SDMMC2 Alternate Function mapping                         */
374 
375 /**
376   * @brief   AF 13 selection
377   */
378 #define GPIO_AF13_SAI1         ((uint8_t)0x0D)  /* SAI1 Alternate Function mapping                           */
379 #define GPIO_AF13_SAI2         ((uint8_t)0x0D)  /* SAI2 Alternate Function mapping                           */
380 #define GPIO_AF13_RNG          ((uint8_t)0x0D)  /* RNG Alternate Function mapping                            */
381 #define GPIO_AF13_LPTIM4       ((uint8_t)0x0D)  /* LPTIM4 Alternate Function mapping                         */
382 #define GPIO_AF13_LPTIM2       ((uint8_t)0x0D)  /* LPTIM2 Alternate Function mapping                         */
383 
384 /**
385   * @brief   AF 14 selection
386   */
387 #define GPIO_AF14_LPTIM2       ((uint8_t)0x0E)  /* LPTIM2 Alternate Function mapping                         */
388 #define GPIO_AF14_LPTIM3       ((uint8_t)0x0E)  /* LPTIM3 Alternate Function mapping                         */
389 #define GPIO_AF14_TIM2         ((uint8_t)0x0E)  /* TIM2 Alternate Function mapping                           */
390 #define GPIO_AF14_TIM15        ((uint8_t)0x0E)  /* TIM15 Alternate Function mapping                          */
391 #define GPIO_AF14_TIM15_COMP1  ((uint8_t)0x0E)  /* TIM15/COMP1 Alternate Function mapping                    */
392 #define GPIO_AF14_TIM16        ((uint8_t)0x0E)  /* TIM16 Alternate Function mapping                          */
393 #define GPIO_AF14_TIM16_COMP1  ((uint8_t)0x0E)  /* TIM16/COMP1 Alternate Function mapping                    */
394 #define GPIO_AF14_TIM17        ((uint8_t)0x0E)  /* TIM17 Alternate Function mapping                          */
395 #define GPIO_AF14_TIM17_COMP1  ((uint8_t)0x0E)  /* TIM17/COMP1 Alternate Function mapping                    */
396 
397 
398 /**
399   * @brief   AF 15 selection
400   */
401 #define GPIO_AF15_EVENTOUT     ((uint8_t)0x0F)  /* EVENTOUT Alternate Function mapping                       */
402 
403 #define IS_GPIO_AF(AF)   ((AF) <= (uint8_t)0x0F)
404 
405 #endif /* (defined(STM32U575xx) || defined(STM32U585xx)) */
406 
407 /**
408   * @}
409   */
410 
411 /**
412   * @}
413   */
414 
415 /* Exported macro ------------------------------------------------------------*/
416 /** @defgroup GPIOEx_Exported_Macros GPIOEx Exported Macros
417   * @{
418   */
419 
420 /** @defgroup GPIOEx_Get_Port_Index GPIOEx Get Port Index
421   * @{
422   */
423 #if (defined(STM32U575xx) || defined(STM32U585xx))
424 
425 /* GPIO_Peripheral_Memory_Mapping Peripheral Memory Mapping */
426 #define GPIO_GET_INDEX(__GPIOx__)           (((uint32_t )(__GPIOx__) & (~GPIOA_BASE)) >> 10)
427 
428 #endif /* (defined(STM32U575xx) || defined(STM32U585xx)) */
429 /**
430   * @}
431   */
432 
433 /**
434   * @}
435   */
436 
437 /* Exported functions --------------------------------------------------------*/
438 
439 /**
440   * @}
441   */
442 
443 /**
444   * @}
445   */
446 
447 #ifdef __cplusplus
448 }
449 #endif
450 
451 #endif /* STM32U5xx_HAL_GPIO_EX_H */
452