stm32h5xx_hal_gpio_ex.h 23 KB

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