Implement a secure ICS protocol targeting LoRa Node151 microcontroller for controlling irrigation.
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.
 
 
 
 
 
 

895 lines
34 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32f1xx_hal_gpio_ex.h
  4. * @author MCD Application Team
  5. * @brief Header file of GPIO HAL Extension module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2016 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 STM32F1xx_HAL_GPIO_EX_H
  21. #define STM32F1xx_HAL_GPIO_EX_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32f1xx_hal_def.h"
  27. /** @addtogroup STM32F1xx_HAL_Driver
  28. * @{
  29. */
  30. /** @defgroup GPIOEx GPIOEx
  31. * @{
  32. */
  33. /* Exported types ------------------------------------------------------------*/
  34. /* Exported constants --------------------------------------------------------*/
  35. /** @defgroup GPIOEx_Exported_Constants GPIOEx Exported Constants
  36. * @{
  37. */
  38. /** @defgroup GPIOEx_EVENTOUT EVENTOUT Cortex Configuration
  39. * @brief This section propose definition to use the Cortex EVENTOUT signal.
  40. * @{
  41. */
  42. /** @defgroup GPIOEx_EVENTOUT_PIN EVENTOUT Pin
  43. * @{
  44. */
  45. #define AFIO_EVENTOUT_PIN_0 AFIO_EVCR_PIN_PX0 /*!< EVENTOUT on pin 0 */
  46. #define AFIO_EVENTOUT_PIN_1 AFIO_EVCR_PIN_PX1 /*!< EVENTOUT on pin 1 */
  47. #define AFIO_EVENTOUT_PIN_2 AFIO_EVCR_PIN_PX2 /*!< EVENTOUT on pin 2 */
  48. #define AFIO_EVENTOUT_PIN_3 AFIO_EVCR_PIN_PX3 /*!< EVENTOUT on pin 3 */
  49. #define AFIO_EVENTOUT_PIN_4 AFIO_EVCR_PIN_PX4 /*!< EVENTOUT on pin 4 */
  50. #define AFIO_EVENTOUT_PIN_5 AFIO_EVCR_PIN_PX5 /*!< EVENTOUT on pin 5 */
  51. #define AFIO_EVENTOUT_PIN_6 AFIO_EVCR_PIN_PX6 /*!< EVENTOUT on pin 6 */
  52. #define AFIO_EVENTOUT_PIN_7 AFIO_EVCR_PIN_PX7 /*!< EVENTOUT on pin 7 */
  53. #define AFIO_EVENTOUT_PIN_8 AFIO_EVCR_PIN_PX8 /*!< EVENTOUT on pin 8 */
  54. #define AFIO_EVENTOUT_PIN_9 AFIO_EVCR_PIN_PX9 /*!< EVENTOUT on pin 9 */
  55. #define AFIO_EVENTOUT_PIN_10 AFIO_EVCR_PIN_PX10 /*!< EVENTOUT on pin 10 */
  56. #define AFIO_EVENTOUT_PIN_11 AFIO_EVCR_PIN_PX11 /*!< EVENTOUT on pin 11 */
  57. #define AFIO_EVENTOUT_PIN_12 AFIO_EVCR_PIN_PX12 /*!< EVENTOUT on pin 12 */
  58. #define AFIO_EVENTOUT_PIN_13 AFIO_EVCR_PIN_PX13 /*!< EVENTOUT on pin 13 */
  59. #define AFIO_EVENTOUT_PIN_14 AFIO_EVCR_PIN_PX14 /*!< EVENTOUT on pin 14 */
  60. #define AFIO_EVENTOUT_PIN_15 AFIO_EVCR_PIN_PX15 /*!< EVENTOUT on pin 15 */
  61. #define IS_AFIO_EVENTOUT_PIN(__PIN__) (((__PIN__) == AFIO_EVENTOUT_PIN_0) || \
  62. ((__PIN__) == AFIO_EVENTOUT_PIN_1) || \
  63. ((__PIN__) == AFIO_EVENTOUT_PIN_2) || \
  64. ((__PIN__) == AFIO_EVENTOUT_PIN_3) || \
  65. ((__PIN__) == AFIO_EVENTOUT_PIN_4) || \
  66. ((__PIN__) == AFIO_EVENTOUT_PIN_5) || \
  67. ((__PIN__) == AFIO_EVENTOUT_PIN_6) || \
  68. ((__PIN__) == AFIO_EVENTOUT_PIN_7) || \
  69. ((__PIN__) == AFIO_EVENTOUT_PIN_8) || \
  70. ((__PIN__) == AFIO_EVENTOUT_PIN_9) || \
  71. ((__PIN__) == AFIO_EVENTOUT_PIN_10) || \
  72. ((__PIN__) == AFIO_EVENTOUT_PIN_11) || \
  73. ((__PIN__) == AFIO_EVENTOUT_PIN_12) || \
  74. ((__PIN__) == AFIO_EVENTOUT_PIN_13) || \
  75. ((__PIN__) == AFIO_EVENTOUT_PIN_14) || \
  76. ((__PIN__) == AFIO_EVENTOUT_PIN_15))
  77. /**
  78. * @}
  79. */
  80. /** @defgroup GPIOEx_EVENTOUT_PORT EVENTOUT Port
  81. * @{
  82. */
  83. #define AFIO_EVENTOUT_PORT_A AFIO_EVCR_PORT_PA /*!< EVENTOUT on port A */
  84. #define AFIO_EVENTOUT_PORT_B AFIO_EVCR_PORT_PB /*!< EVENTOUT on port B */
  85. #define AFIO_EVENTOUT_PORT_C AFIO_EVCR_PORT_PC /*!< EVENTOUT on port C */
  86. #define AFIO_EVENTOUT_PORT_D AFIO_EVCR_PORT_PD /*!< EVENTOUT on port D */
  87. #define AFIO_EVENTOUT_PORT_E AFIO_EVCR_PORT_PE /*!< EVENTOUT on port E */
  88. #define IS_AFIO_EVENTOUT_PORT(__PORT__) (((__PORT__) == AFIO_EVENTOUT_PORT_A) || \
  89. ((__PORT__) == AFIO_EVENTOUT_PORT_B) || \
  90. ((__PORT__) == AFIO_EVENTOUT_PORT_C) || \
  91. ((__PORT__) == AFIO_EVENTOUT_PORT_D) || \
  92. ((__PORT__) == AFIO_EVENTOUT_PORT_E))
  93. /**
  94. * @}
  95. */
  96. /**
  97. * @}
  98. */
  99. /** @defgroup GPIOEx_AFIO_AF_REMAPPING Alternate Function Remapping
  100. * @brief This section propose definition to remap the alternate function to some other port/pins.
  101. * @{
  102. */
  103. /**
  104. * @brief Enable the remapping of SPI1 alternate function NSS, SCK, MISO and MOSI.
  105. * @note ENABLE: Remap (NSS/PA15, SCK/PB3, MISO/PB4, MOSI/PB5)
  106. * @retval None
  107. */
  108. #define __HAL_AFIO_REMAP_SPI1_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_SPI1_REMAP)
  109. /**
  110. * @brief Disable the remapping of SPI1 alternate function NSS, SCK, MISO and MOSI.
  111. * @note DISABLE: No remap (NSS/PA4, SCK/PA5, MISO/PA6, MOSI/PA7)
  112. * @retval None
  113. */
  114. #define __HAL_AFIO_REMAP_SPI1_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_SPI1_REMAP)
  115. /**
  116. * @brief Enable the remapping of I2C1 alternate function SCL and SDA.
  117. * @note ENABLE: Remap (SCL/PB8, SDA/PB9)
  118. * @retval None
  119. */
  120. #define __HAL_AFIO_REMAP_I2C1_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_I2C1_REMAP)
  121. /**
  122. * @brief Disable the remapping of I2C1 alternate function SCL and SDA.
  123. * @note DISABLE: No remap (SCL/PB6, SDA/PB7)
  124. * @retval None
  125. */
  126. #define __HAL_AFIO_REMAP_I2C1_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_I2C1_REMAP)
  127. /**
  128. * @brief Enable the remapping of USART1 alternate function TX and RX.
  129. * @note ENABLE: Remap (TX/PB6, RX/PB7)
  130. * @retval None
  131. */
  132. #define __HAL_AFIO_REMAP_USART1_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_USART1_REMAP)
  133. /**
  134. * @brief Disable the remapping of USART1 alternate function TX and RX.
  135. * @note DISABLE: No remap (TX/PA9, RX/PA10)
  136. * @retval None
  137. */
  138. #define __HAL_AFIO_REMAP_USART1_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_USART1_REMAP)
  139. /**
  140. * @brief Enable the remapping of USART2 alternate function CTS, RTS, CK, TX and RX.
  141. * @note ENABLE: Remap (CTS/PD3, RTS/PD4, TX/PD5, RX/PD6, CK/PD7)
  142. * @retval None
  143. */
  144. #define __HAL_AFIO_REMAP_USART2_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_USART2_REMAP)
  145. /**
  146. * @brief Disable the remapping of USART2 alternate function CTS, RTS, CK, TX and RX.
  147. * @note DISABLE: No remap (CTS/PA0, RTS/PA1, TX/PA2, RX/PA3, CK/PA4)
  148. * @retval None
  149. */
  150. #define __HAL_AFIO_REMAP_USART2_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_USART2_REMAP)
  151. /**
  152. * @brief Enable the remapping of USART3 alternate function CTS, RTS, CK, TX and RX.
  153. * @note ENABLE: Full remap (TX/PD8, RX/PD9, CK/PD10, CTS/PD11, RTS/PD12)
  154. * @retval None
  155. */
  156. #define __HAL_AFIO_REMAP_USART3_ENABLE() AFIO_REMAP_PARTIAL(AFIO_MAPR_USART3_REMAP_FULLREMAP, AFIO_MAPR_USART3_REMAP_FULLREMAP)
  157. /**
  158. * @brief Enable the remapping of USART3 alternate function CTS, RTS, CK, TX and RX.
  159. * @note PARTIAL: Partial remap (TX/PC10, RX/PC11, CK/PC12, CTS/PB13, RTS/PB14)
  160. * @retval None
  161. */
  162. #define __HAL_AFIO_REMAP_USART3_PARTIAL() AFIO_REMAP_PARTIAL(AFIO_MAPR_USART3_REMAP_PARTIALREMAP, AFIO_MAPR_USART3_REMAP_FULLREMAP)
  163. /**
  164. * @brief Disable the remapping of USART3 alternate function CTS, RTS, CK, TX and RX.
  165. * @note DISABLE: No remap (TX/PB10, RX/PB11, CK/PB12, CTS/PB13, RTS/PB14)
  166. * @retval None
  167. */
  168. #define __HAL_AFIO_REMAP_USART3_DISABLE() AFIO_REMAP_PARTIAL(AFIO_MAPR_USART3_REMAP_NOREMAP, AFIO_MAPR_USART3_REMAP_FULLREMAP)
  169. /**
  170. * @brief Enable the remapping of TIM1 alternate function channels 1 to 4, 1N to 3N, external trigger (ETR) and Break input (BKIN)
  171. * @note ENABLE: Full remap (ETR/PE7, CH1/PE9, CH2/PE11, CH3/PE13, CH4/PE14, BKIN/PE15, CH1N/PE8, CH2N/PE10, CH3N/PE12)
  172. * @retval None
  173. */
  174. #define __HAL_AFIO_REMAP_TIM1_ENABLE() AFIO_REMAP_PARTIAL(AFIO_MAPR_TIM1_REMAP_FULLREMAP, AFIO_MAPR_TIM1_REMAP_FULLREMAP)
  175. /**
  176. * @brief Enable the remapping of TIM1 alternate function channels 1 to 4, 1N to 3N, external trigger (ETR) and Break input (BKIN)
  177. * @note PARTIAL: Partial remap (ETR/PA12, CH1/PA8, CH2/PA9, CH3/PA10, CH4/PA11, BKIN/PA6, CH1N/PA7, CH2N/PB0, CH3N/PB1)
  178. * @retval None
  179. */
  180. #define __HAL_AFIO_REMAP_TIM1_PARTIAL() AFIO_REMAP_PARTIAL(AFIO_MAPR_TIM1_REMAP_PARTIALREMAP, AFIO_MAPR_TIM1_REMAP_FULLREMAP)
  181. /**
  182. * @brief Disable the remapping of TIM1 alternate function channels 1 to 4, 1N to 3N, external trigger (ETR) and Break input (BKIN)
  183. * @note DISABLE: No remap (ETR/PA12, CH1/PA8, CH2/PA9, CH3/PA10, CH4/PA11, BKIN/PB12, CH1N/PB13, CH2N/PB14, CH3N/PB15)
  184. * @retval None
  185. */
  186. #define __HAL_AFIO_REMAP_TIM1_DISABLE() AFIO_REMAP_PARTIAL(AFIO_MAPR_TIM1_REMAP_NOREMAP, AFIO_MAPR_TIM1_REMAP_FULLREMAP)
  187. /**
  188. * @brief Enable the remapping of TIM2 alternate function channels 1 to 4 and external trigger (ETR)
  189. * @note ENABLE: Full remap (CH1/ETR/PA15, CH2/PB3, CH3/PB10, CH4/PB11)
  190. * @retval None
  191. */
  192. #define __HAL_AFIO_REMAP_TIM2_ENABLE() AFIO_REMAP_PARTIAL(AFIO_MAPR_TIM2_REMAP_FULLREMAP, AFIO_MAPR_TIM2_REMAP_FULLREMAP)
  193. /**
  194. * @brief Enable the remapping of TIM2 alternate function channels 1 to 4 and external trigger (ETR)
  195. * @note PARTIAL_2: Partial remap (CH1/ETR/PA0, CH2/PA1, CH3/PB10, CH4/PB11)
  196. * @retval None
  197. */
  198. #define __HAL_AFIO_REMAP_TIM2_PARTIAL_2() AFIO_REMAP_PARTIAL(AFIO_MAPR_TIM2_REMAP_PARTIALREMAP2, AFIO_MAPR_TIM2_REMAP_FULLREMAP)
  199. /**
  200. * @brief Enable the remapping of TIM2 alternate function channels 1 to 4 and external trigger (ETR)
  201. * @note PARTIAL_1: Partial remap (CH1/ETR/PA15, CH2/PB3, CH3/PA2, CH4/PA3)
  202. * @retval None
  203. */
  204. #define __HAL_AFIO_REMAP_TIM2_PARTIAL_1() AFIO_REMAP_PARTIAL(AFIO_MAPR_TIM2_REMAP_PARTIALREMAP1, AFIO_MAPR_TIM2_REMAP_FULLREMAP)
  205. /**
  206. * @brief Disable the remapping of TIM2 alternate function channels 1 to 4 and external trigger (ETR)
  207. * @note DISABLE: No remap (CH1/ETR/PA0, CH2/PA1, CH3/PA2, CH4/PA3)
  208. * @retval None
  209. */
  210. #define __HAL_AFIO_REMAP_TIM2_DISABLE() AFIO_REMAP_PARTIAL(AFIO_MAPR_TIM2_REMAP_NOREMAP, AFIO_MAPR_TIM2_REMAP_FULLREMAP)
  211. /**
  212. * @brief Enable the remapping of TIM3 alternate function channels 1 to 4
  213. * @note ENABLE: Full remap (CH1/PC6, CH2/PC7, CH3/PC8, CH4/PC9)
  214. * @note TIM3_ETR on PE0 is not re-mapped.
  215. * @retval None
  216. */
  217. #define __HAL_AFIO_REMAP_TIM3_ENABLE() AFIO_REMAP_PARTIAL(AFIO_MAPR_TIM3_REMAP_FULLREMAP, AFIO_MAPR_TIM3_REMAP_FULLREMAP)
  218. /**
  219. * @brief Enable the remapping of TIM3 alternate function channels 1 to 4
  220. * @note PARTIAL: Partial remap (CH1/PB4, CH2/PB5, CH3/PB0, CH4/PB1)
  221. * @note TIM3_ETR on PE0 is not re-mapped.
  222. * @retval None
  223. */
  224. #define __HAL_AFIO_REMAP_TIM3_PARTIAL() AFIO_REMAP_PARTIAL(AFIO_MAPR_TIM3_REMAP_PARTIALREMAP, AFIO_MAPR_TIM3_REMAP_FULLREMAP)
  225. /**
  226. * @brief Disable the remapping of TIM3 alternate function channels 1 to 4
  227. * @note DISABLE: No remap (CH1/PA6, CH2/PA7, CH3/PB0, CH4/PB1)
  228. * @note TIM3_ETR on PE0 is not re-mapped.
  229. * @retval None
  230. */
  231. #define __HAL_AFIO_REMAP_TIM3_DISABLE() AFIO_REMAP_PARTIAL(AFIO_MAPR_TIM3_REMAP_NOREMAP, AFIO_MAPR_TIM3_REMAP_FULLREMAP)
  232. /**
  233. * @brief Enable the remapping of TIM4 alternate function channels 1 to 4.
  234. * @note ENABLE: Full remap (TIM4_CH1/PD12, TIM4_CH2/PD13, TIM4_CH3/PD14, TIM4_CH4/PD15)
  235. * @note TIM4_ETR on PE0 is not re-mapped.
  236. * @retval None
  237. */
  238. #define __HAL_AFIO_REMAP_TIM4_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_TIM4_REMAP)
  239. /**
  240. * @brief Disable the remapping of TIM4 alternate function channels 1 to 4.
  241. * @note DISABLE: No remap (TIM4_CH1/PB6, TIM4_CH2/PB7, TIM4_CH3/PB8, TIM4_CH4/PB9)
  242. * @note TIM4_ETR on PE0 is not re-mapped.
  243. * @retval None
  244. */
  245. #define __HAL_AFIO_REMAP_TIM4_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_TIM4_REMAP)
  246. #if defined(AFIO_MAPR_CAN_REMAP_REMAP1)
  247. /**
  248. * @brief Enable or disable the remapping of CAN alternate function CAN_RX and CAN_TX in devices with a single CAN interface.
  249. * @note CASE 1: CAN_RX mapped to PA11, CAN_TX mapped to PA12
  250. * @retval None
  251. */
  252. #define __HAL_AFIO_REMAP_CAN1_1() AFIO_REMAP_PARTIAL(AFIO_MAPR_CAN_REMAP_REMAP1, AFIO_MAPR_CAN_REMAP)
  253. /**
  254. * @brief Enable or disable the remapping of CAN alternate function CAN_RX and CAN_TX in devices with a single CAN interface.
  255. * @note CASE 2: CAN_RX mapped to PB8, CAN_TX mapped to PB9 (not available on 36-pin package)
  256. * @retval None
  257. */
  258. #define __HAL_AFIO_REMAP_CAN1_2() AFIO_REMAP_PARTIAL(AFIO_MAPR_CAN_REMAP_REMAP2, AFIO_MAPR_CAN_REMAP)
  259. /**
  260. * @brief Enable or disable the remapping of CAN alternate function CAN_RX and CAN_TX in devices with a single CAN interface.
  261. * @note CASE 3: CAN_RX mapped to PD0, CAN_TX mapped to PD1
  262. * @retval None
  263. */
  264. #define __HAL_AFIO_REMAP_CAN1_3() AFIO_REMAP_PARTIAL(AFIO_MAPR_CAN_REMAP_REMAP3, AFIO_MAPR_CAN_REMAP)
  265. #endif
  266. /**
  267. * @brief Enable the remapping of PD0 and PD1. When the HSE oscillator is not used
  268. * (application running on internal 8 MHz RC) PD0 and PD1 can be mapped on OSC_IN and
  269. * OSC_OUT. This is available only on 36, 48 and 64 pins packages (PD0 and PD1 are available
  270. * on 100-pin and 144-pin packages, no need for remapping).
  271. * @note ENABLE: PD0 remapped on OSC_IN, PD1 remapped on OSC_OUT.
  272. * @retval None
  273. */
  274. #define __HAL_AFIO_REMAP_PD01_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_PD01_REMAP)
  275. /**
  276. * @brief Disable the remapping of PD0 and PD1. When the HSE oscillator is not used
  277. * (application running on internal 8 MHz RC) PD0 and PD1 can be mapped on OSC_IN and
  278. * OSC_OUT. This is available only on 36, 48 and 64 pins packages (PD0 and PD1 are available
  279. * on 100-pin and 144-pin packages, no need for remapping).
  280. * @note DISABLE: No remapping of PD0 and PD1
  281. * @retval None
  282. */
  283. #define __HAL_AFIO_REMAP_PD01_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_PD01_REMAP)
  284. #if defined(AFIO_MAPR_TIM5CH4_IREMAP)
  285. /**
  286. * @brief Enable the remapping of TIM5CH4.
  287. * @note ENABLE: LSI internal clock is connected to TIM5_CH4 input for calibration purpose.
  288. * @note This function is available only in high density value line devices.
  289. * @retval None
  290. */
  291. #define __HAL_AFIO_REMAP_TIM5CH4_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_TIM5CH4_IREMAP)
  292. /**
  293. * @brief Disable the remapping of TIM5CH4.
  294. * @note DISABLE: TIM5_CH4 is connected to PA3
  295. * @note This function is available only in high density value line devices.
  296. * @retval None
  297. */
  298. #define __HAL_AFIO_REMAP_TIM5CH4_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_TIM5CH4_IREMAP)
  299. #endif
  300. #if defined(AFIO_MAPR_ETH_REMAP)
  301. /**
  302. * @brief Enable the remapping of Ethernet MAC connections with the PHY.
  303. * @note ENABLE: Remap (RX_DV-CRS_DV/PD8, RXD0/PD9, RXD1/PD10, RXD2/PD11, RXD3/PD12)
  304. * @note This bit is available only in connectivity line devices and is reserved otherwise.
  305. * @retval None
  306. */
  307. #define __HAL_AFIO_REMAP_ETH_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_ETH_REMAP)
  308. /**
  309. * @brief Disable the remapping of Ethernet MAC connections with the PHY.
  310. * @note DISABLE: No remap (RX_DV-CRS_DV/PA7, RXD0/PC4, RXD1/PC5, RXD2/PB0, RXD3/PB1)
  311. * @note This bit is available only in connectivity line devices and is reserved otherwise.
  312. * @retval None
  313. */
  314. #define __HAL_AFIO_REMAP_ETH_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_ETH_REMAP)
  315. #endif
  316. #if defined(AFIO_MAPR_CAN2_REMAP)
  317. /**
  318. * @brief Enable the remapping of CAN2 alternate function CAN2_RX and CAN2_TX.
  319. * @note ENABLE: Remap (CAN2_RX/PB5, CAN2_TX/PB6)
  320. * @note This bit is available only in connectivity line devices and is reserved otherwise.
  321. * @retval None
  322. */
  323. #define __HAL_AFIO_REMAP_CAN2_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_CAN2_REMAP)
  324. /**
  325. * @brief Disable the remapping of CAN2 alternate function CAN2_RX and CAN2_TX.
  326. * @note DISABLE: No remap (CAN2_RX/PB12, CAN2_TX/PB13)
  327. * @note This bit is available only in connectivity line devices and is reserved otherwise.
  328. * @retval None
  329. */
  330. #define __HAL_AFIO_REMAP_CAN2_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_CAN2_REMAP)
  331. #endif
  332. #if defined(AFIO_MAPR_MII_RMII_SEL)
  333. /**
  334. * @brief Configures the Ethernet MAC internally for use with an external MII or RMII PHY.
  335. * @note ETH_RMII: Configure Ethernet MAC for connection with an RMII PHY
  336. * @note This bit is available only in connectivity line devices and is reserved otherwise.
  337. * @retval None
  338. */
  339. #define __HAL_AFIO_ETH_RMII() AFIO_REMAP_ENABLE(AFIO_MAPR_MII_RMII_SEL)
  340. /**
  341. * @brief Configures the Ethernet MAC internally for use with an external MII or RMII PHY.
  342. * @note ETH_MII: Configure Ethernet MAC for connection with an MII PHY
  343. * @note This bit is available only in connectivity line devices and is reserved otherwise.
  344. * @retval None
  345. */
  346. #define __HAL_AFIO_ETH_MII() AFIO_REMAP_DISABLE(AFIO_MAPR_MII_RMII_SEL)
  347. #endif
  348. /**
  349. * @brief Enable the remapping of ADC1_ETRGINJ (ADC 1 External trigger injected conversion).
  350. * @note ENABLE: ADC1 External Event injected conversion is connected to TIM8 Channel4.
  351. * @retval None
  352. */
  353. #define __HAL_AFIO_REMAP_ADC1_ETRGINJ_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_ADC1_ETRGINJ_REMAP)
  354. /**
  355. * @brief Disable the remapping of ADC1_ETRGINJ (ADC 1 External trigger injected conversion).
  356. * @note DISABLE: ADC1 External trigger injected conversion is connected to EXTI15
  357. * @retval None
  358. */
  359. #define __HAL_AFIO_REMAP_ADC1_ETRGINJ_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_ADC1_ETRGINJ_REMAP)
  360. /**
  361. * @brief Enable the remapping of ADC1_ETRGREG (ADC 1 External trigger regular conversion).
  362. * @note ENABLE: ADC1 External Event regular conversion is connected to TIM8 TRG0.
  363. * @retval None
  364. */
  365. #define __HAL_AFIO_REMAP_ADC1_ETRGREG_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_ADC1_ETRGREG_REMAP)
  366. /**
  367. * @brief Disable the remapping of ADC1_ETRGREG (ADC 1 External trigger regular conversion).
  368. * @note DISABLE: ADC1 External trigger regular conversion is connected to EXTI11
  369. * @retval None
  370. */
  371. #define __HAL_AFIO_REMAP_ADC1_ETRGREG_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_ADC1_ETRGREG_REMAP)
  372. #if defined(AFIO_MAPR_ADC2_ETRGINJ_REMAP)
  373. /**
  374. * @brief Enable the remapping of ADC2_ETRGREG (ADC 2 External trigger injected conversion).
  375. * @note ENABLE: ADC2 External Event injected conversion is connected to TIM8 Channel4.
  376. * @retval None
  377. */
  378. #define __HAL_AFIO_REMAP_ADC2_ETRGINJ_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_ADC2_ETRGINJ_REMAP)
  379. /**
  380. * @brief Disable the remapping of ADC2_ETRGREG (ADC 2 External trigger injected conversion).
  381. * @note DISABLE: ADC2 External trigger injected conversion is connected to EXTI15
  382. * @retval None
  383. */
  384. #define __HAL_AFIO_REMAP_ADC2_ETRGINJ_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_ADC2_ETRGINJ_REMAP)
  385. #endif
  386. #if defined (AFIO_MAPR_ADC2_ETRGREG_REMAP)
  387. /**
  388. * @brief Enable the remapping of ADC2_ETRGREG (ADC 2 External trigger regular conversion).
  389. * @note ENABLE: ADC2 External Event regular conversion is connected to TIM8 TRG0.
  390. * @retval None
  391. */
  392. #define __HAL_AFIO_REMAP_ADC2_ETRGREG_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_ADC2_ETRGREG_REMAP)
  393. /**
  394. * @brief Disable the remapping of ADC2_ETRGREG (ADC 2 External trigger regular conversion).
  395. * @note DISABLE: ADC2 External trigger regular conversion is connected to EXTI11
  396. * @retval None
  397. */
  398. #define __HAL_AFIO_REMAP_ADC2_ETRGREG_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_ADC2_ETRGREG_REMAP)
  399. #endif
  400. /**
  401. * @brief Enable the Serial wire JTAG configuration
  402. * @note ENABLE: Full SWJ (JTAG-DP + SW-DP): Reset State
  403. * @retval None
  404. */
  405. #define __HAL_AFIO_REMAP_SWJ_ENABLE() AFIO_DBGAFR_CONFIG(AFIO_MAPR_SWJ_CFG_RESET)
  406. /**
  407. * @brief Enable the Serial wire JTAG configuration
  408. * @note NONJTRST: Full SWJ (JTAG-DP + SW-DP) but without NJTRST
  409. * @retval None
  410. */
  411. #define __HAL_AFIO_REMAP_SWJ_NONJTRST() AFIO_DBGAFR_CONFIG(AFIO_MAPR_SWJ_CFG_NOJNTRST)
  412. /**
  413. * @brief Enable the Serial wire JTAG configuration
  414. * @note NOJTAG: JTAG-DP Disabled and SW-DP Enabled
  415. * @retval None
  416. */
  417. #define __HAL_AFIO_REMAP_SWJ_NOJTAG() AFIO_DBGAFR_CONFIG(AFIO_MAPR_SWJ_CFG_JTAGDISABLE)
  418. /**
  419. * @brief Disable the Serial wire JTAG configuration
  420. * @note DISABLE: JTAG-DP Disabled and SW-DP Disabled
  421. * @retval None
  422. */
  423. #define __HAL_AFIO_REMAP_SWJ_DISABLE() AFIO_DBGAFR_CONFIG(AFIO_MAPR_SWJ_CFG_DISABLE)
  424. #if defined(AFIO_MAPR_SPI3_REMAP)
  425. /**
  426. * @brief Enable the remapping of SPI3 alternate functions SPI3_NSS/I2S3_WS, SPI3_SCK/I2S3_CK, SPI3_MISO, SPI3_MOSI/I2S3_SD.
  427. * @note ENABLE: Remap (SPI3_NSS-I2S3_WS/PA4, SPI3_SCK-I2S3_CK/PC10, SPI3_MISO/PC11, SPI3_MOSI-I2S3_SD/PC12)
  428. * @note This bit is available only in connectivity line devices and is reserved otherwise.
  429. * @retval None
  430. */
  431. #define __HAL_AFIO_REMAP_SPI3_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_SPI3_REMAP)
  432. /**
  433. * @brief Disable the remapping of SPI3 alternate functions SPI3_NSS/I2S3_WS, SPI3_SCK/I2S3_CK, SPI3_MISO, SPI3_MOSI/I2S3_SD.
  434. * @note DISABLE: No remap (SPI3_NSS-I2S3_WS/PA15, SPI3_SCK-I2S3_CK/PB3, SPI3_MISO/PB4, SPI3_MOSI-I2S3_SD/PB5).
  435. * @note This bit is available only in connectivity line devices and is reserved otherwise.
  436. * @retval None
  437. */
  438. #define __HAL_AFIO_REMAP_SPI3_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_SPI3_REMAP)
  439. #endif
  440. #if defined(AFIO_MAPR_TIM2ITR1_IREMAP)
  441. /**
  442. * @brief Control of TIM2_ITR1 internal mapping.
  443. * @note TO_USB: Connect USB OTG SOF (Start of Frame) output to TIM2_ITR1 for calibration purposes.
  444. * @note This bit is available only in connectivity line devices and is reserved otherwise.
  445. * @retval None
  446. */
  447. #define __HAL_AFIO_TIM2ITR1_TO_USB() AFIO_REMAP_ENABLE(AFIO_MAPR_TIM2ITR1_IREMAP)
  448. /**
  449. * @brief Control of TIM2_ITR1 internal mapping.
  450. * @note TO_ETH: Connect TIM2_ITR1 internally to the Ethernet PTP output for calibration purposes.
  451. * @note This bit is available only in connectivity line devices and is reserved otherwise.
  452. * @retval None
  453. */
  454. #define __HAL_AFIO_TIM2ITR1_TO_ETH() AFIO_REMAP_DISABLE(AFIO_MAPR_TIM2ITR1_IREMAP)
  455. #endif
  456. #if defined(AFIO_MAPR_PTP_PPS_REMAP)
  457. /**
  458. * @brief Enable the remapping of ADC2_ETRGREG (ADC 2 External trigger regular conversion).
  459. * @note ENABLE: PTP_PPS is output on PB5 pin.
  460. * @note This bit is available only in connectivity line devices and is reserved otherwise.
  461. * @retval None
  462. */
  463. #define __HAL_AFIO_ETH_PTP_PPS_ENABLE() AFIO_REMAP_ENABLE(AFIO_MAPR_PTP_PPS_REMAP)
  464. /**
  465. * @brief Disable the remapping of ADC2_ETRGREG (ADC 2 External trigger regular conversion).
  466. * @note DISABLE: PTP_PPS not output on PB5 pin.
  467. * @note This bit is available only in connectivity line devices and is reserved otherwise.
  468. * @retval None
  469. */
  470. #define __HAL_AFIO_ETH_PTP_PPS_DISABLE() AFIO_REMAP_DISABLE(AFIO_MAPR_PTP_PPS_REMAP)
  471. #endif
  472. #if defined(AFIO_MAPR2_TIM9_REMAP)
  473. /**
  474. * @brief Enable the remapping of TIM9_CH1 and TIM9_CH2.
  475. * @note ENABLE: Remap (TIM9_CH1 on PE5 and TIM9_CH2 on PE6).
  476. * @retval None
  477. */
  478. #define __HAL_AFIO_REMAP_TIM9_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM9_REMAP)
  479. /**
  480. * @brief Disable the remapping of TIM9_CH1 and TIM9_CH2.
  481. * @note DISABLE: No remap (TIM9_CH1 on PA2 and TIM9_CH2 on PA3).
  482. * @retval None
  483. */
  484. #define __HAL_AFIO_REMAP_TIM9_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM9_REMAP)
  485. #endif
  486. #if defined(AFIO_MAPR2_TIM10_REMAP)
  487. /**
  488. * @brief Enable the remapping of TIM10_CH1.
  489. * @note ENABLE: Remap (TIM10_CH1 on PF6).
  490. * @retval None
  491. */
  492. #define __HAL_AFIO_REMAP_TIM10_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM10_REMAP)
  493. /**
  494. * @brief Disable the remapping of TIM10_CH1.
  495. * @note DISABLE: No remap (TIM10_CH1 on PB8).
  496. * @retval None
  497. */
  498. #define __HAL_AFIO_REMAP_TIM10_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM10_REMAP)
  499. #endif
  500. #if defined(AFIO_MAPR2_TIM11_REMAP)
  501. /**
  502. * @brief Enable the remapping of TIM11_CH1.
  503. * @note ENABLE: Remap (TIM11_CH1 on PF7).
  504. * @retval None
  505. */
  506. #define __HAL_AFIO_REMAP_TIM11_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM11_REMAP)
  507. /**
  508. * @brief Disable the remapping of TIM11_CH1.
  509. * @note DISABLE: No remap (TIM11_CH1 on PB9).
  510. * @retval None
  511. */
  512. #define __HAL_AFIO_REMAP_TIM11_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM11_REMAP)
  513. #endif
  514. #if defined(AFIO_MAPR2_TIM13_REMAP)
  515. /**
  516. * @brief Enable the remapping of TIM13_CH1.
  517. * @note ENABLE: Remap STM32F100:(TIM13_CH1 on PF8). Others:(TIM13_CH1 on PB0).
  518. * @retval None
  519. */
  520. #define __HAL_AFIO_REMAP_TIM13_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM13_REMAP)
  521. /**
  522. * @brief Disable the remapping of TIM13_CH1.
  523. * @note DISABLE: No remap STM32F100:(TIM13_CH1 on PA6). Others:(TIM13_CH1 on PC8).
  524. * @retval None
  525. */
  526. #define __HAL_AFIO_REMAP_TIM13_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM13_REMAP)
  527. #endif
  528. #if defined(AFIO_MAPR2_TIM14_REMAP)
  529. /**
  530. * @brief Enable the remapping of TIM14_CH1.
  531. * @note ENABLE: Remap STM32F100:(TIM14_CH1 on PB1). Others:(TIM14_CH1 on PF9).
  532. * @retval None
  533. */
  534. #define __HAL_AFIO_REMAP_TIM14_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM14_REMAP)
  535. /**
  536. * @brief Disable the remapping of TIM14_CH1.
  537. * @note DISABLE: No remap STM32F100:(TIM14_CH1 on PC9). Others:(TIM14_CH1 on PA7).
  538. * @retval None
  539. */
  540. #define __HAL_AFIO_REMAP_TIM14_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM14_REMAP)
  541. #endif
  542. #if defined(AFIO_MAPR2_FSMC_NADV_REMAP)
  543. /**
  544. * @brief Controls the use of the optional FSMC_NADV signal.
  545. * @note DISCONNECTED: The NADV signal is not connected. The I/O pin can be used by another peripheral.
  546. * @retval None
  547. */
  548. #define __HAL_AFIO_FSMCNADV_DISCONNECTED() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_FSMC_NADV_REMAP)
  549. /**
  550. * @brief Controls the use of the optional FSMC_NADV signal.
  551. * @note CONNECTED: The NADV signal is connected to the output (default).
  552. * @retval None
  553. */
  554. #define __HAL_AFIO_FSMCNADV_CONNECTED() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_FSMC_NADV_REMAP)
  555. #endif
  556. #if defined(AFIO_MAPR2_TIM15_REMAP)
  557. /**
  558. * @brief Enable the remapping of TIM15_CH1 and TIM15_CH2.
  559. * @note ENABLE: Remap (TIM15_CH1 on PB14 and TIM15_CH2 on PB15).
  560. * @retval None
  561. */
  562. #define __HAL_AFIO_REMAP_TIM15_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM15_REMAP)
  563. /**
  564. * @brief Disable the remapping of TIM15_CH1 and TIM15_CH2.
  565. * @note DISABLE: No remap (TIM15_CH1 on PA2 and TIM15_CH2 on PA3).
  566. * @retval None
  567. */
  568. #define __HAL_AFIO_REMAP_TIM15_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM15_REMAP)
  569. #endif
  570. #if defined(AFIO_MAPR2_TIM16_REMAP)
  571. /**
  572. * @brief Enable the remapping of TIM16_CH1.
  573. * @note ENABLE: Remap (TIM16_CH1 on PA6).
  574. * @retval None
  575. */
  576. #define __HAL_AFIO_REMAP_TIM16_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM16_REMAP)
  577. /**
  578. * @brief Disable the remapping of TIM16_CH1.
  579. * @note DISABLE: No remap (TIM16_CH1 on PB8).
  580. * @retval None
  581. */
  582. #define __HAL_AFIO_REMAP_TIM16_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM16_REMAP)
  583. #endif
  584. #if defined(AFIO_MAPR2_TIM17_REMAP)
  585. /**
  586. * @brief Enable the remapping of TIM17_CH1.
  587. * @note ENABLE: Remap (TIM17_CH1 on PA7).
  588. * @retval None
  589. */
  590. #define __HAL_AFIO_REMAP_TIM17_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM17_REMAP)
  591. /**
  592. * @brief Disable the remapping of TIM17_CH1.
  593. * @note DISABLE: No remap (TIM17_CH1 on PB9).
  594. * @retval None
  595. */
  596. #define __HAL_AFIO_REMAP_TIM17_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM17_REMAP)
  597. #endif
  598. #if defined(AFIO_MAPR2_CEC_REMAP)
  599. /**
  600. * @brief Enable the remapping of CEC.
  601. * @note ENABLE: Remap (CEC on PB10).
  602. * @retval None
  603. */
  604. #define __HAL_AFIO_REMAP_CEC_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_CEC_REMAP)
  605. /**
  606. * @brief Disable the remapping of CEC.
  607. * @note DISABLE: No remap (CEC on PB8).
  608. * @retval None
  609. */
  610. #define __HAL_AFIO_REMAP_CEC_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_CEC_REMAP)
  611. #endif
  612. #if defined(AFIO_MAPR2_TIM1_DMA_REMAP)
  613. /**
  614. * @brief Controls the mapping of the TIM1_CH1 TIM1_CH2 DMA requests onto the DMA1 channels.
  615. * @note ENABLE: Remap (TIM1_CH1 DMA request/DMA1 Channel6, TIM1_CH2 DMA request/DMA1 Channel6)
  616. * @retval None
  617. */
  618. #define __HAL_AFIO_REMAP_TIM1DMA_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM1_DMA_REMAP)
  619. /**
  620. * @brief Controls the mapping of the TIM1_CH1 TIM1_CH2 DMA requests onto the DMA1 channels.
  621. * @note DISABLE: No remap (TIM1_CH1 DMA request/DMA1 Channel2, TIM1_CH2 DMA request/DMA1 Channel3).
  622. * @retval None
  623. */
  624. #define __HAL_AFIO_REMAP_TIM1DMA_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM1_DMA_REMAP)
  625. #endif
  626. #if defined(AFIO_MAPR2_TIM67_DAC_DMA_REMAP)
  627. /**
  628. * @brief Controls the mapping of the TIM6_DAC1 and TIM7_DAC2 DMA requests onto the DMA1 channels.
  629. * @note ENABLE: Remap (TIM6_DAC1 DMA request/DMA1 Channel3, TIM7_DAC2 DMA request/DMA1 Channel4)
  630. * @retval None
  631. */
  632. #define __HAL_AFIO_REMAP_TIM67DACDMA_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM67_DAC_DMA_REMAP)
  633. /**
  634. * @brief Controls the mapping of the TIM6_DAC1 and TIM7_DAC2 DMA requests onto the DMA1 channels.
  635. * @note DISABLE: No remap (TIM6_DAC1 DMA request/DMA2 Channel3, TIM7_DAC2 DMA request/DMA2 Channel4)
  636. * @retval None
  637. */
  638. #define __HAL_AFIO_REMAP_TIM67DACDMA_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM67_DAC_DMA_REMAP)
  639. #endif
  640. #if defined(AFIO_MAPR2_TIM12_REMAP)
  641. /**
  642. * @brief Enable the remapping of TIM12_CH1 and TIM12_CH2.
  643. * @note ENABLE: Remap (TIM12_CH1 on PB12 and TIM12_CH2 on PB13).
  644. * @note This bit is available only in high density value line devices.
  645. * @retval None
  646. */
  647. #define __HAL_AFIO_REMAP_TIM12_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM12_REMAP)
  648. /**
  649. * @brief Disable the remapping of TIM12_CH1 and TIM12_CH2.
  650. * @note DISABLE: No remap (TIM12_CH1 on PC4 and TIM12_CH2 on PC5).
  651. * @note This bit is available only in high density value line devices.
  652. * @retval None
  653. */
  654. #define __HAL_AFIO_REMAP_TIM12_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_TIM12_REMAP)
  655. #endif
  656. #if defined(AFIO_MAPR2_MISC_REMAP)
  657. /**
  658. * @brief Miscellaneous features remapping.
  659. * This bit is set and cleared by software. It controls miscellaneous features.
  660. * The DMA2 channel 5 interrupt position in the vector table.
  661. * The timer selection for DAC trigger 3 (TSEL[2:0] = 011, for more details refer to the DAC_CR register).
  662. * @note ENABLE: DMA2 channel 5 interrupt is mapped separately at position 60 and TIM15 TRGO event is
  663. * selected as DAC Trigger 3, TIM15 triggers TIM1/3.
  664. * @note This bit is available only in high density value line devices.
  665. * @retval None
  666. */
  667. #define __HAL_AFIO_REMAP_MISC_ENABLE() SET_BIT(AFIO->MAPR2, AFIO_MAPR2_MISC_REMAP)
  668. /**
  669. * @brief Miscellaneous features remapping.
  670. * This bit is set and cleared by software. It controls miscellaneous features.
  671. * The DMA2 channel 5 interrupt position in the vector table.
  672. * The timer selection for DAC trigger 3 (TSEL[2:0] = 011, for more details refer to the DAC_CR register).
  673. * @note DISABLE: DMA2 channel 5 interrupt is mapped with DMA2 channel 4 at position 59, TIM5 TRGO
  674. * event is selected as DAC Trigger 3, TIM5 triggers TIM1/3.
  675. * @note This bit is available only in high density value line devices.
  676. * @retval None
  677. */
  678. #define __HAL_AFIO_REMAP_MISC_DISABLE() CLEAR_BIT(AFIO->MAPR2, AFIO_MAPR2_MISC_REMAP)
  679. #endif
  680. /**
  681. * @}
  682. */
  683. /**
  684. * @}
  685. */
  686. /** @defgroup GPIOEx_Private_Macros GPIOEx Private Macros
  687. * @{
  688. */
  689. #if defined(STM32F101x6) || defined(STM32F102x6) || defined(STM32F102xB) || defined(STM32F103x6)
  690. #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0uL :\
  691. ((__GPIOx__) == (GPIOB))? 1uL :\
  692. ((__GPIOx__) == (GPIOC))? 2uL :3uL)
  693. #elif defined(STM32F100xB) || defined(STM32F101xB) || defined(STM32F103xB) || defined(STM32F105xC) || defined(STM32F107xC)
  694. #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0uL :\
  695. ((__GPIOx__) == (GPIOB))? 1uL :\
  696. ((__GPIOx__) == (GPIOC))? 2uL :\
  697. ((__GPIOx__) == (GPIOD))? 3uL :4uL)
  698. #elif defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE) || defined(STM32F103xG)
  699. #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0uL :\
  700. ((__GPIOx__) == (GPIOB))? 1uL :\
  701. ((__GPIOx__) == (GPIOC))? 2uL :\
  702. ((__GPIOx__) == (GPIOD))? 3uL :\
  703. ((__GPIOx__) == (GPIOE))? 4uL :\
  704. ((__GPIOx__) == (GPIOF))? 5uL :6uL)
  705. #endif
  706. #define AFIO_REMAP_ENABLE(REMAP_PIN) do{ uint32_t tmpreg = AFIO->MAPR; \
  707. tmpreg |= AFIO_MAPR_SWJ_CFG; \
  708. tmpreg |= REMAP_PIN; \
  709. AFIO->MAPR = tmpreg; \
  710. }while(0u)
  711. #define AFIO_REMAP_DISABLE(REMAP_PIN) do{ uint32_t tmpreg = AFIO->MAPR; \
  712. tmpreg |= AFIO_MAPR_SWJ_CFG; \
  713. tmpreg &= ~REMAP_PIN; \
  714. AFIO->MAPR = tmpreg; \
  715. }while(0u)
  716. #define AFIO_REMAP_PARTIAL(REMAP_PIN, REMAP_PIN_MASK) do{ uint32_t tmpreg = AFIO->MAPR; \
  717. tmpreg &= ~REMAP_PIN_MASK; \
  718. tmpreg |= AFIO_MAPR_SWJ_CFG; \
  719. tmpreg |= REMAP_PIN; \
  720. AFIO->MAPR = tmpreg; \
  721. }while(0u)
  722. #define AFIO_DBGAFR_CONFIG(DBGAFR_SWJCFG) do{ uint32_t tmpreg = AFIO->MAPR; \
  723. tmpreg &= ~AFIO_MAPR_SWJ_CFG_Msk; \
  724. tmpreg |= DBGAFR_SWJCFG; \
  725. AFIO->MAPR = tmpreg; \
  726. }while(0u)
  727. /**
  728. * @}
  729. */
  730. /* Exported macro ------------------------------------------------------------*/
  731. /* Exported functions --------------------------------------------------------*/
  732. /** @addtogroup GPIOEx_Exported_Functions
  733. * @{
  734. */
  735. /** @addtogroup GPIOEx_Exported_Functions_Group1
  736. * @{
  737. */
  738. void HAL_GPIOEx_ConfigEventout(uint32_t GPIO_PortSource, uint32_t GPIO_PinSource);
  739. void HAL_GPIOEx_EnableEventout(void);
  740. void HAL_GPIOEx_DisableEventout(void);
  741. /**
  742. * @}
  743. */
  744. /**
  745. * @}
  746. */
  747. /**
  748. * @}
  749. */
  750. /**
  751. * @}
  752. */
  753. #ifdef __cplusplus
  754. }
  755. #endif
  756. #endif /* STM32F1xx_HAL_GPIO_EX_H */
  757. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/