stm32f1xx_hal_gpio_ex.h 34 KB

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