stm32f1xx_hal_gpio_ex.h 34 KB

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