stm32h7xx_hal_gpio_ex.h 23 KB

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