stm32f1xx_hal_gpio_ex.h 36 KB

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