You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

653 lines
38 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32wbxx_hal_gpio_ex.h
  4. * @author MCD Application Team
  5. * @brief Header file of GPIO HAL Extended module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  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. /* Define to prevent recursive inclusion -------------------------------------*/
  20. #ifndef STM32WBxx_HAL_GPIO_EX_H
  21. #define STM32WBxx_HAL_GPIO_EX_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32wbxx_hal_def.h"
  27. /** @addtogroup STM32WBxx_HAL_Driver
  28. * @{
  29. */
  30. /** @defgroup GPIOEx GPIOEx
  31. * @brief GPIO Extended HAL module driver
  32. * @{
  33. */
  34. /* Exported types ------------------------------------------------------------*/
  35. /* Exported constants --------------------------------------------------------*/
  36. /** @defgroup GPIOEx_Exported_Constants GPIOEx Exported Constants
  37. * @{
  38. */
  39. /** @defgroup GPIOEx_Alternate_function_selection GPIOEx Alternate function selection
  40. * @{
  41. */
  42. /* The table below gives an overview of the different alternate functions per port.
  43. * For more details refer yourself to the product data sheet.
  44. *
  45. */
  46. #if defined (STM32WB55xx) || defined (STM32WB5Mxx) || defined (STM32WB50xx)
  47. /* | AF0 | AF1 | AF2 | AF3 | AF4 | AF5 | AF6 | AF7 |
  48. *_____________________________________________________________________________________________
  49. * |SYS_AF |TIM |TIM |SPI/SAI/TI|I2C | I2C | RF | USART |
  50. *_____________________________________________________________________________________________
  51. * PA0 | |TIM2_CH1 | | | | |RF_DTB2 | |
  52. * PA1 | |TIM2_CH2 | | |I2C1_SMBA |SPI1_SCK |RF_DTB3 | |
  53. * PA2 | |TIM2_CH3 | | | | |RF_DTB4 | |
  54. * PA3 | |TIM2_CH4 | |SAI1_CK1 | | |RF_DTB5 | |
  55. * PA4 | | | | | |SPI1_NSS |RF_DTB6 | |
  56. * PA5 | |TIM2_CH1 |TIM2_ETR | | |SPI1_SCK |RF_DTB7 | |
  57. * PA6 | |TIM1_BKIN | | | |SPI1_MISO |RF_DTB8 | |
  58. * PA7 | |TIM1_CH1N | | |I2C3_SCL |SPI1_MOSI |RF_DTB9 | |
  59. * PA8 |MCO |TIM1_CH1 | |SAI1_CK2 | | |RF_DTB12 |USART1_CK |
  60. * PA9 | |TIM2_CH2 | |SAI1_DI2 |I2C1_SCL |SPI2_SCK |RF_DTB13 |USART1_TX |
  61. * PA10| |TIM2_CH3 | |SAI1_DI1 |I2C1_SDA | |RF_DTB14 |USART1_RX |
  62. * PA11| |TIM2_CH4 |TIM1_BKIN2| | |SPI1_MISO |RF_DTB15 |USART1_CTS|
  63. * PA12| |TIM2_ETR | | | |SPI1_MOSI |RF_MISO |USART1_RTS|
  64. * PA13|JTMS_SWDIO| | | | | | | |
  65. * PA14|JTCK_SWCLK|LPTIM1_OUT| | |I2C1_SMBA | | | |
  66. * PA15|JTDI |TIM2_CH1 |TIM2_ETR | | |SPI1_NSS | | |
  67. *______________________________________________________________________________________________
  68. * PB0 | | | | | | | | |
  69. * PB1 | | | | | | | | |
  70. * PB2 |RTC_OUT |LPTIM1_OUT| | |I2C3_SMBA |SPI1_NSS |RF_DTB10 | |
  71. * PB3 |JTDO |TIM2_CH2 | | | |SPI1_SCK | |USART1_RTS|
  72. * PB4 |NJTRST | | | |I2C3_SDA |SPI1_MISO | |USART1_CTS|
  73. * PB5 | |LPTIM1_IN1| | |I2C1_SMBA |SPI1_MOSI |RF_MOSI |USART1_CK |
  74. * PB6 | |LPTIM1_ETR| | |I2C1_SCL | |RF_SCK |USART1_TX |
  75. * PB7 | |LPTIM1_IN2| |TIM1_BKIN |I2C1_SDA | |RF_DTB11 |USART1_RX |
  76. * PB8 | |TIM1_CH2N | |SAI1_CK1 |I2C1_SCL | |RF_DTB16 | |
  77. * PB9 | |TIM1_CH3N | |SAI1_DI2 |I2C1_SDA |SPI2_NSS | | |
  78. * PB10| |TIM2_CH3 | | |I2C3_SCL |SPI2_SCK |RF_DTB18 | |
  79. * PB11| |TIM2_CH4 | | |I2C3_SDA | |RF_DTB17 | |
  80. * PB12| |TIM1_BKIN | |TIM1_BKIN |I2C3_SMBA |SPI2_NSS | | |
  81. * PB13| |TIM1_CH1N | | |I2C3_SCL |SPI2_SCK | | |
  82. * PB14| |TIM1_CH2N | | |I2C3_SDA |SPI2_MISO | | |
  83. * PB15|RTC_REFIN |TIM1_CH3N | | | |SPI2_MOSI | | |
  84. *______________________________________________________________________________________________
  85. * PC0 | |LPTIM1_IN1| | |I2C3_SCL | | | |
  86. * PC1 | |LPTIM1_OUT| |SPI2_MOSI |I2C3_SDA | | | |
  87. * PC2 | |LPTIM1_IN2| | | |SPI2_MISO | | |
  88. * PC3 | |LPTIM1_ETR| |SAI1_DI1 | |SPI2_MOSI | | |
  89. * PC4 | | | | | | | | |
  90. * PC5 | | | |SAI1_DI3 | | | | |
  91. * PC6 | | | | | | | | |
  92. * PC7 | | | | | | | | |
  93. * PC8 | | | | | | | | |
  94. * PC9 | | | |TIM1_BKIN | | | | |
  95. * PC10|TRACED1 | | | | | | | |
  96. * PC11| | | | | | | | |
  97. * PC12|TRACED3 | | | | | | | |
  98. * PC13| | | | | | | | |
  99. * PC14| | | | | | |RF_DTB0 | |
  100. * PC15| | | | | | |RF_DTB1 | |
  101. *______________________________________________________________________________________________
  102. * PD0 | | | | | |SPI2_NSS | | |
  103. * PD1 | | | | | |SPI2_SCK | | |
  104. * PD2 |TRACED2 | | | | | | | |
  105. * PD3 | | | |SPI2_SCK | |SPI2_MISO | | |
  106. * PD4 | | | | | |SPI2_MOSI | | |
  107. * PD5 | | | | | | | | |
  108. * PD6 | | | |SAI1_DI1 | | | | |
  109. * PD7 | | | | | | | | |
  110. * PD8 | | |TIM1_BKIN2| | | | | |
  111. * PD9 |TRACED0 | | | | | | | |
  112. * PD10|TRIG_IO | | | | | | | |
  113. * PD11| | | | | | | | |
  114. * PD12| | | | | | | | |
  115. * PD13| | | | | | | | |
  116. * PD14| |TIM1_CH1 | | | | | | |
  117. * PD15| |TIM1_CH2 | | | | | | |
  118. *______________________________________________________________________________________________
  119. * PE0 | |TIM1_ETR | | | | | | |
  120. * PE1 | | | | | | | | |
  121. * PE2 |TRACED2 | | |SAI1_CK1 | | | | |
  122. * PE3 | | | | | | | | |
  123. * PE4 | | | | | | | | |
  124. *______________________________________________________________________________________________
  125. * PH0 | | | | | | | | |
  126. * PH1 | | | | | | | | |
  127. * PE2 | | | | | | | | |
  128. * PH3 | | | | | | |RF_NSS | |
  129. *______________________________________________________________________________________________*/
  130. /* | AF8 | AF9 | AF10 | AF11 | AF12 | AF13 | AF14 | AF15 |
  131. *_____________________________________________________________________________________________
  132. * |LPUART1 |TSC |USB/QUADSP|LCD |COMP/TIM |SAI |TIM |EVENTOUT |
  133. *_____________________________________________________________________________________________
  134. * PA0 | | | | |COMP1_OUT |SAI1_E_CLK|TIM2_ETR |EVENTOUT |
  135. * PA1 | | | |LCD_SEG0 | | | |EVENTOUT |
  136. * PA2 |LPUART1_TX| |QSPI_NCS |LCD_SEG1 |COMP2_OUT | | |EVENTOUT |
  137. * PA3 |LPUART1_RX| |QSPI_CLK |LCD_SEG2 | |SAI1_CLK_A| |EVENTOUT |
  138. * PA4 | | | | | |SAI1_FS_B |LPTIM2_OUT|EVENTOUT |
  139. * PA5 | | | | | | |LPTIM2_ETR|EVENTOUT |
  140. * PA6 |LPUART1_CT| |QSPI_IO3 |LCD_SEG3 |TIM1_BKIN | |TIM16_CH1 |EVENTOUT |
  141. * PA7 | | |QSPI_IO2 |LCD_SEG4 |COMP2_OUT | |TIM17_CH1 |EVENTOUT |
  142. * PA8 | | | |LCD_COM0 | |SAI1_SCK_A|LPTIM2_OUT|EVENTOUT |
  143. * PA9 | | | |LCD_COM1 | |SAI1_FS_A | |EVENTOUT |
  144. * PA10| | |USB_CRS_SY|LCD_COM2 | |SAI1_SD_A |TIM17_BKIN|EVENTOUT |
  145. * PA11| | |USB_DM | |TIM1_BKIN2| | |EVENTOUT |
  146. * PA12| | |USB_DP | | | | |EVENTOUT |
  147. * PA13|IR_OUT | |USB_NOE | | |SAI1_SD_B | |EVENTOUT |
  148. * PA14| | | | | |SAI1_FS_B | |EVENTOUT |
  149. * PA15| |TSC_G3_IO1| |LCD_SEG17 | | | |EVENTOUT |
  150. *______________________________________________________________________________________________
  151. * PB0 | | | |LCD_SEG5 |COMP1_OUT | | |EVENTOUT |
  152. * PB1 |LPUART1_RT| | |LCD_SEG6 | | |LPTIM2_IN1|EVENTOUT |
  153. * PB2 | | | |LCD_VLCD | |SAI1_E_CLK| |EVENTOUT |
  154. * PB3 | | | |LCD_SEG7 | |SAI1_SCK_B| |EVENTOUT |
  155. * PB4 | |TSC_G2_IO1| |LCD_SEG8 | |SAI1_CLK_B|TIM17_BKIN|EVENTOUT |
  156. * PB5 | |TSC_G2_IO2| |LCD_SEG9 |COMP2_OUT |SAI1_SD_B |TIM16_BKIN|EVENTOUT |
  157. * PB6 | |TSC_G2_IO3| | | |SAI1_FS_B |TIM16_CH1N|EVENTOUT |
  158. * PB7 | |TSC_G2_IO4| |LCD_SEG21 | | |TIM17_CH1N|EVENTOUT |
  159. * PB8 | | |QSPI_IO1 |LCD_SEG16 | |SAI1_CLK_A|TIM16_CH1 |EVENTOUT |
  160. * PB9 |IR_OUT |TSC_G7_IO4|QSPI_IO0 |LCD_COM3 | |SAI1_FS_A |TIM17_CH1 |EVENTOUT |
  161. * PB10|LPUART1_RX|TSC_SYNC |QSPI_CLK |LCD_SEG10 |COMP1_OUT |SAI1_SCK_A| |EVENTOUT |
  162. * PB11|LPUART1_TX| |QSPI_NCS |LCD_SEG11 |COMP2_OUT | | |EVENTOUT |
  163. * PB12|LPUART1_RT|TSC_G1_IO1| |LCD_SEG12 | |SAI1_FS_A | |EVENTOUT |
  164. * PB13|LPUART1_CT|TSC_G1_IO2| |LCD_SEG13 | |SAI1_SCK_A| |EVENTOUT |
  165. * PB14| |TSC_G1_IO3| |LCD_SEG14 | |SAI1_CLK_A| |EVENTOUT |
  166. * PB15| |TSC_G1_IO4| |LCD_SEG15 | |SAI1_SD_A | |EVENTOUT |
  167. *______________________________________________________________________________________________
  168. * PC0 |LPUART1_RX| | |LCD_SEG18 | | |LPTIM2_IN1|EVENTOUT |
  169. * PC1 |LPUART1_TX| | |LCD_SEG19 | | | |EVENTOUT |
  170. * PC2 | | | |LCD_SEG20 | | | |EVENTOUT |
  171. * PC3 | | | |LCD_VLCD | |SAI1_SD_A |LPTIM2_ETR|EVENTOUT |
  172. * PC4 | | | |LCD_SEG22 | | | |EVENTOUT |
  173. * PC5 | | | |LCD_SEG23 | | | |EVENTOUT |
  174. * PC6 | |TSC_G4_IO1| |LCD_SEG24 | | | |EVENTOUT |
  175. * PC7 | |TSC_G4_IO2| |LCD_SEG25 | | | |EVENTOUT |
  176. * PC8 | |TSC_G4_IO3| |LCD_SEG26 | | | |EVENTOUT |
  177. * PC9 | |TSC_G4_IO4|USB_NOE |LCD_SEG27 | |SAI1_SCK_B| |EVENTOUT |
  178. * PC10| |TSC_G3_IO2| |LCD_Cx_SEx| | | |EVENTOUT |
  179. * PC11| |TSC_G3_IO3| |LCD_Cx_SEx| | | |EVENTOUT |
  180. * PC12| |TSC_G3_IO4| |LCD_Cx_SEx| | | |EVENTOUT |
  181. * PC13| | | | | | | |EVENTOUT |
  182. * PC14| | | | | | | |EVENTOUT |
  183. * PC15| | | | | | | |EVENTOUT |
  184. *______________________________________________________________________________________________
  185. * PD0 | | | | | | | |EVENTOUT |
  186. * PD1 | | | | | | | |EVENTOUT |
  187. * PD2 | |TSC_SYNC | |LCD_Cx_SEx| | | |EVENTOUT |
  188. * PD3 | | |QSPI_NCS | | | | |EVENTOUT |
  189. * PD4 | |TSC_G5_IO1|QSPI_IO0 | | | | |EVENTOUT |
  190. * PD5 | |TSC_G5_IO2|QSPI_IO1 | | |SAI1_CLK_B| |EVENTOUT |
  191. * PD6 | |TSC_G5_IO3|QSPI_IO2 | | |SAI1_SD_A | |EVENTOUT |
  192. * PD7 | |TSC_G5_IO4|QSPI_IO3 |LCD_SEG39 | | | |EVENTOUT |
  193. * PD8 | | | |LCD_SEG28 | | | |EVENTOUT |
  194. * PD9 | | | |LCD_SEG29 | | | |EVENTOUT |
  195. * PD10| |TSC_G6_IO1| |LCD_SEG30 | | | |EVENTOUT |
  196. * PD11| |TSC_G6_IO2| |LCD_SEG31 | | |LPTIM2_ETR|EVENTOUT |
  197. * PD12| |TSC_G6_IO3| |LCD_SEG32 | | |LPTIM2_IN1|EVENTOUT |
  198. * PD13| |TSC_G6_IO4| |LCD_SEG33 | | |LPTIM2_OUT|EVENTOUT |
  199. * PD14| | | |LCD_SEG34 | | | |EVENTOUT |
  200. * PD15| | | |LCD_SEG35 | | | |EVENTOUT |
  201. *______________________________________________________________________________________________
  202. * PE0 | |TSC_G7_IO3| |LCD_SEG36 | | |TIM16_CH1 |EVENTOUT |
  203. * PE1 | |TSC_G7_IO2| |LCD_SEG37 | | |TIM17_CH1 |EVENTOUT |
  204. * PE2 | |TSC_G7_IO1| |LCD_SEG38 | |SAI1_CLK_A| |EVENTOUT |
  205. * PE3 | | | | | | | |EVENTOUT |
  206. * PE4 | | | | | | | |EVENTOUT |
  207. *______________________________________________________________________________________________
  208. * PH0 | | | | | | | |EVENTOUT |
  209. * PH1 | | | | | | | |EVENTOUT |
  210. * PE2 | | | | | | | |EVENTOUT |
  211. * PH3 | | | | | | | |EVENTOUT |
  212. *______________________________________________________________________________________________*/
  213. /**
  214. * @brief AF 0 selection
  215. */
  216. #define GPIO_AF0_MCO ((uint8_t)0x00) /*!< MCO Alternate Function mapping */
  217. #define GPIO_AF0_LSCO ((uint8_t)0x00) /*!< LSCO Alternate Function mapping */
  218. #define GPIO_AF0_JTMS_SWDIO ((uint8_t)0x00) /*!< JTMS-SWDIO Alternate Function mapping */
  219. #define GPIO_AF0_JTCK_SWCLK ((uint8_t)0x00) /*!< JTCK-SWCLK Alternate Function mapping */
  220. #define GPIO_AF0_JTDI ((uint8_t)0x00) /*!< JTDI Alternate Function mapping */
  221. #define GPIO_AF0_RTC_OUT ((uint8_t)0x00) /*!< RCT_OUT Alternate Function mapping */
  222. #define GPIO_AF0_JTD_TRACE ((uint8_t)0x00) /*!< JTDO-TRACESWO Alternate Function mapping */
  223. #define GPIO_AF0_NJTRST ((uint8_t)0x00) /*!< NJTRST Alternate Function mapping */
  224. #define GPIO_AF0_RTC_REFIN ((uint8_t)0x00) /*!< RTC_REFIN Alternate Function mapping */
  225. #define GPIO_AF0_TRACED0 ((uint8_t)0x00) /*!< TRACED0 Alternate Function mapping */
  226. #define GPIO_AF0_TRACED1 ((uint8_t)0x00) /*!< TRACED1 Alternate Function mapping */
  227. #define GPIO_AF0_TRACED2 ((uint8_t)0x00) /*!< TRACED2 Alternate Function mapping */
  228. #define GPIO_AF0_TRACED3 ((uint8_t)0x00) /*!< TRACED3 Alternate Function mapping */
  229. #define GPIO_AF0_TRIG_INOUT ((uint8_t)0x00) /*!< TRIG_INOUT Alternate Function mapping */
  230. #define GPIO_AF0_TRACECK ((uint8_t)0x00) /*!< TRACECK Alternate Function mapping */
  231. #define GPIO_AF0_SYS ((uint8_t)0x00) /*!< System Function mapping */
  232. /**
  233. * @brief AF 1 selection
  234. */
  235. #define GPIO_AF1_TIM1 ((uint8_t)0x01) /*!< TIM1 Alternate Function mapping */
  236. #define GPIO_AF1_TIM2 ((uint8_t)0x01) /*!< TIM2 Alternate Function mapping */
  237. #define GPIO_AF1_LPTIM1 ((uint8_t)0x01) /*!< LPTIM1 Alternate Function mapping */
  238. /**
  239. * @brief AF 2 selection
  240. */
  241. #define GPIO_AF2_TIM2 ((uint8_t)0x02) /*!< TIM2 Alternate Function mapping */
  242. #define GPIO_AF2_TIM1 ((uint8_t)0x02) /*!< TIM1 Alternate Function mapping */
  243. /**
  244. * @brief AF 3 selection
  245. */
  246. #define GPIO_AF3_SAI1 ((uint8_t)0x03) /*!< SAI1_CK1 Alternate Function mapping */
  247. #define GPIO_AF3_SPI2 ((uint8_t)0x03) /*!< SPI2 Alternate Function mapping */
  248. #define GPIO_AF3_TIM1 ((uint8_t)0x03) /*!< TIM1 Alternate Function mapping */
  249. /**
  250. * @brief AF 4 selection
  251. */
  252. #define GPIO_AF4_I2C1 ((uint8_t)0x04) /*!< I2C1 Alternate Function mapping */
  253. #define GPIO_AF4_I2C3 ((uint8_t)0x04) /*!< I2C3 Alternate Function mapping */
  254. /**
  255. * @brief AF 5 selection
  256. */
  257. #define GPIO_AF5_SPI1 ((uint8_t)0x05) /*!< SPI1 Alternate Function mapping */
  258. #define GPIO_AF5_SPI2 ((uint8_t)0x05) /*!< SPI2 Alternate Function mapping */
  259. /**
  260. * @brief AF 6 selection
  261. */
  262. #define GPIO_AF6_MCO ((uint8_t)0x06) /*!< MCO Alternate Function mapping */
  263. #define GPIO_AF6_LSCO ((uint8_t)0x06) /*!< LSCO Alternate Function mapping */
  264. #define GPIO_AF6_RF_DTB0 ((uint8_t)0x06) /*!< RF_DTB0 Alternate Function mapping */
  265. #define GPIO_AF6_RF_DTB1 ((uint8_t)0x06) /*!< RF_DTB1 Alternate Function mapping */
  266. #define GPIO_AF6_RF_DTB2 ((uint8_t)0x06) /*!< RF_DTB2 Alternate Function mapping */
  267. #define GPIO_AF6_RF_DTB3 ((uint8_t)0x06) /*!< RF_DTB3 Alternate Function mapping */
  268. #define GPIO_AF6_RF_DTB4 ((uint8_t)0x06) /*!< RF_DTB4 Alternate Function mapping */
  269. #define GPIO_AF6_RF_DTB5 ((uint8_t)0x06) /*!< RF_DTB5 Alternate Function mapping */
  270. #define GPIO_AF6_RF_DTB6 ((uint8_t)0x06) /*!< RF_DTB6 Alternate Function mapping */
  271. #define GPIO_AF6_RF_DTB7 ((uint8_t)0x06) /*!< RF_DTB7 Alternate Function mapping */
  272. #define GPIO_AF6_RF_DTB8 ((uint8_t)0x06) /*!< RF_DTB8 Alternate Function mapping */
  273. #define GPIO_AF6_RF_DTB9 ((uint8_t)0x06) /*!< RF_DTB9 Alternate Function mapping */
  274. #define GPIO_AF6_RF_DTB10 ((uint8_t)0x06) /*!< RF_DTB10 Alternate Function mapping */
  275. #define GPIO_AF6_RF_DTB11 ((uint8_t)0x06) /*!< RF_DTB11 Alternate Function mapping */
  276. #define GPIO_AF6_RF_DTB12 ((uint8_t)0x06) /*!< RF_DTB12 Alternate Function mapping */
  277. #define GPIO_AF6_RF_DTB13 ((uint8_t)0x06) /*!< RF_DTB13 Alternate Function mapping */
  278. #define GPIO_AF6_RF_DTB14 ((uint8_t)0x06) /*!< RF_DTB14 Alternate Function mapping */
  279. #define GPIO_AF6_RF_DTB15 ((uint8_t)0x06) /*!< RF_DTB15 Alternate Function mapping */
  280. #define GPIO_AF6_RF_DTB16 ((uint8_t)0x06) /*!< RF_DTB16 Alternate Function mapping */
  281. #define GPIO_AF6_RF_DTB17 ((uint8_t)0x06) /*!< RF_DTB17 Alternate Function mapping */
  282. #define GPIO_AF6_RF_DTB18 ((uint8_t)0x06) /*!< RF_DTB18 Alternate Function mapping */
  283. #define GPIO_AF6_RF_MISO ((uint8_t)0x06) /*!< RF_MISO Alternate Function mapping */
  284. #define GPIO_AF6_RF_MOSI ((uint8_t)0x06) /*!< RF_MOSI Alternate Function mapping */
  285. #define GPIO_AF6_RF_SCK ((uint8_t)0x06) /*!< RF_SCK Alternate Function mapping */
  286. #define GPIO_AF6_RF_NSS ((uint8_t)0x06) /*!< RF_NSS Alternate Function mapping */
  287. /**
  288. * @brief AF 7 selection
  289. */
  290. #define GPIO_AF7_USART1 ((uint8_t)0x07) /*!< USART1 Alternate Function mapping */
  291. /**
  292. * @brief AF 8 selection
  293. */
  294. #define GPIO_AF8_LPUART1 ((uint8_t)0x08) /*!< LPUART1 Alternate Function mapping */
  295. #define GPIO_AF8_IR ((uint8_t)0x08) /*!< IR Alternate Function mapping */
  296. /**
  297. * @brief AF 9 selection
  298. */
  299. #define GPIO_AF9_TSC ((uint8_t)0x09) /*!< TSC Alternate Function mapping */
  300. /**
  301. * @brief AF 10 selection
  302. */
  303. #define GPIO_AF10_QUADSPI ((uint8_t)0x0a) /*!< QUADSPI Alternate Function mapping */
  304. #define GPIO_AF10_USB ((uint8_t)0x0a) /*!< USB Alternate Function mapping */
  305. /**
  306. * @brief AF 11 selection
  307. */
  308. #define GPIO_AF11_LCD ((uint8_t)0x0b) /*!< LCD Alternate Function mapping */
  309. /**
  310. * @brief AF 12 selection
  311. */
  312. #define GPIO_AF12_COMP1 ((uint8_t)0x0c) /*!< COMP1 Alternate Function mapping */
  313. #define GPIO_AF12_COMP2 ((uint8_t)0x0c) /*!< COMP2 Alternate Function mapping */
  314. #define GPIO_AF12_TIM1 ((uint8_t)0x0c) /*!< TIM1 Alternate Function mapping */
  315. /**
  316. * @brief AF 13 selection
  317. */
  318. #define GPIO_AF13_SAI1 ((uint8_t)0x0d) /*!< SAI1 Alternate Function mapping */
  319. /**
  320. * @brief AF 14 selection
  321. */
  322. #define GPIO_AF14_TIM2 ((uint8_t)0x0e) /*!< TIM2 Alternate Function mapping */
  323. #define GPIO_AF14_TIM16 ((uint8_t)0x0e) /*!< TIM16 Alternate Function mapping */
  324. #define GPIO_AF14_TIM17 ((uint8_t)0x0e) /*!< TIM17 Alternate Function mapping */
  325. #define GPIO_AF14_LPTIM2 ((uint8_t)0x0e) /*!< LPTIM2 Alternate Function mapping */
  326. /**
  327. * @brief AF 15 selection
  328. */
  329. #define GPIO_AF15_EVENTOUT ((uint8_t)0x0f) /*!< EVENTOUT Alternate Function mapping */
  330. #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x0f)
  331. #endif
  332. #if defined (STM32WB35xx)
  333. /**
  334. * @brief AF 0 selection
  335. */
  336. #define GPIO_AF0_MCO ((uint8_t)0x00) /*!< MCO Alternate Function mapping */
  337. #define GPIO_AF0_LSCO ((uint8_t)0x00) /*!< LSCO Alternate Function mapping */
  338. #define GPIO_AF0_JTMS_SWDIO ((uint8_t)0x00) /*!< JTMS-SWDIO Alternate Function mapping */
  339. #define GPIO_AF0_JTCK_SWCLK ((uint8_t)0x00) /*!< JTCK-SWCLK Alternate Function mapping */
  340. #define GPIO_AF0_JTDI ((uint8_t)0x00) /*!< JTDI Alternate Function mapping */
  341. #define GPIO_AF0_RTC_OUT ((uint8_t)0x00) /*!< RCT_OUT Alternate Function mapping */
  342. #define GPIO_AF0_JTD_TRACE ((uint8_t)0x00) /*!< JTDO-TRACESWO Alternate Function mapping */
  343. #define GPIO_AF0_NJTRST ((uint8_t)0x00) /*!< NJTRST Alternate Function mapping */
  344. #define GPIO_AF0_TRACED0 ((uint8_t)0x00) /*!< TRACED0 Alternate Function mapping */
  345. #define GPIO_AF0_TRACED1 ((uint8_t)0x00) /*!< TRACED1 Alternate Function mapping */
  346. #define GPIO_AF0_TRACED2 ((uint8_t)0x00) /*!< TRACED2 Alternate Function mapping */
  347. #define GPIO_AF0_TRACED3 ((uint8_t)0x00) /*!< TRACED3 Alternate Function mapping */
  348. /**
  349. * @brief AF 1 selection
  350. */
  351. #define GPIO_AF1_TIM1 ((uint8_t)0x01) /*!< TIM1 Alternate Function mapping */
  352. #define GPIO_AF1_TIM2 ((uint8_t)0x01) /*!< TIM2 Alternate Function mapping */
  353. #define GPIO_AF1_LPTIM1 ((uint8_t)0x01) /*!< LPTIM1 Alternate Function mapping */
  354. /**
  355. * @brief AF 2 selection
  356. */
  357. #define GPIO_AF2_TIM1 ((uint8_t)0x02) /*!< TIM1 Alternate Function mapping */
  358. #define GPIO_AF2_TIM2 ((uint8_t)0x02) /*!< TIM2 Alternate Function mapping */
  359. /**
  360. * @brief AF 3 selection
  361. */
  362. #define GPIO_AF3_SPI1 ((uint8_t)0x03) /*!< SPI1 Alternate Function mapping */
  363. #define GPIO_AF3_SPI2 ((uint8_t)0x03) /*!< SPI2 Alternate Function mapping */
  364. #define GPIO_AF3_TIM1 ((uint8_t)0x03) /*!< TIM1 Alternate Function mapping */
  365. /**
  366. * @brief AF 4 selection
  367. */
  368. #define GPIO_AF4_I2C1 ((uint8_t)0x04) /*!< I2C1 Alternate Function mapping */
  369. #define GPIO_AF4_I2C3 ((uint8_t)0x04) /*!< I2C3 Alternate Function mapping */
  370. #define GPIO_AF4_SPI1 ((uint8_t)0x04) /*!< SPI1 Alternate Function mapping */
  371. /**
  372. * @brief AF 5 selection
  373. */
  374. #define GPIO_AF5_SPI1 ((uint8_t)0x05) /*!< SPI1 Alternate Function mapping */
  375. #define GPIO_AF5_SPI2 ((uint8_t)0x05) /*!< SPI2 Alternate Function mapping */
  376. /**
  377. * @brief AF 6 selection
  378. */
  379. #define GPIO_AF6_MCO ((uint8_t)0x06) /*!< MCO Alternate Function mapping */
  380. #define GPIO_AF6_RF_DTB0 ((uint8_t)0x06) /*!< RF_DTB0 Alternate Function mapping */
  381. #define GPIO_AF6_RF_DTB1 ((uint8_t)0x06) /*!< RF_DTB1 Alternate Function mapping */
  382. #define GPIO_AF6_RF_DTB2 ((uint8_t)0x06) /*!< RF_DTB2 Alternate Function mapping */
  383. #define GPIO_AF6_RF_DTB3 ((uint8_t)0x06) /*!< RF_DTB3 Alternate Function mapping */
  384. #define GPIO_AF6_RF_DTB4 ((uint8_t)0x06) /*!< RF_DTB4 Alternate Function mapping */
  385. #define GPIO_AF6_RF_DTB5 ((uint8_t)0x06) /*!< RF_DTB5 Alternate Function mapping */
  386. #define GPIO_AF6_RF_DTB6 ((uint8_t)0x06) /*!< RF_DTB6 Alternate Function mapping */
  387. #define GPIO_AF6_RF_DTB7 ((uint8_t)0x06) /*!< RF_DTB7 Alternate Function mapping */
  388. #define GPIO_AF6_RF_DTB8 ((uint8_t)0x06) /*!< RF_DTB8 Alternate Function mapping */
  389. #define GPIO_AF6_RF_DTB9 ((uint8_t)0x06) /*!< RF_DTB9 Alternate Function mapping */
  390. #define GPIO_AF6_RF_DTB10 ((uint8_t)0x06) /*!< RF_DTB10 Alternate Function mapping */
  391. #define GPIO_AF6_RF_DTB11 ((uint8_t)0x06) /*!< RF_DTB11 Alternate Function mapping */
  392. #define GPIO_AF6_RF_DTB12 ((uint8_t)0x06) /*!< RF_DTB12 Alternate Function mapping */
  393. #define GPIO_AF6_RF_DTB13 ((uint8_t)0x06) /*!< RF_DTB13 Alternate Function mapping */
  394. #define GPIO_AF6_RF_DTB14 ((uint8_t)0x06) /*!< RF_DTB14 Alternate Function mapping */
  395. #define GPIO_AF6_RF_DTB15 ((uint8_t)0x06) /*!< RF_DTB15 Alternate Function mapping */
  396. #define GPIO_AF6_RF_DTB16 ((uint8_t)0x06) /*!< RF_DTB16 Alternate Function mapping */
  397. #define GPIO_AF6_RF_DTB17 ((uint8_t)0x06) /*!< RF_DTB17 Alternate Function mapping */
  398. #define GPIO_AF6_RF_DTB18 ((uint8_t)0x06) /*!< RF_DTB18 Alternate Function mapping */
  399. #define GPIO_AF6_RF_MISO ((uint8_t)0x06) /*!< RF_MISO Alternate Function mapping */
  400. #define GPIO_AF6_RF_MOSI ((uint8_t)0x06) /*!< RF_MOSI Alternate Function mapping */
  401. #define GPIO_AF6_RF_SCK ((uint8_t)0x06) /*!< RF_SCK Alternate Function mapping */
  402. #define GPIO_AF6_RF_NSS ((uint8_t)0x06) /*!< RF_NSS Alternate Function mapping */
  403. /**
  404. * @brief AF 7 selection
  405. */
  406. #define GPIO_AF7_USART1 ((uint8_t)0x07) /*!< USART1 Alternate Function mapping */
  407. /**
  408. * @brief AF 8 selection
  409. */
  410. #define GPIO_AF8_IR ((uint8_t)0x08) /*!< IR Alternate Function mapping */
  411. #define GPIO_AF8_LPUART1 ((uint8_t)0x08) /*!< LPUART1 Alternate Function mapping */
  412. /**
  413. * @brief AF 9 selection
  414. */
  415. #define GPIO_AF9_TSC ((uint8_t)0x09) /*!< TSC Alternate Function mapping */
  416. /**
  417. * @brief AF 10 selection
  418. */
  419. #define GPIO_AF10_QUADSPI ((uint8_t)0x0A) /*!< QUADSPI Alternate Function mapping */
  420. #define GPIO_AF10_USB ((uint8_t)0x0A) /*!< USB Alternate Function mapping */
  421. /**
  422. * @brief AF 12 selection
  423. */
  424. #define GPIO_AF12_COMP1 ((uint8_t)0x0C) /*!< COMP1 Alternate Function mapping */
  425. #define GPIO_AF12_COMP2 ((uint8_t)0x0C) /*!< COMP2 Alternate Function mapping */
  426. #define GPIO_AF12_TIM1 ((uint8_t)0x0C) /*!< TIM1 Alternate Function mapping */
  427. /**
  428. * @brief AF 14 selection
  429. */
  430. #define GPIO_AF14_LPTIM2 ((uint8_t)0x0E) /*!< LPTIM2 Alternate Function mapping */
  431. #define GPIO_AF14_TIM2 ((uint8_t)0x0E) /*!< TIM2 Alternate Function mapping */
  432. #define GPIO_AF14_TIM16 ((uint8_t)0x0E) /*!< TIM16 Alternate Function mapping */
  433. #define GPIO_AF14_TIM17 ((uint8_t)0x0E) /*!< TIM17 Alternate Function mapping */
  434. /**
  435. * @brief AF 15 selection
  436. */
  437. #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /*!< EVENTOUT Alternate Function mapping */
  438. #define IS_GPIO_AF(AF) (((AF) <= (uint8_t)0x0F) && ((AF) != (uint8_t)0x0B) && ((AF) != (uint8_t)0x0D))
  439. #endif
  440. #if defined (STM32WB30xx)
  441. /**
  442. * @brief AF 0 selection
  443. */
  444. #define GPIO_AF0_MCO ((uint8_t)0x00) /*!< MCO Alternate Function mapping */
  445. #define GPIO_AF0_LSCO ((uint8_t)0x00) /*!< LSCO Alternate Function mapping */
  446. #define GPIO_AF0_JTMS_SWDIO ((uint8_t)0x00) /*!< JTMS-SWDIO Alternate Function mapping */
  447. #define GPIO_AF0_JTCK_SWCLK ((uint8_t)0x00) /*!< JTCK-SWCLK Alternate Function mapping */
  448. #define GPIO_AF0_JTDI ((uint8_t)0x00) /*!< JTDI Alternate Function mapping */
  449. #define GPIO_AF0_RTC_OUT ((uint8_t)0x00) /*!< RCT_OUT Alternate Function mapping */
  450. #define GPIO_AF0_JTD_TRACE ((uint8_t)0x00) /*!< JTDO-TRACESWO Alternate Function mapping */
  451. #define GPIO_AF0_NJTRST ((uint8_t)0x00) /*!< NJTRST Alternate Function mapping */
  452. #define GPIO_AF0_TRACED0 ((uint8_t)0x00) /*!< TRACED0 Alternate Function mapping */
  453. #define GPIO_AF0_TRACED1 ((uint8_t)0x00) /*!< TRACED1 Alternate Function mapping */
  454. #define GPIO_AF0_TRACED2 ((uint8_t)0x00) /*!< TRACED2 Alternate Function mapping */
  455. #define GPIO_AF0_TRACED3 ((uint8_t)0x00) /*!< TRACED3 Alternate Function mapping */
  456. /**
  457. * @brief AF 1 selection
  458. */
  459. #define GPIO_AF1_TIM1 ((uint8_t)0x01) /*!< TIM1 Alternate Function mapping */
  460. #define GPIO_AF1_TIM2 ((uint8_t)0x01) /*!< TIM2 Alternate Function mapping */
  461. #define GPIO_AF1_LPTIM1 ((uint8_t)0x01) /*!< LPTIM1 Alternate Function mapping */
  462. /**
  463. * @brief AF 2 selection
  464. */
  465. #define GPIO_AF2_TIM1 ((uint8_t)0x02) /*!< TIM1 Alternate Function mapping */
  466. #define GPIO_AF2_TIM2 ((uint8_t)0x02) /*!< TIM2 Alternate Function mapping */
  467. /**
  468. * @brief AF 3 selection
  469. */
  470. #define GPIO_AF3_TIM1 ((uint8_t)0x03) /*!< TIM1 Alternate Function mapping */
  471. /**
  472. * @brief AF 4 selection
  473. */
  474. #define GPIO_AF4_I2C1 ((uint8_t)0x04) /*!< I2C1 Alternate Function mapping */
  475. #define GPIO_AF4_SPI1 ((uint8_t)0x04) /*!< SPI1 Alternate Function mapping */
  476. /**
  477. * @brief AF 5 selection
  478. */
  479. #define GPIO_AF5_SPI1 ((uint8_t)0x05) /*!< SPI1 Alternate Function mapping */
  480. /**
  481. * @brief AF 6 selection
  482. */
  483. #define GPIO_AF6_MCO ((uint8_t)0x06) /*!< MCO Alternate Function mapping */
  484. #define GPIO_AF6_RF_DTB0 ((uint8_t)0x06) /*!< RF_DTB0 Alternate Function mapping */
  485. #define GPIO_AF6_RF_DTB1 ((uint8_t)0x06) /*!< RF_DTB1 Alternate Function mapping */
  486. #define GPIO_AF6_RF_DTB2 ((uint8_t)0x06) /*!< RF_DTB2 Alternate Function mapping */
  487. #define GPIO_AF6_RF_DTB3 ((uint8_t)0x06) /*!< RF_DTB3 Alternate Function mapping */
  488. #define GPIO_AF6_RF_DTB4 ((uint8_t)0x06) /*!< RF_DTB4 Alternate Function mapping */
  489. #define GPIO_AF6_RF_DTB5 ((uint8_t)0x06) /*!< RF_DTB5 Alternate Function mapping */
  490. #define GPIO_AF6_RF_DTB6 ((uint8_t)0x06) /*!< RF_DTB6 Alternate Function mapping */
  491. #define GPIO_AF6_RF_DTB7 ((uint8_t)0x06) /*!< RF_DTB7 Alternate Function mapping */
  492. #define GPIO_AF6_RF_DTB8 ((uint8_t)0x06) /*!< RF_DTB8 Alternate Function mapping */
  493. #define GPIO_AF6_RF_DTB9 ((uint8_t)0x06) /*!< RF_DTB9 Alternate Function mapping */
  494. #define GPIO_AF6_RF_DTB10 ((uint8_t)0x06) /*!< RF_DTB10 Alternate Function mapping */
  495. #define GPIO_AF6_RF_DTB11 ((uint8_t)0x06) /*!< RF_DTB11 Alternate Function mapping */
  496. #define GPIO_AF6_RF_DTB12 ((uint8_t)0x06) /*!< RF_DTB12 Alternate Function mapping */
  497. #define GPIO_AF6_RF_DTB13 ((uint8_t)0x06) /*!< RF_DTB13 Alternate Function mapping */
  498. #define GPIO_AF6_RF_DTB14 ((uint8_t)0x06) /*!< RF_DTB14 Alternate Function mapping */
  499. #define GPIO_AF6_RF_DTB15 ((uint8_t)0x06) /*!< RF_DTB15 Alternate Function mapping */
  500. #define GPIO_AF6_RF_DTB16 ((uint8_t)0x06) /*!< RF_DTB16 Alternate Function mapping */
  501. #define GPIO_AF6_RF_DTB17 ((uint8_t)0x06) /*!< RF_DTB17 Alternate Function mapping */
  502. #define GPIO_AF6_RF_DTB18 ((uint8_t)0x06) /*!< RF_DTB18 Alternate Function mapping */
  503. #define GPIO_AF6_RF_MISO ((uint8_t)0x06) /*!< RF_MISO Alternate Function mapping */
  504. #define GPIO_AF6_RF_MOSI ((uint8_t)0x06) /*!< RF_MOSI Alternate Function mapping */
  505. #define GPIO_AF6_RF_SCK ((uint8_t)0x06) /*!< RF_SCK Alternate Function mapping */
  506. #define GPIO_AF6_RF_NSS ((uint8_t)0x06) /*!< RF_NSS Alternate Function mapping */
  507. /**
  508. * @brief AF 7 selection
  509. */
  510. #define GPIO_AF7_USART1 ((uint8_t)0x07) /*!< USART1 Alternate Function mapping */
  511. /**
  512. * @brief AF 8 selection
  513. */
  514. #define GPIO_AF8_IR ((uint8_t)0x08) /*!< IR Alternate Function mapping */
  515. /**
  516. * @brief AF 9 selection
  517. */
  518. #define GPIO_AF9_TSC ((uint8_t)0x09) /*!< TSC Alternate Function mapping */
  519. /**
  520. * @brief AF 12 selection
  521. */
  522. #define GPIO_AF12_TIM1 ((uint8_t)0x0C) /*!< TIM1 Alternate Function mapping */
  523. /**
  524. * @brief AF 14 selection
  525. */
  526. #define GPIO_AF14_LPTIM2 ((uint8_t)0x0E) /*!< LPTIM2 Alternate Function mapping */
  527. #define GPIO_AF14_TIM2 ((uint8_t)0x0E) /*!< TIM2 Alternate Function mapping */
  528. #define GPIO_AF14_TIM16 ((uint8_t)0x0E) /*!< TIM16 Alternate Function mapping */
  529. #define GPIO_AF14_TIM17 ((uint8_t)0x0E) /*!< TIM17 Alternate Function mapping */
  530. /**
  531. * @brief AF 15 selection
  532. */
  533. #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /*!< EVENTOUT Alternate Function mapping */
  534. #define IS_GPIO_AF(AF) (((AF) <= (uint8_t)0x0F) && ((AF) != (uint8_t)0x0A) && ((AF) != (uint8_t)0x0B) && ((AF) != (uint8_t)0x0D))
  535. #endif
  536. /**
  537. * @}
  538. */
  539. /**
  540. * @}
  541. */
  542. /* Exported macro ------------------------------------------------------------*/
  543. /** @defgroup GPIOEx_Exported_Macros GPIOEx Exported Macros
  544. * @{
  545. */
  546. /** @defgroup GPIOEx_Get_Port_Index GPIOEx Get Port Index
  547. * @{
  548. */
  549. #if defined (STM32WB55xx) || defined (STM32WB5Mxx)
  550. #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0uL :\
  551. ((__GPIOx__) == (GPIOB))? 1uL :\
  552. ((__GPIOx__) == (GPIOC))? 2uL :\
  553. ((__GPIOx__) == (GPIOD))? 3uL :\
  554. ((__GPIOx__) == (GPIOE))? 4uL : 7uL)
  555. #else
  556. #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0uL :\
  557. ((__GPIOx__) == (GPIOB))? 1uL :\
  558. ((__GPIOx__) == (GPIOC))? 2uL :\
  559. ((__GPIOx__) == (GPIOE))? 4uL : 7uL)
  560. #endif
  561. /**
  562. * @}
  563. */
  564. /**
  565. * @}
  566. */
  567. /* Exported functions --------------------------------------------------------*/
  568. /**
  569. * @}
  570. */
  571. /**
  572. * @}
  573. */
  574. #ifdef __cplusplus
  575. }
  576. #endif
  577. #endif /* STM32WBxx_HAL_GPIO_EX_H */
  578. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/