stm32f7xx_hal_gpio_ex.h 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. /**
  2. ******************************************************************************
  3. * @file stm32f7xx_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 __STM32F7xx_HAL_GPIO_EX_H
  20. #define __STM32F7xx_HAL_GPIO_EX_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "stm32f7xx_hal_def.h"
  26. /** @addtogroup STM32F7xx_HAL_Driver
  27. * @{
  28. */
  29. /** @defgroup 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. /*--------------- STM32F74xxx/STM32F75xxx/STM32F76xxx/STM32F77xxx -------------*/
  41. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) || defined (STM32F767xx) ||\
  42. defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) || defined (STM32F750xx)
  43. /**
  44. * @brief AF 0 selection
  45. */
  46. #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00U) /* RTC_50Hz Alternate Function mapping */
  47. #define GPIO_AF0_MCO ((uint8_t)0x00U) /* MCO (MCO1 and MCO2) Alternate Function mapping */
  48. #define GPIO_AF0_SWJ ((uint8_t)0x00U) /* SWJ (SWD and JTAG) Alternate Function mapping */
  49. #define GPIO_AF0_TRACE ((uint8_t)0x00U) /* TRACE Alternate Function mapping */
  50. /**
  51. * @brief AF 1 selection
  52. */
  53. #define GPIO_AF1_TIM1 ((uint8_t)0x01U) /* TIM1 Alternate Function mapping */
  54. #define GPIO_AF1_TIM2 ((uint8_t)0x01U) /* TIM2 Alternate Function mapping */
  55. #if defined (STM32F765xx) || defined(STM32F767xx) || defined(STM32F769xx) || defined(STM32F777xx) || defined(STM32F779xx)
  56. #define GPIO_AF1_UART5 ((uint8_t)0x01U) /* UART5 Alternate Function mapping */
  57. #define GPIO_AF1_I2C4 ((uint8_t)0x01U) /* I2C4 Alternate Function mapping */
  58. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  59. /**
  60. * @brief AF 2 selection
  61. */
  62. #define GPIO_AF2_TIM3 ((uint8_t)0x02U) /* TIM3 Alternate Function mapping */
  63. #define GPIO_AF2_TIM4 ((uint8_t)0x02U) /* TIM4 Alternate Function mapping */
  64. #define GPIO_AF2_TIM5 ((uint8_t)0x02U) /* TIM5 Alternate Function mapping */
  65. /**
  66. * @brief AF 3 selection
  67. */
  68. #define GPIO_AF3_TIM8 ((uint8_t)0x03U) /* TIM8 Alternate Function mapping */
  69. #define GPIO_AF3_TIM9 ((uint8_t)0x03U) /* TIM9 Alternate Function mapping */
  70. #define GPIO_AF3_TIM10 ((uint8_t)0x03U) /* TIM10 Alternate Function mapping */
  71. #define GPIO_AF3_TIM11 ((uint8_t)0x03U) /* TIM11 Alternate Function mapping */
  72. #define GPIO_AF3_LPTIM1 ((uint8_t)0x03U) /* LPTIM1 Alternate Function mapping */
  73. #define GPIO_AF3_CEC ((uint8_t)0x03U) /* CEC Alternate Function mapping */
  74. #if defined (STM32F765xx) || defined(STM32F767xx) || defined(STM32F769xx) || defined(STM32F777xx) || defined(STM32F779xx)
  75. #define GPIO_AF3_DFSDM1 ((uint8_t)0x03U) /* DFSDM1 Alternate Function mapping */
  76. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  77. /**
  78. * @brief AF 4 selection
  79. */
  80. #define GPIO_AF4_I2C1 ((uint8_t)0x04U) /* I2C1 Alternate Function mapping */
  81. #define GPIO_AF4_I2C2 ((uint8_t)0x04U) /* I2C2 Alternate Function mapping */
  82. #define GPIO_AF4_I2C3 ((uint8_t)0x04U) /* I2C3 Alternate Function mapping */
  83. #define GPIO_AF4_I2C4 ((uint8_t)0x04U) /* I2C4 Alternate Function mapping */
  84. #define GPIO_AF4_CEC ((uint8_t)0x04U) /* CEC Alternate Function mapping */
  85. #if defined (STM32F765xx) || defined(STM32F767xx) || defined(STM32F769xx) || defined(STM32F777xx) || defined(STM32F779xx)
  86. #define GPIO_AF4_USART1 ((uint8_t)0x04) /* USART1 Alternate Function mapping */
  87. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  88. /**
  89. * @brief AF 5 selection
  90. */
  91. #define GPIO_AF5_SPI1 ((uint8_t)0x05U) /* SPI1 Alternate Function mapping */
  92. #define GPIO_AF5_SPI2 ((uint8_t)0x05U) /* SPI2/I2S2 Alternate Function mapping */
  93. #define GPIO_AF5_SPI3 ((uint8_t)0x05U) /* SPI3/I2S3 Alternate Function mapping */
  94. #define GPIO_AF5_SPI4 ((uint8_t)0x05U) /* SPI4 Alternate Function mapping */
  95. #define GPIO_AF5_SPI5 ((uint8_t)0x05U) /* SPI5 Alternate Function mapping */
  96. #define GPIO_AF5_SPI6 ((uint8_t)0x05U) /* SPI6 Alternate Function mapping */
  97. /**
  98. * @brief AF 6 selection
  99. */
  100. #define GPIO_AF6_SPI3 ((uint8_t)0x06U) /* SPI3/I2S3 Alternate Function mapping */
  101. #define GPIO_AF6_SAI1 ((uint8_t)0x06U) /* SAI1 Alternate Function mapping */
  102. #if defined (STM32F765xx) || defined(STM32F767xx) || defined(STM32F769xx) || defined(STM32F777xx) || defined(STM32F779xx)
  103. #define GPIO_AF6_UART4 ((uint8_t)0x06U) /* UART4 Alternate Function mapping */
  104. #define GPIO_AF6_DFSDM1 ((uint8_t)0x06U) /* DFSDM1 Alternate Function mapping */
  105. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  106. /**
  107. * @brief AF 7 selection
  108. */
  109. #define GPIO_AF7_USART1 ((uint8_t)0x07U) /* USART1 Alternate Function mapping */
  110. #define GPIO_AF7_USART2 ((uint8_t)0x07U) /* USART2 Alternate Function mapping */
  111. #define GPIO_AF7_USART3 ((uint8_t)0x07U) /* USART3 Alternate Function mapping */
  112. #define GPIO_AF7_UART5 ((uint8_t)0x07U) /* UART5 Alternate Function mapping */
  113. #define GPIO_AF7_SPDIFRX ((uint8_t)0x07U) /* SPDIF-RX Alternate Function mapping */
  114. #define GPIO_AF7_SPI2 ((uint8_t)0x07U) /* SPI2 Alternate Function mapping */
  115. #define GPIO_AF7_SPI3 ((uint8_t)0x07U) /* SPI3 Alternate Function mapping */
  116. #if defined (STM32F765xx) || defined(STM32F767xx) || defined(STM32F769xx) || defined(STM32F777xx) || defined(STM32F779xx)
  117. #define GPIO_AF7_SPI6 ((uint8_t)0x07U) /* SPI6 Alternate Function mapping */
  118. #define GPIO_AF7_DFSDM1 ((uint8_t)0x07U) /* DFSDM1 Alternate Function mapping */
  119. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  120. /**
  121. * @brief AF 8 selection
  122. */
  123. #define GPIO_AF8_UART4 ((uint8_t)0x08U) /* UART4 Alternate Function mapping */
  124. #define GPIO_AF8_UART5 ((uint8_t)0x08U) /* UART5 Alternate Function mapping */
  125. #define GPIO_AF8_USART6 ((uint8_t)0x08U) /* USART6 Alternate Function mapping */
  126. #define GPIO_AF8_UART7 ((uint8_t)0x08U) /* UART7 Alternate Function mapping */
  127. #define GPIO_AF8_UART8 ((uint8_t)0x08U) /* UART8 Alternate Function mapping */
  128. #define GPIO_AF8_SPDIFRX ((uint8_t)0x08U) /* SPIDIF-RX Alternate Function mapping */
  129. #define GPIO_AF8_SAI2 ((uint8_t)0x08U) /* SAI2 Alternate Function mapping */
  130. #if defined (STM32F765xx) || defined(STM32F767xx) || defined(STM32F769xx) || defined(STM32F777xx) || defined(STM32F779xx)
  131. #define GPIO_AF8_SPI6 ((uint8_t)0x08U) /* SPI6 Alternate Function mapping */
  132. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  133. /**
  134. * @brief AF 9 selection
  135. */
  136. #define GPIO_AF9_CAN1 ((uint8_t)0x09U) /* CAN1 Alternate Function mapping */
  137. #define GPIO_AF9_CAN2 ((uint8_t)0x09U) /* CAN2 Alternate Function mapping */
  138. #define GPIO_AF9_TIM12 ((uint8_t)0x09U) /* TIM12 Alternate Function mapping */
  139. #define GPIO_AF9_TIM13 ((uint8_t)0x09U) /* TIM13 Alternate Function mapping */
  140. #define GPIO_AF9_TIM14 ((uint8_t)0x09U) /* TIM14 Alternate Function mapping */
  141. #define GPIO_AF9_QUADSPI ((uint8_t)0x09U) /* QUADSPI Alternate Function mapping */
  142. #if defined(STM32F746xx) || defined(STM32F756xx) || defined(STM32F767xx) || defined(STM32F769xx) || defined(STM32F777xx) || defined(STM32F779xx) || defined(STM32F750xx)
  143. #define GPIO_AF9_LTDC ((uint8_t)0x09U) /* LCD-TFT Alternate Function mapping */
  144. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  145. #if defined(STM32F746xx) || defined(STM32F756xx) || defined(STM32F765xx) || defined(STM32F765xx) || defined(STM32F767xx) || defined(STM32F769xx) || defined(STM32F777xx) || defined(STM32F779xx) || defined(STM32F750xx)
  146. #define GPIO_AF9_FMC ((uint8_t)0x09U) /* FMC Alternate Function mapping */
  147. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  148. /**
  149. * @brief AF 10 selection
  150. */
  151. #define GPIO_AF10_OTG_FS ((uint8_t)0xAU) /* OTG_FS Alternate Function mapping */
  152. #define GPIO_AF10_OTG_HS ((uint8_t)0xAU) /* OTG_HS Alternate Function mapping */
  153. #define GPIO_AF10_QUADSPI ((uint8_t)0xAU) /* QUADSPI Alternate Function mapping */
  154. #define GPIO_AF10_SAI2 ((uint8_t)0xAU) /* SAI2 Alternate Function mapping */
  155. #if defined (STM32F765xx) || defined(STM32F767xx) || defined(STM32F769xx) || defined(STM32F777xx) || defined(STM32F779xx)
  156. #define GPIO_AF10_DFSDM1 ((uint8_t)0x0AU) /* DFSDM1 Alternate Function mapping */
  157. #define GPIO_AF10_SDMMC2 ((uint8_t)0x0AU) /* SDMMC2 Alternate Function mapping */
  158. #define GPIO_AF10_LTDC ((uint8_t)0x0AU) /* LCD-TFT Alternate Function mapping */
  159. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  160. /**
  161. * @brief AF 11 selection
  162. */
  163. #define GPIO_AF11_ETH ((uint8_t)0x0BU) /* ETHERNET Alternate Function mapping */
  164. #if defined(STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  165. #define GPIO_AF11_CAN3 ((uint8_t)0x0BU) /* CAN3 Alternate Function mapping */
  166. #define GPIO_AF11_SDMMC2 ((uint8_t)0x0BU) /* SDMMC2 Alternate Function mapping */
  167. #define GPIO_AF11_I2C4 ((uint8_t)0x0BU) /* I2C4 Alternate Function mapping */
  168. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  169. /**
  170. * @brief AF 12 selection
  171. */
  172. #define GPIO_AF12_FMC ((uint8_t)0xCU) /* FMC Alternate Function mapping */
  173. #define GPIO_AF12_OTG_HS_FS ((uint8_t)0xCU) /* OTG HS configured in FS, Alternate Function mapping */
  174. #define GPIO_AF12_SDMMC1 ((uint8_t)0xCU) /* SDMMC1 Alternate Function mapping */
  175. #if defined(STM32F765xx) || defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx)
  176. #define GPIO_AF12_MDIOS ((uint8_t)0xCU) /* SDMMC1 Alternate Function mapping */
  177. #define GPIO_AF12_UART7 ((uint8_t)0xCU) /* UART7 Alternate Function mapping */
  178. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  179. /**
  180. * @brief AF 13 selection
  181. */
  182. #define GPIO_AF13_DCMI ((uint8_t)0x0DU) /* DCMI Alternate Function mapping */
  183. #if defined (STM32F769xx) || defined (STM32F779xx)
  184. #define GPIO_AF13_DSI ((uint8_t)0x0DU) /* DSI Alternate Function mapping */
  185. #endif /* STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  186. #if defined(STM32F746xx) || defined(STM32F756xx) || defined(STM32F767xx) || defined(STM32F769xx) || defined(STM32F777xx) || defined(STM32F779xx) || defined(STM32F750xx)
  187. #define GPIO_AF13_LTDC ((uint8_t)0x0DU) /* LTDC Alternate Function mapping */
  188. /**
  189. * @brief AF 14 selection
  190. */
  191. #define GPIO_AF14_LTDC ((uint8_t)0x0EU) /* LCD-TFT Alternate Function mapping */
  192. #endif /* STM32F746xx || STM32F756xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  193. /**
  194. * @brief AF 15 selection
  195. */
  196. #define GPIO_AF15_EVENTOUT ((uint8_t)0x0FU) /* EVENTOUT Alternate Function mapping */
  197. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx */
  198. /*----------------------------------------------------------------------------*/
  199. /*---------------------------- STM32F72xxx/STM32F73xxx -----------------------*/
  200. #if defined(STM32F722xx) || defined(STM32F723xx) || defined(STM32F732xx) || defined(STM32F733xx) || defined(STM32F730xx)
  201. /**
  202. * @brief AF 0 selection
  203. */
  204. #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00U) /* RTC_50Hz Alternate Function mapping */
  205. #define GPIO_AF0_MCO ((uint8_t)0x00U) /* MCO (MCO1 and MCO2) Alternate Function mapping */
  206. #define GPIO_AF0_SWJ ((uint8_t)0x00U) /* SWJ (SWD and JTAG) Alternate Function mapping */
  207. #define GPIO_AF0_TRACE ((uint8_t)0x00U) /* TRACE Alternate Function mapping */
  208. /**
  209. * @brief AF 1 selection
  210. */
  211. #define GPIO_AF1_TIM1 ((uint8_t)0x01U) /* TIM1 Alternate Function mapping */
  212. #define GPIO_AF1_TIM2 ((uint8_t)0x01U) /* TIM2 Alternate Function mapping */
  213. /**
  214. * @brief AF 2 selection
  215. */
  216. #define GPIO_AF2_TIM3 ((uint8_t)0x02U) /* TIM3 Alternate Function mapping */
  217. #define GPIO_AF2_TIM4 ((uint8_t)0x02U) /* TIM4 Alternate Function mapping */
  218. #define GPIO_AF2_TIM5 ((uint8_t)0x02U) /* TIM5 Alternate Function mapping */
  219. /**
  220. * @brief AF 3 selection
  221. */
  222. #define GPIO_AF3_TIM8 ((uint8_t)0x03U) /* TIM8 Alternate Function mapping */
  223. #define GPIO_AF3_TIM9 ((uint8_t)0x03U) /* TIM9 Alternate Function mapping */
  224. #define GPIO_AF3_TIM10 ((uint8_t)0x03U) /* TIM10 Alternate Function mapping */
  225. #define GPIO_AF3_TIM11 ((uint8_t)0x03U) /* TIM11 Alternate Function mapping */
  226. #define GPIO_AF3_LPTIM1 ((uint8_t)0x03U) /* LPTIM1 Alternate Function mapping */
  227. /**
  228. * @brief AF 4 selection
  229. */
  230. #define GPIO_AF4_I2C1 ((uint8_t)0x04U) /* I2C1 Alternate Function mapping */
  231. #define GPIO_AF4_I2C2 ((uint8_t)0x04U) /* I2C2 Alternate Function mapping */
  232. #define GPIO_AF4_I2C3 ((uint8_t)0x04U) /* I2C3 Alternate Function mapping */
  233. /**
  234. * @brief AF 5 selection
  235. */
  236. #define GPIO_AF5_SPI1 ((uint8_t)0x05U) /* SPI1 Alternate Function mapping */
  237. #define GPIO_AF5_SPI2 ((uint8_t)0x05U) /* SPI2/I2S2 Alternate Function mapping */
  238. #define GPIO_AF5_SPI3 ((uint8_t)0x05U) /* SPI3/I2S3 Alternate Function mapping */
  239. #define GPIO_AF5_SPI4 ((uint8_t)0x05U) /* SPI4 Alternate Function mapping */
  240. #define GPIO_AF5_SPI5 ((uint8_t)0x05U) /* SPI5 Alternate Function mapping */
  241. /**
  242. * @brief AF 6 selection
  243. */
  244. #define GPIO_AF6_SPI3 ((uint8_t)0x06U) /* SPI3/I2S3 Alternate Function mapping */
  245. #define GPIO_AF6_SAI1 ((uint8_t)0x06U) /* SAI1 Alternate Function mapping */
  246. /**
  247. * @brief AF 7 selection
  248. */
  249. #define GPIO_AF7_USART1 ((uint8_t)0x07U) /* USART1 Alternate Function mapping */
  250. #define GPIO_AF7_USART2 ((uint8_t)0x07U) /* USART2 Alternate Function mapping */
  251. #define GPIO_AF7_USART3 ((uint8_t)0x07U) /* USART3 Alternate Function mapping */
  252. #define GPIO_AF7_UART5 ((uint8_t)0x07U) /* UART5 Alternate Function mapping */
  253. #define GPIO_AF7_SPI2 ((uint8_t)0x07U) /* SPI2 Alternate Function mapping */
  254. #define GPIO_AF7_SPI3 ((uint8_t)0x07U) /* SPI3 Alternate Function mapping */
  255. /**
  256. * @brief AF 8 selection
  257. */
  258. #define GPIO_AF8_UART4 ((uint8_t)0x08U) /* UART4 Alternate Function mapping */
  259. #define GPIO_AF8_UART5 ((uint8_t)0x08U) /* UART5 Alternate Function mapping */
  260. #define GPIO_AF8_USART6 ((uint8_t)0x08U) /* USART6 Alternate Function mapping */
  261. #define GPIO_AF8_UART7 ((uint8_t)0x08U) /* UART7 Alternate Function mapping */
  262. #define GPIO_AF8_UART8 ((uint8_t)0x08U) /* UART8 Alternate Function mapping */
  263. #define GPIO_AF8_SAI2 ((uint8_t)0x08U) /* SAI2 Alternate Function mapping */
  264. /**
  265. * @brief AF 9 selection
  266. */
  267. #define GPIO_AF9_CAN1 ((uint8_t)0x09U) /* CAN1 Alternate Function mapping */
  268. #define GPIO_AF9_TIM12 ((uint8_t)0x09U) /* TIM12 Alternate Function mapping */
  269. #define GPIO_AF9_TIM13 ((uint8_t)0x09U) /* TIM13 Alternate Function mapping */
  270. #define GPIO_AF9_TIM14 ((uint8_t)0x09U) /* TIM14 Alternate Function mapping */
  271. #define GPIO_AF9_QUADSPI ((uint8_t)0x09U) /* QUADSPI Alternate Function mapping */
  272. /**
  273. * @brief AF 10 selection
  274. */
  275. #define GPIO_AF10_OTG_FS ((uint8_t)0xAU) /* OTG_FS Alternate Function mapping */
  276. #define GPIO_AF10_OTG_HS ((uint8_t)0xAU) /* OTG_HS Alternate Function mapping */
  277. #define GPIO_AF10_QUADSPI ((uint8_t)0xAU) /* QUADSPI Alternate Function mapping */
  278. #define GPIO_AF10_SAI2 ((uint8_t)0xAU) /* SAI2 Alternate Function mapping */
  279. #define GPIO_AF10_SDMMC2 ((uint8_t)0x0AU) /* SDMMC2 Alternate Function mapping */
  280. /**
  281. * @brief AF 11 selection
  282. */
  283. #define GPIO_AF11_SDMMC2 ((uint8_t)0x0BU) /* SDMMC2 Alternate Function mapping */
  284. /**
  285. * @brief AF 12 selection
  286. */
  287. #define GPIO_AF12_FMC ((uint8_t)0xCU) /* FMC Alternate Function mapping */
  288. #define GPIO_AF12_OTG_HS_FS ((uint8_t)0xCU) /* OTG HS configured in FS, Alternate Function mapping */
  289. #define GPIO_AF12_SDMMC1 ((uint8_t)0xCU) /* SDMMC1 Alternate Function mapping */
  290. /**
  291. * @brief AF 13 selection
  292. */
  293. #define GPIO_AF13_RNG ((uint8_t)0x0DU) /* RNG Alternate Function mapping */
  294. /**
  295. * @brief AF 15 selection
  296. */
  297. #define GPIO_AF15_EVENTOUT ((uint8_t)0x0FU) /* EVENTOUT Alternate Function mapping */
  298. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F730xx */
  299. /*----------------------------------------------------------------------------*/
  300. /**
  301. * @}
  302. */
  303. /**
  304. * @}
  305. */
  306. /* Exported macro ------------------------------------------------------------*/
  307. /** @defgroup GPIOEx_Exported_Macros GPIO Exported Macros
  308. * @{
  309. */
  310. /**
  311. * @}
  312. */
  313. /* Exported functions --------------------------------------------------------*/
  314. /** @defgroup GPIOEx_Exported_Functions GPIO Exported Functions
  315. * @{
  316. */
  317. /**
  318. * @}
  319. */
  320. /* Private types -------------------------------------------------------------*/
  321. /* Private variables ---------------------------------------------------------*/
  322. /* Private constants ---------------------------------------------------------*/
  323. /** @defgroup GPIOEx_Private_Constants GPIO Private Constants
  324. * @{
  325. */
  326. /**
  327. * @brief GPIO pin available on the platform
  328. */
  329. /* Defines the available pins per GPIOs */
  330. #define GPIOA_PIN_AVAILABLE GPIO_PIN_All
  331. #define GPIOB_PIN_AVAILABLE GPIO_PIN_All
  332. #define GPIOC_PIN_AVAILABLE GPIO_PIN_All
  333. #define GPIOD_PIN_AVAILABLE GPIO_PIN_All
  334. #define GPIOE_PIN_AVAILABLE GPIO_PIN_All
  335. #define GPIOF_PIN_AVAILABLE GPIO_PIN_All
  336. #define GPIOG_PIN_AVAILABLE GPIO_PIN_All
  337. #define GPIOI_PIN_AVAILABLE GPIO_PIN_All
  338. #define GPIOJ_PIN_AVAILABLE GPIO_PIN_All
  339. #define GPIOH_PIN_AVAILABLE GPIO_PIN_All
  340. #define GPIOK_PIN_AVAILABLE (GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | \
  341. GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7)
  342. /**
  343. * @}
  344. */
  345. /* Private macros ------------------------------------------------------------*/
  346. /** @defgroup GPIOEx_Private_Macros GPIO Private Macros
  347. * @{
  348. */
  349. /** @defgroup GPIOEx_Get_Port_Index GPIO Get Port Index
  350. * @{
  351. */
  352. #if defined (STM32F745xx) || defined (STM32F746xx) || defined (STM32F756xx) || defined (STM32F765xx) ||\
  353. defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx) || defined (STM32F779xx) ||\
  354. defined (STM32F750xx)
  355. #define GPIO_GET_INDEX(__GPIOx__) (uint8_t)(((__GPIOx__) == (GPIOA))? 0U :\
  356. ((__GPIOx__) == (GPIOB))? 1U :\
  357. ((__GPIOx__) == (GPIOC))? 2U :\
  358. ((__GPIOx__) == (GPIOD))? 3U :\
  359. ((__GPIOx__) == (GPIOE))? 4U :\
  360. ((__GPIOx__) == (GPIOF))? 5U :\
  361. ((__GPIOx__) == (GPIOG))? 6U :\
  362. ((__GPIOx__) == (GPIOH))? 7U :\
  363. ((__GPIOx__) == (GPIOI))? 8U :\
  364. ((__GPIOx__) == (GPIOJ))? 9U : 10U)
  365. #endif /* STM32F745xx || STM32F746xx || STM32F756xx || STM32F765xx || STM32F767xx || STM32F769xx || STM32F777xx || STM32F779xx || STM32F750xx */
  366. #if defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F730xx)
  367. #define GPIO_GET_INDEX(__GPIOx__) (uint8_t)(((__GPIOx__) == (GPIOA))? 0U :\
  368. ((__GPIOx__) == (GPIOB))? 1U :\
  369. ((__GPIOx__) == (GPIOC))? 2U :\
  370. ((__GPIOx__) == (GPIOD))? 3U :\
  371. ((__GPIOx__) == (GPIOE))? 4U :\
  372. ((__GPIOx__) == (GPIOF))? 5U :\
  373. ((__GPIOx__) == (GPIOG))? 6U :\
  374. ((__GPIOx__) == (GPIOH))? 7U : 8U)
  375. #endif /* STM32F722xx || STM32F723xx || STM32F732xx || STM32F733xx || STM32F730xx */
  376. /**
  377. * @}
  378. */
  379. #define IS_GPIO_PIN_AVAILABLE(__INSTANCE__,__PIN__) \
  380. ((((__INSTANCE__) == GPIOA) && (((__PIN__) & (GPIOA_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOA_PIN_AVAILABLE)) == (GPIOA_PIN_AVAILABLE))) || \
  381. (((__INSTANCE__) == GPIOB) && (((__PIN__) & (GPIOB_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOB_PIN_AVAILABLE)) == (GPIOB_PIN_AVAILABLE))) || \
  382. (((__INSTANCE__) == GPIOC) && (((__PIN__) & (GPIOC_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOC_PIN_AVAILABLE)) == (GPIOC_PIN_AVAILABLE))) || \
  383. (((__INSTANCE__) == GPIOD) && (((__PIN__) & (GPIOD_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOD_PIN_AVAILABLE)) == (GPIOD_PIN_AVAILABLE))) || \
  384. (((__INSTANCE__) == GPIOE) && (((__PIN__) & (GPIOE_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOE_PIN_AVAILABLE)) == (GPIOE_PIN_AVAILABLE))) || \
  385. (((__INSTANCE__) == GPIOF) && (((__PIN__) & (GPIOF_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOF_PIN_AVAILABLE)) == (GPIOF_PIN_AVAILABLE))) || \
  386. (((__INSTANCE__) == GPIOG) && (((__PIN__) & (GPIOG_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOG_PIN_AVAILABLE)) == (GPIOG_PIN_AVAILABLE))) || \
  387. (((__INSTANCE__) == GPIOI) && (((__PIN__) & (GPIOI_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOI_PIN_AVAILABLE)) == (GPIOI_PIN_AVAILABLE))) || \
  388. (((__INSTANCE__) == GPIOJ) && (((__PIN__) & (GPIOJ_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOJ_PIN_AVAILABLE)) == (GPIOJ_PIN_AVAILABLE))) || \
  389. (((__INSTANCE__) == GPIOK) && (((__PIN__) & (GPIOK_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOK_PIN_AVAILABLE)) == (GPIOK_PIN_AVAILABLE))) || \
  390. (((__INSTANCE__) == GPIOH) && (((__PIN__) & (GPIOH_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOH_PIN_AVAILABLE)) == (GPIOH_PIN_AVAILABLE))))
  391. /** @defgroup GPIOEx_IS_Alternat_function_selection GPIO Check Alternate Function
  392. * @{
  393. */
  394. #if defined(STM32F756xx) || defined(STM32F746xx) || defined(STM32F750xx)
  395. #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF1_TIM1) || \
  396. ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
  397. ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF1_TIM2) || \
  398. ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
  399. ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \
  400. ((AF) == GPIO_AF3_TIM9) || ((AF) == GPIO_AF3_TIM10) || \
  401. ((AF) == GPIO_AF3_TIM11) || ((AF) == GPIO_AF3_LPTIM1) || \
  402. ((AF) == GPIO_AF3_CEC) || ((AF) == GPIO_AF4_CEC) || \
  403. ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \
  404. ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF4_I2C4) || \
  405. ((AF) == GPIO_AF5_SPI1) || ((AF) == GPIO_AF5_SPI2) || \
  406. ((AF) == GPIO_AF5_SPI3) || ((AF) == GPIO_AF5_SPI4) || \
  407. ((AF) == GPIO_AF5_SPI5) || ((AF) == GPIO_AF5_SPI6) || \
  408. ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF6_SAI1) || \
  409. ((AF) == GPIO_AF7_SPI3) || ((AF) == GPIO_AF7_SPI2) || \
  410. ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
  411. ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF7_UART5) || \
  412. ((AF) == GPIO_AF7_SPDIFRX) || ((AF) == GPIO_AF8_SPDIFRX) || \
  413. ((AF) == GPIO_AF8_SAI2) || ((AF) == GPIO_AF8_USART6) || \
  414. ((AF) == GPIO_AF8_UART4) || ((AF) == GPIO_AF8_UART5) || \
  415. ((AF) == GPIO_AF8_UART7) || ((AF) == GPIO_AF8_UART8) || \
  416. ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \
  417. ((AF) == GPIO_AF9_TIM12) || ((AF) == GPIO_AF9_TIM12) || \
  418. ((AF) == GPIO_AF9_TIM14) || ((AF) == GPIO_AF9_QUADSPI) || \
  419. ((AF) == GPIO_AF9_LTDC) || ((AF) == GPIO_AF10_OTG_FS) || \
  420. ((AF) == GPIO_AF10_OTG_HS) || ((AF) == GPIO_AF10_SAI2) || \
  421. ((AF) == GPIO_AF10_QUADSPI) || ((AF) == GPIO_AF11_ETH) || \
  422. ((AF) == GPIO_AF12_OTG_HS_FS) || ((AF) == GPIO_AF12_SDMMC1) || \
  423. ((AF) == GPIO_AF12_FMC) || ((AF) == GPIO_AF15_EVENTOUT) || \
  424. ((AF) == GPIO_AF13_DCMI) || ((AF) == GPIO_AF14_LTDC))
  425. #elif defined(STM32F745xx)
  426. #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF1_TIM1) || \
  427. ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
  428. ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF1_TIM2) || \
  429. ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
  430. ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \
  431. ((AF) == GPIO_AF3_TIM9) || ((AF) == GPIO_AF3_TIM10) || \
  432. ((AF) == GPIO_AF3_TIM11) || ((AF) == GPIO_AF3_LPTIM1) || \
  433. ((AF) == GPIO_AF3_CEC) || ((AF) == GPIO_AF4_CEC) || \
  434. ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \
  435. ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF4_I2C4) || \
  436. ((AF) == GPIO_AF5_SPI1) || ((AF) == GPIO_AF5_SPI2) || \
  437. ((AF) == GPIO_AF5_SPI3) || ((AF) == GPIO_AF5_SPI4) || \
  438. ((AF) == GPIO_AF5_SPI5) || ((AF) == GPIO_AF5_SPI6) || \
  439. ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF6_SAI1) || \
  440. ((AF) == GPIO_AF7_SPI3) || ((AF) == GPIO_AF7_SPI2) || \
  441. ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
  442. ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF7_UART5) || \
  443. ((AF) == GPIO_AF7_SPDIFRX) || ((AF) == GPIO_AF8_SPDIFRX) || \
  444. ((AF) == GPIO_AF8_SAI2) || ((AF) == GPIO_AF8_USART6) || \
  445. ((AF) == GPIO_AF8_UART4) || ((AF) == GPIO_AF8_UART5) || \
  446. ((AF) == GPIO_AF8_UART7) || ((AF) == GPIO_AF8_UART8) || \
  447. ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \
  448. ((AF) == GPIO_AF9_TIM12) || ((AF) == GPIO_AF9_TIM12) || \
  449. ((AF) == GPIO_AF9_TIM14) || ((AF) == GPIO_AF9_QUADSPI) || \
  450. ((AF) == GPIO_AF13_DCMI) || ((AF) == GPIO_AF10_OTG_FS) || \
  451. ((AF) == GPIO_AF10_OTG_HS) || ((AF) == GPIO_AF10_SAI2) || \
  452. ((AF) == GPIO_AF10_QUADSPI) || ((AF) == GPIO_AF11_ETH) || \
  453. ((AF) == GPIO_AF12_OTG_HS_FS) || ((AF) == GPIO_AF12_SDMMC1) || \
  454. ((AF) == GPIO_AF12_FMC) || ((AF) == GPIO_AF15_EVENTOUT))
  455. #elif defined(STM32F767xx) || defined(STM32F777xx)
  456. #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF1_TIM1) || \
  457. ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
  458. ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF1_TIM2) || \
  459. ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
  460. ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \
  461. ((AF) == GPIO_AF3_TIM9) || ((AF) == GPIO_AF3_TIM10) || \
  462. ((AF) == GPIO_AF3_TIM11) || ((AF) == GPIO_AF3_LPTIM1) || \
  463. ((AF) == GPIO_AF3_CEC) || ((AF) == GPIO_AF4_CEC) || \
  464. ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \
  465. ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF4_I2C4) || \
  466. ((AF) == GPIO_AF5_SPI1) || ((AF) == GPIO_AF5_SPI2) || \
  467. ((AF) == GPIO_AF5_SPI3) || ((AF) == GPIO_AF5_SPI4) || \
  468. ((AF) == GPIO_AF5_SPI5) || ((AF) == GPIO_AF5_SPI6) || \
  469. ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF6_SAI1) || \
  470. ((AF) == GPIO_AF7_SPI3) || ((AF) == GPIO_AF7_SPI2) || \
  471. ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
  472. ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF7_UART5) || \
  473. ((AF) == GPIO_AF7_SPDIFRX) || ((AF) == GPIO_AF8_SPDIFRX) || \
  474. ((AF) == GPIO_AF8_SAI2) || ((AF) == GPIO_AF8_USART6) || \
  475. ((AF) == GPIO_AF8_UART4) || ((AF) == GPIO_AF8_UART5) || \
  476. ((AF) == GPIO_AF8_UART7) || ((AF) == GPIO_AF8_UART8) || \
  477. ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \
  478. ((AF) == GPIO_AF9_TIM12) || ((AF) == GPIO_AF9_TIM12) || \
  479. ((AF) == GPIO_AF9_TIM14) || ((AF) == GPIO_AF9_QUADSPI) || \
  480. ((AF) == GPIO_AF10_OTG_FS) || ((AF) == GPIO_AF9_LTDC) || \
  481. ((AF) == GPIO_AF10_OTG_HS) || ((AF) == GPIO_AF10_SAI2) || \
  482. ((AF) == GPIO_AF10_QUADSPI) || ((AF) == GPIO_AF11_ETH) || \
  483. ((AF) == GPIO_AF10_SDMMC2) || ((AF) == GPIO_AF11_SDMMC2) || \
  484. ((AF) == GPIO_AF11_CAN3) || ((AF) == GPIO_AF12_OTG_HS_FS) || \
  485. ((AF) == GPIO_AF12_SDMMC1) || ((AF) == GPIO_AF12_FMC) || \
  486. ((AF) == GPIO_AF15_EVENTOUT) || ((AF) == GPIO_AF13_DCMI) || \
  487. ((AF) == GPIO_AF14_LTDC))
  488. #elif defined(STM32F769xx) || defined(STM32F779xx)
  489. #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF1_TIM1) || \
  490. ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
  491. ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF1_TIM2) || \
  492. ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
  493. ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \
  494. ((AF) == GPIO_AF3_TIM9) || ((AF) == GPIO_AF3_TIM10) || \
  495. ((AF) == GPIO_AF3_TIM11) || ((AF) == GPIO_AF3_LPTIM1) || \
  496. ((AF) == GPIO_AF3_CEC) || ((AF) == GPIO_AF4_CEC) || \
  497. ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \
  498. ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF4_I2C4) || \
  499. ((AF) == GPIO_AF5_SPI1) || ((AF) == GPIO_AF5_SPI2) || \
  500. ((AF) == GPIO_AF5_SPI3) || ((AF) == GPIO_AF5_SPI4) || \
  501. ((AF) == GPIO_AF5_SPI5) || ((AF) == GPIO_AF5_SPI6) || \
  502. ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF6_SAI1) || \
  503. ((AF) == GPIO_AF7_SPI3) || ((AF) == GPIO_AF7_SPI2) || \
  504. ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
  505. ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF7_UART5) || \
  506. ((AF) == GPIO_AF7_SPDIFRX) || ((AF) == GPIO_AF8_SPDIFRX) || \
  507. ((AF) == GPIO_AF8_SAI2) || ((AF) == GPIO_AF8_USART6) || \
  508. ((AF) == GPIO_AF8_UART4) || ((AF) == GPIO_AF8_UART5) || \
  509. ((AF) == GPIO_AF8_UART7) || ((AF) == GPIO_AF8_UART8) || \
  510. ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \
  511. ((AF) == GPIO_AF9_TIM12) || ((AF) == GPIO_AF9_TIM12) || \
  512. ((AF) == GPIO_AF9_TIM14) || ((AF) == GPIO_AF9_QUADSPI) || \
  513. ((AF) == GPIO_AF9_LTDC) || ((AF) == GPIO_AF10_OTG_FS) || \
  514. ((AF) == GPIO_AF10_OTG_HS) || ((AF) == GPIO_AF10_SAI2) || \
  515. ((AF) == GPIO_AF10_QUADSPI) || ((AF) == GPIO_AF11_ETH) || \
  516. ((AF) == GPIO_AF10_SDMMC2) || ((AF) == GPIO_AF11_SDMMC2) || \
  517. ((AF) == GPIO_AF11_CAN3) || ((AF) == GPIO_AF12_OTG_HS_FS) || \
  518. ((AF) == GPIO_AF12_SDMMC1) || ((AF) == GPIO_AF12_FMC) || \
  519. ((AF) == GPIO_AF15_EVENTOUT) || ((AF) == GPIO_AF13_DCMI) || \
  520. ((AF) == GPIO_AF14_LTDC) || ((AF) == GPIO_AF13_DSI))
  521. #elif defined(STM32F765xx)
  522. #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF1_TIM1) || \
  523. ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
  524. ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF1_TIM2) || \
  525. ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
  526. ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \
  527. ((AF) == GPIO_AF3_TIM9) || ((AF) == GPIO_AF3_TIM10) || \
  528. ((AF) == GPIO_AF3_TIM11) || ((AF) == GPIO_AF3_LPTIM1) || \
  529. ((AF) == GPIO_AF3_CEC) || ((AF) == GPIO_AF4_CEC) || \
  530. ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \
  531. ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF4_I2C4) || \
  532. ((AF) == GPIO_AF5_SPI1) || ((AF) == GPIO_AF5_SPI2) || \
  533. ((AF) == GPIO_AF5_SPI3) || ((AF) == GPIO_AF5_SPI4) || \
  534. ((AF) == GPIO_AF5_SPI5) || ((AF) == GPIO_AF5_SPI6) || \
  535. ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF6_SAI1) || \
  536. ((AF) == GPIO_AF7_SPI3) || ((AF) == GPIO_AF7_SPI2) || \
  537. ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
  538. ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF7_UART5) || \
  539. ((AF) == GPIO_AF7_SPDIFRX) || ((AF) == GPIO_AF8_SPDIFRX) || \
  540. ((AF) == GPIO_AF8_SAI2) || ((AF) == GPIO_AF8_USART6) || \
  541. ((AF) == GPIO_AF8_UART4) || ((AF) == GPIO_AF8_UART5) || \
  542. ((AF) == GPIO_AF8_UART7) || ((AF) == GPIO_AF8_UART8) || \
  543. ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \
  544. ((AF) == GPIO_AF9_TIM12) || ((AF) == GPIO_AF9_TIM12) || \
  545. ((AF) == GPIO_AF9_TIM14) || ((AF) == GPIO_AF9_QUADSPI) || \
  546. ((AF) == GPIO_AF10_OTG_HS) || ((AF) == GPIO_AF10_SAI2) || \
  547. ((AF) == GPIO_AF10_QUADSPI) || ((AF) == GPIO_AF11_ETH) || \
  548. ((AF) == GPIO_AF10_SDMMC2) || ((AF) == GPIO_AF11_SDMMC2) || \
  549. ((AF) == GPIO_AF11_CAN3) || ((AF) == GPIO_AF12_OTG_HS_FS) || \
  550. ((AF) == GPIO_AF12_SDMMC1) || ((AF) == GPIO_AF12_FMC) || \
  551. ((AF) == GPIO_AF15_EVENTOUT) || ((AF) == GPIO_AF13_DCMI) || \
  552. ((AF) == GPIO_AF10_OTG_FS))
  553. #elif defined (STM32F722xx) || defined (STM32F723xx) || defined (STM32F732xx) || defined (STM32F733xx) || defined (STM32F730xx)
  554. #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF1_TIM1) || \
  555. ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
  556. ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF1_TIM2) || \
  557. ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
  558. ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \
  559. ((AF) == GPIO_AF3_TIM9) || ((AF) == GPIO_AF3_TIM10) || \
  560. ((AF) == GPIO_AF3_TIM11) || ((AF) == GPIO_AF3_LPTIM1) || \
  561. ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \
  562. ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF5_SPI1) || \
  563. ((AF) == GPIO_AF5_SPI2) || ((AF) == GPIO_AF5_SPI3) || \
  564. ((AF) == GPIO_AF5_SPI4) || ((AF) == GPIO_AF5_SPI5) || \
  565. ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF6_SAI1) || \
  566. ((AF) == GPIO_AF7_SPI3) || ((AF) == GPIO_AF7_SPI2) || \
  567. ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
  568. ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF7_UART5) || \
  569. ((AF) == GPIO_AF8_SAI2) || ((AF) == GPIO_AF8_USART6) || \
  570. ((AF) == GPIO_AF8_UART4) || ((AF) == GPIO_AF8_UART5) || \
  571. ((AF) == GPIO_AF8_UART7) || ((AF) == GPIO_AF8_UART8) || \
  572. ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_TIM12) || \
  573. ((AF) == GPIO_AF9_TIM12) || ((AF) == GPIO_AF9_TIM14) || \
  574. ((AF) == GPIO_AF9_QUADSPI) || ((AF) == GPIO_AF10_OTG_HS) || \
  575. ((AF) == GPIO_AF10_SAI2) || ((AF) == GPIO_AF10_QUADSPI) || \
  576. ((AF) == GPIO_AF10_SDMMC2) || ((AF) == GPIO_AF11_SDMMC2) || \
  577. ((AF) == GPIO_AF12_OTG_HS_FS) || ((AF) == GPIO_AF12_SDMMC1) || \
  578. ((AF) == GPIO_AF12_FMC) || ((AF) == GPIO_AF15_EVENTOUT) || \
  579. ((AF) == GPIO_AF10_OTG_FS))
  580. #endif /* STM32F756xx || STM32F746xx || STM32F750xx */
  581. /**
  582. * @}
  583. */
  584. /**
  585. * @}
  586. */
  587. /* Private functions ---------------------------------------------------------*/
  588. /** @defgroup GPIOEx_Private_Functions GPIO Private Functions
  589. * @{
  590. */
  591. /**
  592. * @}
  593. */
  594. /**
  595. * @}
  596. */
  597. /**
  598. * @}
  599. */
  600. #ifdef __cplusplus
  601. }
  602. #endif
  603. #endif /* __STM32F7xx_HAL_GPIO_EX_H */