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

2507 lines
121 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32l0xx_hal_gpio_ex.h
  4. * @author MCD Application Team
  5. * @brief Header file of GPIO HAL Extension module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright(c) 2016 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. */
  19. /* Define to prevent recursive inclusion -------------------------------------*/
  20. #ifndef __STM32L0xx_HAL_GPIO_EX_H
  21. #define __STM32L0xx_HAL_GPIO_EX_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32l0xx_hal_def.h"
  27. /** @addtogroup STM32L0xx_HAL_Driver
  28. * @{
  29. */
  30. /** @defgroup GPIOEx GPIOEx
  31. * @{
  32. */
  33. /* Exported types ------------------------------------------------------------*/
  34. /* Exported constants --------------------------------------------------------*/
  35. /** @defgroup GPIOEx_Exported_Constants GPIOEx Exported Constants
  36. * @{
  37. */
  38. /*----------------------------------------------------------------------------*/
  39. /*------------------------- STM32L083xx/STM32L073xx---------------------------*/
  40. /*----------------------------------------------------------------------------*/
  41. #if defined (STM32L083xx) || defined (STM32L073xx)
  42. /* The table below gives an overview of the different alternate functions per port.
  43. * For more details refer yourself to the product data sheet.
  44. *
  45. */
  46. /* | AF0 | AF1 | AF2 | AF3 | AF4 | AF5 | AF6 | AF7 |
  47. *______________________________________________________________________________
  48. * PA0 | | |TIM2_C1 |TSC |USART2 |TIM2_TR |USART4 |COMP1 |
  49. * PA1 |EVENTOUT|LCD |TIM2_C2 |TSC |USART2 |TIM21_TR|USART4 | |
  50. * PA2 |TIM21_C1|LCD |TIM2_C3 |TSC |USART2 | |LPUART1 |COMP2 |
  51. * PA3 |TIM21_C2|LCD |TIM2_C4 |TSC |USART2 | |LPUART1 | |
  52. * PA4 |SPI1 | | |TSC |USART2 |TIM22_TR| | |
  53. * PA5 |SPI1 | |TIM2_TR |TSC | |TIM2_C1 | | |
  54. * PA6 |SPI1 |LCD |TIM3_C1 |TSC |LPUART1 |TIM22_C1|EVENTOUT|COMP1 |
  55. * PA7 |SPI1 |LCD |TIM3_C2 |TSC | |TIM22_C2|EVENTOUT|COMP2 |
  56. * PA8 |MCO |LCD |USB |EVENTOUT|USART1 | | |I2C3 |
  57. * PA9 |MCO |LCD | |TSC |USART1 | |I2C1 |I2C3 |
  58. * PA10| |LCD | |TSC |USART1 | |I2C1 | |
  59. * PA11|SPI1 | |EVENTOUT|TSC |USART1 | |I2C2 |COMP1 |
  60. * PA12|SPI1 | |EVENTOUT|TSC |USART1 | |I2C2 |COMP2 |
  61. * PA13|SWDIO | |USB | | | |LPUART1 | |
  62. * PA14|SWCLK | | | |USART2 | |LPUART1 | |
  63. * PA15|SPI1 |LCD |TIM2_TR |EVENTOUT|USART2 |TIM2_C1 |USART4 | |
  64. *______________________________________________________________________________
  65. * PB0 |EVENTOUT|LCD |TIM3_C3 |TSC | | | | |
  66. * PB1 | |LCD |TIM3_C4 |TSC |LPUART1 | | | |
  67. * PB2 | | |LPTIM1_O|TSC | | | |I2C3 |
  68. * PB3 |SPI1 |LCD |TIM2_C2 |TSC |EVENTOUT|USART1 |USART5 | |
  69. * PB4 |SPI1 |LCD |TIM3_C1 |TSC |TIM22_C1|USART1 |USART5 |I2C3 |
  70. * PB5 |SPI1 |LCD |LPTIM1_I|I2C1 |TIM3_C2 |USART1 |USART5 | |
  71. * | | | | |TIM22_C2| | | |
  72. * PB6 |USART1 |I2C1 |LPTIM1_T|TSC | | | | |
  73. * PB7 |USART1 |I2C1 |LPTIM1_I|TSC | | |USART4 | |
  74. * PB8 | |LCD | |TSC |I2C1 | | | |
  75. * PB9 | |LCD |EVENTOUT| |I2C1 |SPI2 | | |
  76. * PB10| |LCD |TIM2_C3 |TSC |LPUART1 |SPI2 |I2C2 |LPUART1 |
  77. * PB11|EVENTOUT|LCD |TIM2_C4 |TSC |LPUART1 | |I2C2 |LPUART1 |
  78. * PB12|SPI2 |LCD |LPUART1 |TSC | |I2C2 |EVENTOUT| |
  79. * PB13|SPI2 |LCD |MCO |TSC |LPUART1 |I2C2 |TIM21_C1| |
  80. * PB14|SPI2 |LCD |RTC |TSC |LPUART1 |I2C2 |TIM21_C2| |
  81. * PB15|SPI2 |LCD |RTC | | | | | |
  82. *______________________________________________________________________________
  83. * PC0 |LPTIM1_I|LCD |EVENTOUT|TSC | | |LPUART1 |I2C3 |
  84. * PC1 |LPTIM1_O|LCD |EVENTOUT|TSC | | |LPUART1 |I2C3 |
  85. * PC2 |LPTIM1_I|LCD |SPI2 |TSC | | | | |
  86. * PC3 |LPTIM1_T|LCD |SPI2 |TSC | | | | |
  87. * PC4 |EVENTOUT|LCD |LPUART1 | | | | | |
  88. * PC5 | |LCD |LPUART1 |TSC | | | | |
  89. * PC6 |TIM22_C1|LCD |TIM3_C1 |TSC | | | | |
  90. * PC7 |TIM22_C2|LCD |TIM3_C2 |TSC | | | | |
  91. * PC8 |TIM22_TR|LCD |TIM3_C3 |TSC | | | | |
  92. * PC9 |TIM21_TR|LCD |USB |TSC | | | |I2C3 |
  93. * | | |TIM3_C4 | | | | | |
  94. * PC10|LPUART1 |LCD | | | | |USART4 | |
  95. * PC11|LPUART1 |LCD | | | | |USART4 | |
  96. * PC12| |LCD |USART5 | | | |USART4 | |
  97. * PC13| | | | | | | | |
  98. * PC14| | | | | | | | |
  99. * PC15| | | | | | | | |
  100. *______________________________________________________________________________
  101. * PD0 |TIM21_C1|SPI2 | | | | | | |
  102. * PD1 | |SPI2 | | | | | | |
  103. * PD2 |LPUART1 |LCD |TIM3_TR | | | |USART5 | |
  104. * PD3 |USART2 |LCD |SPI2 | | | | | |
  105. * PD4 |USART2 |SPI2 | | | | | | |
  106. * PD5 |USART2 | | | | | | | |
  107. * PD6 |USART2 | | | | | | | |
  108. * PD7 |USART2 |TIM21_C2| | | | | | |
  109. * PD8 |LPUART1 |LCD | | | | | | |
  110. * PD9 |LPUART1 |LCD | | | | | | |
  111. * PD10| |LCD | | | | | | |
  112. * PD11|LPUART1 |LCD | | | | | | |
  113. * PD12|LPUART1 |LCD | | | | | | |
  114. * PD13| |LCD | | | | | | |
  115. * PD14| |LCD | | | | | | |
  116. * PD15|USB |LCD | | | | | | |
  117. *______________________________________________________________________________
  118. * PE0 | |LCD |EVENTOUT| | | | | |
  119. * PE1 | |LCD |EVENTOUT| | | | | |
  120. * PE2 | |LCD |TIM3_TR | | | | | |
  121. * PE3 |TIM22_C1|LCD |TIM3_C1 | | | | | |
  122. * PE4 |TIM22_C2| |TIM3_C2 | | | | | |
  123. * PE5 |TIM21_C1| |TIM3_C3 | | | | | |
  124. * PE6 |TIM21_C2| |TIM3_C4 | | | | | |
  125. * PE7 | |LCD | | | | |USART5 | |
  126. * PE8 | |LCD | | | | |USART4 | |
  127. * PE9 |TIM2_C1 |LCD |TIM2_TR | | | |USART4 | |
  128. * PE10|TIM2_C2 |LCD | | | | |USART5 | |
  129. * PE11|TIM2_C3 | | | | | |USART5 | |
  130. * PE12|TIM2_C4 | |SPI1 | | | | | |
  131. * PE13| |LCD |SPI1 | | | | | |
  132. * PE14| |LCD |SPI1 | | | | | |
  133. * PE15| |LCD |SPI1 | | | | | |
  134. *______________________________________________________________________________
  135. * PH0 |USB | | | | | | | |
  136. * PH1 | | | | | | | | |
  137. * PH9 | | | | | | | | |
  138. * PH10| | | | | | | | |
  139. *
  140. */
  141. /** @defgroup GPIOEx_Alternate_function_selection Alternate function selection
  142. * @{
  143. */
  144. /*
  145. * Alternate function AF0
  146. */
  147. #define GPIO_AF0_EVENTOUT ((uint8_t)0x00U) /* EVENTOUT Alternate Function mapping */
  148. #define GPIO_AF0_TIM21 ((uint8_t)0x00U) /* TIM21 Alternate Function mapping */
  149. #define GPIO_AF0_SPI1 ((uint8_t)0x00U) /* SPI1 Alternate Function mapping */
  150. #define GPIO_AF0_MCO ((uint8_t)0x00U) /* MCO Alternate Function mapping */
  151. #define GPIO_AF0_SWDIO ((uint8_t)0x00U) /* SWDIO Alternate Function mapping */
  152. #define GPIO_AF0_SWCLK ((uint8_t)0x00U) /* SWCLK Alternate Function mapping */
  153. #define GPIO_AF0_USART1 ((uint8_t)0x00U) /* USART1 Alternate Function mapping */
  154. #define GPIO_AF0_SPI2 ((uint8_t)0x00U) /* SPI2 Alternate Function mapping */
  155. #define GPIO_AF0_LPTIM1 ((uint8_t)0x00U) /* LPTIM1 Alternate Function mapping */
  156. #define GPIO_AF0_TIM22 ((uint8_t)0x00U) /* TIM22 Alternate Function mapping */
  157. #define GPIO_AF0_LPUART1 ((uint8_t)0x00U) /* LPUART1 Alternate Function mapping */
  158. #define GPIO_AF0_USART2 ((uint8_t)0x00U) /* USART2 Alternate Function mapping */
  159. #define GPIO_AF0_TIM2 ((uint8_t)0x00U) /* TIM2 Alternate Function mapping */
  160. #define GPIO_AF0_USB ((uint8_t)0x00U) /* USB Alternate Function mapping */
  161. /**
  162. *
  163. */
  164. /*
  165. * Alternate function AF1
  166. */
  167. #define GPIO_AF1_I2C1 ((uint8_t)0x01U) /* I2C1 Alternate Function mapping */
  168. #define GPIO_AF1_SPI2 ((uint8_t)0x01U) /* SPI2 Alternate Function mapping */
  169. #define GPIO_AF1_TIM21 ((uint8_t)0x01U) /* TIM21 Alternate Function mapping */
  170. #define GPIO_AF1_LCD ((uint8_t)0x01U) /* LCD Alternate Function mapping */
  171. /**
  172. *
  173. */
  174. /*
  175. * Alternate function AF2
  176. */
  177. #define GPIO_AF2_TIM2 ((uint8_t)0x02U) /* TIM2 Alternate Function mapping */
  178. #define GPIO_AF2_TIM3 ((uint8_t)0x02U) /* TIM3 Alternate Function mapping */
  179. #define GPIO_AF2_EVENTOUT ((uint8_t)0x02U) /* EVENTOUT Alternate Function mapping */
  180. #define GPIO_AF2_LPTIM1 ((uint8_t)0x02U) /* LPTIM1 Alternate Function mapping */
  181. #define GPIO_AF2_LPUART1 ((uint8_t)0x02U) /* LPUART1 Alternate Function mapping */
  182. #define GPIO_AF2_MCO ((uint8_t)0x02U) /* MCO Alternate Function mapping */
  183. #define GPIO_AF2_RTC ((uint8_t)0x02U) /* RTC Alternate Function mapping */
  184. #define GPIO_AF2_SPI2 ((uint8_t)0x02U) /* SPI2 Alternate Function mapping */
  185. #define GPIO_AF2_USART5 ((uint8_t)0x02U) /* USART5 Alternate Function mapping */
  186. #define GPIO_AF2_SPI1 ((uint8_t)0x02U) /* SPI1 Alternate Function mapping */
  187. #define GPIO_AF2_USB ((uint8_t)0x00U) /* USB Alternate Function mapping */
  188. /**
  189. *
  190. */
  191. /*
  192. * Alternate function AF3
  193. */
  194. #define GPIO_AF3_EVENTOUT ((uint8_t)0x03U) /* EVENTOUT Alternate Function mapping */
  195. #define GPIO_AF3_I2C1 ((uint8_t)0x03U) /* I2C1 Alternate Function mapping */
  196. #define GPIO_AF3_TSC ((uint8_t)0x03U) /* TSC Alternate Function mapping */
  197. /**
  198. *
  199. */
  200. /*
  201. * Alternate function AF4
  202. */
  203. #define GPIO_AF4_USART2 ((uint8_t)0x04U) /* USART2 Alternate Function mapping */
  204. #define GPIO_AF4_LPUART1 ((uint8_t)0x04U) /* LPUART1 Alternate Function mapping */
  205. #define GPIO_AF4_USART1 ((uint8_t)0x04U) /* USART1 Alternate Function mapping */
  206. #define GPIO_AF4_EVENTOUT ((uint8_t)0x04U) /* EVENTOUT Alternate Function mapping*/
  207. #define GPIO_AF4_TIM22 ((uint8_t)0x04U) /* TIM22 Alternate Function mapping */
  208. #define GPIO_AF4_TIM3 ((uint8_t)0x04U) /* TIM3 Alternate Function mapping */
  209. #define GPIO_AF4_I2C1 ((uint8_t)0x04U) /* I2C1 Alternate Function mapping */
  210. /**
  211. *
  212. */
  213. /*
  214. * Alternate function AF5
  215. */
  216. #define GPIO_AF5_TIM2 ((uint8_t)0x05U) /* TIM2 Alternate Function mapping */
  217. #define GPIO_AF5_TIM21 ((uint8_t)0x05U) /* TIM21 Alternate Function mapping */
  218. #define GPIO_AF5_TIM22 ((uint8_t)0x05U) /* TIM22 Alternate Function mapping */
  219. #define GPIO_AF5_USART1 ((uint8_t)0x05U) /* USART1 Alternate Function mapping */
  220. #define GPIO_AF5_SPI2 ((uint8_t)0x05U) /* SPI2 Alternate Function mapping */
  221. #define GPIO_AF5_I2C2 ((uint8_t)0x05U) /* I2C2 Alternate Function mapping */
  222. /**
  223. *
  224. */
  225. /*
  226. * Alternate function AF6
  227. */
  228. #define GPIO_AF6_USART4 ((uint8_t)0x06U) /* USART4 Alternate Function mapping */
  229. #define GPIO_AF6_LPUART1 ((uint8_t)0x06U) /* LPUART1 Alternate Function mapping */
  230. #define GPIO_AF6_EVENTOUT ((uint8_t)0x06U) /* EVENTOUT Alternate Function mapping */
  231. #define GPIO_AF6_I2C1 ((uint8_t)0x06U) /* I2C1 Alternate Function mapping */
  232. #define GPIO_AF6_I2C2 ((uint8_t)0x06U) /* I2C2 Alternate Function mapping */
  233. #define GPIO_AF6_USART5 ((uint8_t)0x06U) /* USART5 Alternate Function mapping */
  234. #define GPIO_AF6_TIM21 ((uint8_t)0x06U) /* TIM21 Alternate Function mapping */
  235. /**
  236. *
  237. */
  238. /*
  239. * Alternate function AF7
  240. */
  241. #define GPIO_AF7_COMP1 ((uint8_t)0x07U) /* COMP1 Alternate Function mapping */
  242. #define GPIO_AF7_COMP2 ((uint8_t)0x07U) /* COMP2 Alternate Function mapping */
  243. #define GPIO_AF7_I2C3 ((uint8_t)0x07U) /* I2C3 Alternate Function mapping */
  244. #define GPIO_AF7_LPUART1 ((uint8_t)0x07U) /* LPUART1 Alternate Function mapping */
  245. /**
  246. *
  247. */
  248. /**
  249. * @}
  250. */
  251. /**
  252. * @}
  253. */
  254. /** @defgroup GPIOEx_Private GPIOEx Private
  255. * @{
  256. */
  257. /**
  258. * IS_GPIO_AF macro definition
  259. */
  260. #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x07)
  261. /**
  262. * @}
  263. */
  264. #endif /* (STM32L083xx) || (STM32L073xx) */
  265. /*----------------------------------------------------------------------------*/
  266. /*------------------------- STM32L082xx and STM32L072xx-----------------------*/
  267. /*----------------------------------------------------------------------------*/
  268. #if defined (STM32L082xx) || defined (STM32L072xx)
  269. /* The table below gives an overview of the different alternate functions per port.
  270. * For more details refer yourself to the product data sheet.
  271. */
  272. /* | AF0 | AF1 | AF2 | AF3 | AF4 | AF5 | AF6 | AF7 |
  273. *______________________________________________________________________________
  274. * PA0 | | |TIM2_C1 |TSC |USART2 |TIM2_TR |USART4 |COMP1 |
  275. * PA1 |EVENTOUT| |TIM2_C2 |TSC |USART2 |TIM21_TR|USART4 | |
  276. * PA2 |TIM21_C1| |TIM2_C3 |TSC |USART2 | |LPUART1 |COMP2 |
  277. * PA3 |TIM21_C2| |TIM2_C4 |TSC |USART2 | |LPUART1 | |
  278. * PA4 |SPI1 | | |TSC |USART2 |TIM22_TR| | |
  279. * PA5 |SPI1 | |TIM2_TR |TSC | |TIM2_C1 | | |
  280. * PA6 |SPI1 | |TIM3_C1 |TSC |LPUART1 |TIM22_C1|EVENTOUT|COMP1 |
  281. * PA7 |SPI1 | |TIM3_C2 |TSC | |TIM22_C2|EVENTOUT|COMP2 |
  282. * PA8 |MCO | |USB |EVENTOUT|USART1 | | |I2C3 |
  283. * PA9 |MCO | | |TSC |USART1 | |I2C1 |I2C3 |
  284. * PA10| | | |TSC |USART1 | |I2C1 | |
  285. * PA11|SPI1 | |EVENTOUT|TSC |USART1 | |I2C2 |COMP1 |
  286. * PA12|SPI1 | |EVENTOUT|TSC |USART1 | |I2C2 |COMP2 |
  287. * PA13|SWDIO | |USB | | | |LPUART1 | |
  288. * PA14|SWCLK | | | |USART2 | |LPUART1 | |
  289. * PA15|SPI1 | |TIM2_TR |EVENTOUT|USART2 |TIM2_C1 |USART4 | |
  290. *______________________________________________________________________________
  291. * PB0 |EVENTOUT| |TIM3_C3 |TSC | | | | |
  292. * PB1 | | |TIM3_C4 |TSC |LPUART1 | | | |
  293. * PB2 | | |LPTIM1_O|TSC | | | |I2C3 |
  294. * PB3 |SPI1 | |TIM2_C2 |TSC |EVENTOUT|USART1 |USART5 | |
  295. * PB4 |SPI1 | |TIM3_C1 |TSC |TIM22_C1|USART1 |USART5 |I2C3 |
  296. * PB5 |SPI1 | |LPTIM1_I|I2C1 |TIM3_C2 |USART1 |USART5 | |
  297. * | | | | |TIM22_C2| | | |
  298. * PB6 |USART1 |I2C1 |LPTIM1_T|TSC | | | | |
  299. * PB7 |USART1 |I2C1 |LPTIM1_I|TSC | | |USART4 | |
  300. * PB8 | | | |TSC |I2C1 | | | |
  301. * PB9 | | |EVENTOUT| |I2C1 |SPI2 | | |
  302. * PB10| | |TIM2_C3 |TSC |LPUART1 |SPI2 |I2C2 |LPUART1 |
  303. * PB11|EVENTOUT| |TIM2_C4 |TSC |LPUART1 | |I2C2 |LPUART1 |
  304. * PB12|SPI2 | |LPUART1 |TSC | |I2C2 |EVENTOUT| |
  305. * PB13|SPI2 | |MCO |TSC |LPUART1 |I2C2 |TIM21_C1| |
  306. * PB14|SPI2 | |RTC |TSC |LPUART1 |I2C2 |TIM21_C2| |
  307. * PB15|SPI2 | |RTC | | | | | |
  308. *______________________________________________________________________________
  309. * PC0 |LPTIM1_I| |EVENTOUT|TSC | | |LPUART1 |I2C3 |
  310. * PC1 |LPTIM1_O| |EVENTOUT|TSC | | |LPUART1 |I2C3 |
  311. * PC2 |LPTIM1_I| |SPI2 |TSC | | | | |
  312. * PC3 |LPTIM1_T| |SPI2 |TSC | | | | |
  313. * PC4 |EVENTOUT| |LPUART1 | | | | | |
  314. * PC5 | | |LPUART1 |TSC | | | | |
  315. * PC6 |TIM22_C1| |TIM3_C1 |TSC | | | | |
  316. * PC7 |TIM22_C2| |TIM3_C2 |TSC | | | | |
  317. * PC8 |TIM22_TR| |TIM3_C3 |TSC | | | | |
  318. * PC9 |TIM21_TR| |USB |TSC | | | |I2C3 |
  319. * | | |TIM3_C4 | | | | | |
  320. * PC10|LPUART1 | | | | | |USART4 | |
  321. * PC11|LPUART1 | | | | | |USART4 | |
  322. * PC12| | |USART5 | | | |USART4 | |
  323. * PC13| | | | | | | | |
  324. * PC14| | | | | | | | |
  325. * PC15| | | | | | | | |
  326. *______________________________________________________________________________
  327. * PD0 |TIM21_C1|SPI2 | | | | | | |
  328. * PD1 | |SPI2 | | | | | | |
  329. * PD2 |LPUART1 | |TIM3_TR | | | |USART5 | |
  330. * PD3 |USART2 | |SPI2 | | | | | |
  331. * PD4 |USART2 |SPI2 | | | | | | |
  332. * PD5 |USART2 | | | | | | | |
  333. * PD6 |USART2 | | | | | | | |
  334. * PD7 |USART2 |TIM21_C2| | | | | | |
  335. * PD8 |LPUART1 | | | | | | | |
  336. * PD9 |LPUART1 | | | | | | | |
  337. * PD10| | | | | | | | |
  338. * PD11|LPUART1 | | | | | | | |
  339. * PD12|LPUART1 | | | | | | | |
  340. * PD13| | | | | | | | |
  341. * PD14| | | | | | | | |
  342. * PD15|USB | | | | | | | |
  343. *______________________________________________________________________________
  344. * PE0 | | |EVENTOUT| | | | | |
  345. * PE1 | | |EVENTOUT| | | | | |
  346. * PE2 | | |TIM3_TR | | | | | |
  347. * PE3 |TIM22_C1| |TIM3_C1 | | | | | |
  348. * PE4 |TIM22_C2| |TIM3_C2 | | | | | |
  349. * PE5 |TIM21_C1| |TIM3_C3 | | | | | |
  350. * PE6 |TIM21_C2| |TIM3_C4 | | | | | |
  351. * PE7 | | | | | | |USART5 | |
  352. * PE8 | | | | | | |USART4 | |
  353. * PE9 |TIM2_C1 | |TIM2_TR | | | |USART4 | |
  354. * PE10|TIM2_C2 | | | | | |USART5 | |
  355. * PE11|TIM2_C3 | | | | | |USART5 | |
  356. * PE12|TIM2_C4 | |SPI1 | | | | | |
  357. * PE13| | |SPI1 | | | | | |
  358. * PE14| | |SPI1 | | | | | |
  359. * PE15| | |SPI1 | | | | | |
  360. *______________________________________________________________________________
  361. * PH0 |USB | | | | | | | |
  362. * PH1 | | | | | | | | |
  363. * PH9 | | | | | | | | |
  364. * PH10| | | | | | | | |
  365. *
  366. */
  367. /** @defgroup GPIOEx_Alternate_function_selection Alternate function selection
  368. * @{
  369. */
  370. /*
  371. * Alternate function AF0
  372. */
  373. #define GPIO_AF0_EVENTOUT ((uint8_t)0x00U) /* EVENTOUT Alternate Function mapping */
  374. #define GPIO_AF0_TIM21 ((uint8_t)0x00U) /* TIM21 Alternate Function mapping */
  375. #define GPIO_AF0_SPI1 ((uint8_t)0x00U) /* SPI1 Alternate Function mapping */
  376. #define GPIO_AF0_MCO ((uint8_t)0x00U) /* MCO Alternate Function mapping */
  377. #define GPIO_AF0_SWDIO ((uint8_t)0x00U) /* SWDIO Alternate Function mapping */
  378. #define GPIO_AF0_SWCLK ((uint8_t)0x00U) /* SWCLK Alternate Function mapping */
  379. #define GPIO_AF0_USART1 ((uint8_t)0x00U) /* USART1 Alternate Function mapping */
  380. #define GPIO_AF0_SPI2 ((uint8_t)0x00U) /* SPI2 Alternate Function mapping */
  381. #define GPIO_AF0_LPTIM1 ((uint8_t)0x00U) /* LPTIM1 Alternate Function mapping */
  382. #define GPIO_AF0_TIM22 ((uint8_t)0x00U) /* TIM22 Alternate Function mapping */
  383. #define GPIO_AF0_LPUART1 ((uint8_t)0x00U) /* LPUART1 Alternate Function mapping */
  384. #define GPIO_AF0_USART2 ((uint8_t)0x00U) /* USART2 Alternate Function mapping */
  385. #define GPIO_AF0_TIM2 ((uint8_t)0x00U) /* TIM2 Alternate Function mapping */
  386. #define GPIO_AF0_USB ((uint8_t)0x00U) /* USB Alternate Function mapping */
  387. /**
  388. *
  389. */
  390. /*
  391. * Alternate function AF1
  392. */
  393. #define GPIO_AF1_I2C1 ((uint8_t)0x01U) /* I2C1 Alternate Function mapping */
  394. #define GPIO_AF1_SPI2 ((uint8_t)0x01U) /* SPI2 Alternate Function mapping */
  395. #define GPIO_AF1_TIM21 ((uint8_t)0x01U) /* TIM21 Alternate Function mapping */
  396. /**
  397. *
  398. */
  399. /*
  400. * Alternate function AF2
  401. */
  402. #define GPIO_AF2_TIM2 ((uint8_t)0x02U) /* TIM2 Alternate Function mapping */
  403. #define GPIO_AF2_TIM3 ((uint8_t)0x02U) /* TIM3 Alternate Function mapping */
  404. #define GPIO_AF2_EVENTOUT ((uint8_t)0x02U) /* EVENTOUT Alternate Function mapping */
  405. #define GPIO_AF2_LPTIM1 ((uint8_t)0x02U) /* LPTIM1 Alternate Function mapping */
  406. #define GPIO_AF2_LPUART1 ((uint8_t)0x02U) /* LPUART1 Alternate Function mapping */
  407. #define GPIO_AF2_MCO ((uint8_t)0x02U) /* MCO Alternate Function mapping */
  408. #define GPIO_AF2_RTC ((uint8_t)0x02U) /* RTC Alternate Function mapping */
  409. #define GPIO_AF2_SPI2 ((uint8_t)0x02U) /* SPI2 Alternate Function mapping */
  410. #define GPIO_AF2_USART5 ((uint8_t)0x02U) /* USART5 Alternate Function mapping */
  411. #define GPIO_AF2_SPI1 ((uint8_t)0x02U) /* SPI1 Alternate Function mapping */
  412. #define GPIO_AF2_USB ((uint8_t)0x00U) /* USB Alternate Function mapping */
  413. /**
  414. *
  415. */
  416. /*
  417. * Alternate function AF3
  418. */
  419. #define GPIO_AF3_EVENTOUT ((uint8_t)0x03U) /* EVENTOUT Alternate Function mapping */
  420. #define GPIO_AF3_I2C1 ((uint8_t)0x03U) /* I2C1 Alternate Function mapping */
  421. #define GPIO_AF3_TSC ((uint8_t)0x03U) /* TSC Alternate Function mapping */
  422. /**
  423. *
  424. */
  425. /*
  426. * Alternate function AF4
  427. */
  428. #define GPIO_AF4_USART2 ((uint8_t)0x04U) /* USART2 Alternate Function mapping */
  429. #define GPIO_AF4_LPUART1 ((uint8_t)0x04U) /* LPUART1 Alternate Function mapping */
  430. #define GPIO_AF4_USART1 ((uint8_t)0x04U) /* USART1 Alternate Function mapping */
  431. #define GPIO_AF4_EVENTOUT ((uint8_t)0x04U) /* EVENTOUT Alternate Function mapping */
  432. #define GPIO_AF4_TIM22 ((uint8_t)0x04U) /* TIM22 Alternate Function mapping */
  433. #define GPIO_AF4_TIM3 ((uint8_t)0x04U) /* TIM3 Alternate Function mapping */
  434. #define GPIO_AF4_I2C1 ((uint8_t)0x04U) /* I2C1 Alternate Function mapping */
  435. /**
  436. *
  437. */
  438. /*
  439. * Alternate function AF5
  440. */
  441. #define GPIO_AF5_TIM2 ((uint8_t)0x05U) /* TIM2 Alternate Function mapping */
  442. #define GPIO_AF5_TIM21 ((uint8_t)0x05U) /* TIM21 Alternate Function mapping */
  443. #define GPIO_AF5_TIM22 ((uint8_t)0x05U) /* TIM22 Alternate Function mapping */
  444. #define GPIO_AF5_USART1 ((uint8_t)0x05U) /* USART1 Alternate Function mapping */
  445. #define GPIO_AF5_SPI2 ((uint8_t)0x05U) /* SPI2 Alternate Function mapping */
  446. #define GPIO_AF5_I2C2 ((uint8_t)0x05U) /* I2C2 Alternate Function mapping */
  447. /**
  448. *
  449. */
  450. /*
  451. * Alternate function AF6
  452. */
  453. #define GPIO_AF6_USART4 ((uint8_t)0x06U) /* USART4 Alternate Function mapping */
  454. #define GPIO_AF6_LPUART1 ((uint8_t)0x06U) /* LPUART1 Alternate Function mapping */
  455. #define GPIO_AF6_EVENTOUT ((uint8_t)0x06U) /* EVENTOUT Alternate Function mapping */
  456. #define GPIO_AF6_I2C1 ((uint8_t)0x06U) /* I2C1 Alternate Function mapping */
  457. #define GPIO_AF6_I2C2 ((uint8_t)0x06U) /* I2C2 Alternate Function mapping */
  458. #define GPIO_AF6_USART5 ((uint8_t)0x06U) /* USART5 Alternate Function mapping */
  459. #define GPIO_AF6_TIM21 ((uint8_t)0x06U) /* TIM21 Alternate Function mapping */
  460. /**
  461. *
  462. */
  463. /*
  464. * Alternate function AF7
  465. */
  466. #define GPIO_AF7_COMP1 ((uint8_t)0x07U) /* COMP1 Alternate Function mapping */
  467. #define GPIO_AF7_COMP2 ((uint8_t)0x07U) /* COMP2 Alternate Function mapping */
  468. #define GPIO_AF7_I2C3 ((uint8_t)0x07U) /* I2C3 Alternate Function mapping */
  469. #define GPIO_AF7_LPUART1 ((uint8_t)0x07U) /* LPUART1 Alternate Function mapping */
  470. /**
  471. *
  472. */
  473. /**
  474. * @}
  475. */
  476. /**
  477. * @}
  478. */
  479. /** @defgroup GPIOEx_Private GPIOEx Private
  480. * @{
  481. */
  482. /**
  483. * @brief IS_GPIO_AF macro definition
  484. */
  485. #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x07)
  486. /**
  487. * @}
  488. */
  489. #endif /* (STM32L082xx) || (STM32L072xx) */
  490. /*----------------------------------------------------------------------------*/
  491. /*------------------------- STM32L081xx and STM32L071xx-----------------------*/
  492. /*----------------------------------------------------------------------------*/
  493. #if defined (STM32L081xx) || defined (STM32L071xx)
  494. /* The table below gives an overview of the different alternate functions per port.
  495. * For more details refer yourself to the product data sheet.
  496. *
  497. */
  498. /* | AF0 | AF1 | AF2 | AF3 | AF4 | AF5 | AF6 | AF7 |
  499. *______________________________________________________________________________
  500. * PA0 | | |TIM2_C1 | |USART2 |TIM2_TR |USART4 |COMP1 |
  501. * PA1 |EVENTOUT| |TIM2_C2 | |USART2 |TIM21_TR|USART4 | |
  502. * PA2 |TIM21_C1| |TIM2_C3 | |USART2 | |LPUART1 |COMP2 |
  503. * PA3 |TIM21_C2| |TIM2_C4 | |USART2 | |LPUART1 | |
  504. * PA4 |SPI1 | | | |USART2 |TIM22_TR| | |
  505. * PA5 |SPI1 | |TIM2_TR | | |TIM2_C1 | | |
  506. * PA6 |SPI1 | |TIM3_C1 | |LPUART1 |TIM22_C1|EVENTOUT|COMP1 |
  507. * PA7 |SPI1 | |TIM3_C2 | | |TIM22_C2|EVENTOUT|COMP2 |
  508. * PA8 |MCO | | |EVENTOUT|USART1 | | |I2C3 |
  509. * PA9 |MCO | | | |USART1 | |I2C1 |I2C3 |
  510. * PA10| | | | |USART1 | |I2C1 | |
  511. * PA11|SPI1 | |EVENTOUT| |USART1 | |I2C2 |COMP1 |
  512. * PA12|SPI1 | |EVENTOUT| |USART1 | |I2C2 |COMP2 |
  513. * PA13|SWDIO | | | | | |LPUART1 | |
  514. * PA14|SWCLK | | | |USART2 | |LPUART1 | |
  515. * PA15|SPI1 | |TIM2_TR |EVENTOUT|USART2 |TIM2_C1 |USART4 | |
  516. *______________________________________________________________________________
  517. * PB0 |EVENTOUT| |TIM3_C3 | | | | | |
  518. * PB1 | | |TIM3_C4 | |LPUART1 | | | |
  519. * PB2 | | |LPTIM1_O| | | | |I2C3 |
  520. * PB3 |SPI1 | |TIM2_C2 | |EVENTOUT|USART1 |USART5 | |
  521. * PB4 |SPI1 | |TIM3_C1 | |TIM22_C1|USART1 |USART5 |I2C3 |
  522. * PB5 |SPI1 | |LPTIM1_I|I2C1 |TIM3_C2 |USART1 |USART5 | |
  523. * | | | | |TIM22_C2| | | |
  524. * PB6 |USART1 |I2C1 |LPTIM1_T| | | | | |
  525. * PB7 |USART1 |I2C1 |LPTIM1_I| | | |USART4 | |
  526. * PB8 | | | | |I2C1 | | | |
  527. * PB9 | | |EVENTOUT| |I2C1 |SPI2 | | |
  528. * PB10| | |TIM2_C3 | |LPUART1 |SPI2 |I2C2 |LPUART1 |
  529. * PB11|EVENTOUT| |TIM2_C4 | |LPUART1 | |I2C2 |LPUART1 |
  530. * PB12|SPI2 | |LPUART1 | | |I2C2 |EVENTOUT| |
  531. * PB13|SPI2 | |MCO | |LPUART1 |I2C2 |TIM21_C1| |
  532. * PB14|SPI2 | |RTC | |LPUART1 |I2C2 |TIM21_C2| |
  533. * PB15|SPI2 | |RTC | | | | | |
  534. *______________________________________________________________________________
  535. * PC0 |LPTIM1_I| |EVENTOUT| | | |LPUART1 |I2C3 |
  536. * PC1 |LPTIM1_O| |EVENTOUT| | | |LPUART1 |I2C3 |
  537. * PC2 |LPTIM1_I| |SPI2 | | | | | |
  538. * PC3 |LPTIM1_T| |SPI2 | | | | | |
  539. * PC4 |EVENTOUT| |LPUART1 | | | | | |
  540. * PC5 | | |LPUART1 | | | | | |
  541. * PC6 |TIM22_C1| |TIM3_C1 | | | | | |
  542. * PC7 |TIM22_C2| |TIM3_C2 | | | | | |
  543. * PC8 |TIM22_TR| |TIM3_C3 | | | | | |
  544. * PC9 |TIM21_TR| | | | | | |I2C3 |
  545. * | | |TIM3_C4 | | | | | |
  546. * PC10|LPUART1 | | | | | |USART4 | |
  547. * PC11|LPUART1 | | | | | |USART4 | |
  548. * PC12| | |USART5 | | | |USART4 | |
  549. * PC13| | | | | | | | |
  550. * PC14| | | | | | | | |
  551. * PC15| | | | | | | | |
  552. *______________________________________________________________________________
  553. * PD0 |TIM21_C1|SPI2 | | | | | | |
  554. * PD1 | |SPI2 | | | | | | |
  555. * PD2 |LPUART1 | |TIM3_TR | | | |USART5 | |
  556. * PD3 |USART2 | |SPI2 | | | | | |
  557. * PD4 |USART2 |SPI2 | | | | | | |
  558. * PD5 |USART2 | | | | | | | |
  559. * PD6 |USART2 | | | | | | | |
  560. * PD7 |USART2 |TIM21_C2| | | | | | |
  561. * PD8 |LPUART1 | | | | | | | |
  562. * PD9 |LPUART1 | | | | | | | |
  563. * PD10| | | | | | | | |
  564. * PD11|LPUART1 | | | | | | | |
  565. * PD12|LPUART1 | | | | | | | |
  566. * PD13| | | | | | | | |
  567. * PD14| | | | | | | | |
  568. * PD15| | | | | | | | |
  569. *______________________________________________________________________________
  570. * PE0 | | |EVENTOUT| | | | | |
  571. * PE1 | | |EVENTOUT| | | | | |
  572. * PE2 | | |TIM3_TR | | | | | |
  573. * PE3 |TIM22_C1| |TIM3_C1 | | | | | |
  574. * PE4 |TIM22_C2| |TIM3_C2 | | | | | |
  575. * PE5 |TIM21_C1| |TIM3_C3 | | | | | |
  576. * PE6 |TIM21_C2| |TIM3_C4 | | | | | |
  577. * PE7 | | | | | | |USART5 | |
  578. * PE8 | | | | | | |USART4 | |
  579. * PE9 |TIM2_C1 | |TIM2_TR | | | |USART4 | |
  580. * PE10|TIM2_C2 | | | | | |USART5 | |
  581. * PE11|TIM2_C3 | | | | | |USART5 | |
  582. * PE12|TIM2_C4 | |SPI1 | | | | | |
  583. * PE13| | |SPI1 | | | | | |
  584. * PE14| | |SPI1 | | | | | |
  585. * PE15| | |SPI1 | | | | | |
  586. *______________________________________________________________________________
  587. * PH0 | | | | | | | | |
  588. * PH1 | | | | | | | | |
  589. * PH9 | | | | | | | | |
  590. * PH10| | | | | | | | |
  591. *
  592. */
  593. /** @defgroup GPIOEx_Alternate_function_selection Alternate function selection
  594. * @{
  595. */
  596. /*
  597. * Alternate function AF0
  598. *
  599. */
  600. #define GPIO_AF0_EVENTOUT ((uint8_t)0x00U) /* EVENTOUT Alternate Function mapping */
  601. #define GPIO_AF0_TIM21 ((uint8_t)0x00U) /* TIM21 Alternate Function mapping */
  602. #define GPIO_AF0_SPI1 ((uint8_t)0x00U) /* SPI1 Alternate Function mapping */
  603. #define GPIO_AF0_MCO ((uint8_t)0x00U) /* MCO Alternate Function mapping */
  604. #define GPIO_AF0_SWDIO ((uint8_t)0x00U) /* SWDIO Alternate Function mapping */
  605. #define GPIO_AF0_SWCLK ((uint8_t)0x00U) /* SWCLK Alternate Function mapping */
  606. #define GPIO_AF0_USART1 ((uint8_t)0x00U) /* USART1 Alternate Function mapping */
  607. #define GPIO_AF0_SPI2 ((uint8_t)0x00U) /* SPI2 Alternate Function mapping */
  608. #define GPIO_AF0_LPTIM1 ((uint8_t)0x00U) /* LPTIM1 Alternate Function mapping */
  609. #define GPIO_AF0_TIM22 ((uint8_t)0x00U) /* TIM22 Alternate Function mapping */
  610. #define GPIO_AF0_LPUART1 ((uint8_t)0x00U) /* LPUART1 Alternate Function mapping */
  611. #define GPIO_AF0_USART2 ((uint8_t)0x00U) /* USART2 Alternate Function mapping */
  612. #define GPIO_AF0_TIM2 ((uint8_t)0x00U) /* TIM2 Alternate Function mapping */
  613. /**
  614. *
  615. */
  616. /*
  617. * Alternate function AF1
  618. *
  619. */
  620. #define GPIO_AF1_I2C1 ((uint8_t)0x01U) /* I2C1 Alternate Function mapping */
  621. #define GPIO_AF1_SPI2 ((uint8_t)0x01U) /* SPI2 Alternate Function mapping */
  622. #define GPIO_AF1_TIM21 ((uint8_t)0x01U) /* TIM21 Alternate Function mapping */
  623. /**
  624. *
  625. */
  626. /*
  627. * Alternate function AF2
  628. *
  629. */
  630. #define GPIO_AF2_TIM2 ((uint8_t)0x02U) /* TIM2 Alternate Function mapping */
  631. #define GPIO_AF2_TIM3 ((uint8_t)0x02U) /* TIM3 Alternate Function mapping */
  632. #define GPIO_AF2_EVENTOUT ((uint8_t)0x02U) /* EVENTOUT Alternate Function mapping */
  633. #define GPIO_AF2_LPTIM1 ((uint8_t)0x02U) /* LPTIM1 Alternate Function mapping */
  634. #define GPIO_AF2_LPUART1 ((uint8_t)0x02U) /* LPUART1 Alternate Function mapping */
  635. #define GPIO_AF2_MCO ((uint8_t)0x02U) /* MCO Alternate Function mapping */
  636. #define GPIO_AF2_RTC ((uint8_t)0x02U) /* RTC Alternate Function mapping */
  637. #define GPIO_AF2_SPI2 ((uint8_t)0x02U) /* SPI2 Alternate Function mapping */
  638. #define GPIO_AF2_USART5 ((uint8_t)0x02U) /* USART5 Alternate Function mapping */
  639. #define GPIO_AF2_SPI1 ((uint8_t)0x02U) /* SPI1 Alternate Function mapping */
  640. /**
  641. *
  642. */
  643. /*
  644. * Alternate function AF3
  645. * @{
  646. */
  647. #define GPIO_AF3_EVENTOUT ((uint8_t)0x03U) /* EVENTOUT Alternate Function mapping */
  648. #define GPIO_AF3_I2C1 ((uint8_t)0x03U) /* I2C1 Alternate Function mapping */
  649. /**
  650. *
  651. */
  652. /*
  653. * Alternate function AF4
  654. *
  655. */
  656. #define GPIO_AF4_USART2 ((uint8_t)0x04U) /* USART2 Alternate Function mapping */
  657. #define GPIO_AF4_LPUART1 ((uint8_t)0x04U) /* LPUART1 Alternate Function mapping */
  658. #define GPIO_AF4_USART1 ((uint8_t)0x04U) /* USART1 Alternate Function mapping */
  659. #define GPIO_AF4_EVENTOUT ((uint8_t)0x04U) /* EVENTOUT Alternate Function mapping */
  660. #define GPIO_AF4_TIM22 ((uint8_t)0x04U) /* TIM22 Alternate Function mapping */
  661. #define GPIO_AF4_TIM3 ((uint8_t)0x04U) /* TIM3 Alternate Function mapping */
  662. #define GPIO_AF4_I2C1 ((uint8_t)0x04U) /* I2C1 Alternate Function mapping */
  663. /**
  664. *
  665. */
  666. /*
  667. * Alternate function AF5
  668. *
  669. */
  670. #define GPIO_AF5_TIM2 ((uint8_t)0x05U) /* TIM2 Alternate Function mapping */
  671. #define GPIO_AF5_TIM21 ((uint8_t)0x05U) /* TIM21 Alternate Function mapping */
  672. #define GPIO_AF5_TIM22 ((uint8_t)0x05U) /* TIM22 Alternate Function mapping */
  673. #define GPIO_AF5_USART1 ((uint8_t)0x05U) /* USART1 Alternate Function mapping */
  674. #define GPIO_AF5_SPI2 ((uint8_t)0x05U) /* SPI2 Alternate Function mapping */
  675. #define GPIO_AF5_I2C2 ((uint8_t)0x05U) /* I2C2 Alternate Function mapping */
  676. /**
  677. *
  678. */
  679. /*
  680. * Alternate function AF6
  681. *
  682. */
  683. #define GPIO_AF6_USART4 ((uint8_t)0x06U) /* USART4 Alternate Function mapping */
  684. #define GPIO_AF6_LPUART1 ((uint8_t)0x06U) /* LPUART1 Alternate Function mapping */
  685. #define GPIO_AF6_EVENTOUT ((uint8_t)0x06U) /* EVENTOUT Alternate Function mapping */
  686. #define GPIO_AF6_I2C1 ((uint8_t)0x06U) /* I2C1 Alternate Function mapping */
  687. #define GPIO_AF6_I2C2 ((uint8_t)0x06U) /* I2C2 Alternate Function mapping */
  688. #define GPIO_AF6_USART5 ((uint8_t)0x06U) /* USART5 Alternate Function mapping */
  689. #define GPIO_AF6_TIM21 ((uint8_t)0x06U) /* TIM21 Alternate Function mapping */
  690. /**
  691. *
  692. */
  693. /*
  694. * Alternate function AF7
  695. *
  696. */
  697. #define GPIO_AF7_COMP1 ((uint8_t)0x07U) /* COMP1 Alternate Function mapping */
  698. #define GPIO_AF7_COMP2 ((uint8_t)0x07U) /* COMP2 Alternate Function mapping */
  699. #define GPIO_AF7_I2C3 ((uint8_t)0x07U) /* I2C3 Alternate Function mapping */
  700. #define GPIO_AF7_LPUART1 ((uint8_t)0x07U) /* LPUART1 Alternate Function mapping */
  701. /**
  702. *
  703. */
  704. /**
  705. * @}
  706. */
  707. /**
  708. * @}
  709. */
  710. /** @defgroup GPIOEx_Private GPIOEx Private
  711. * @{
  712. */
  713. /**
  714. * IS_GPIO_AF macro definition
  715. */
  716. #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x07)
  717. /**
  718. * @}
  719. */
  720. #endif /* (STM32L081xx) || (STM32L071xx) */
  721. /*----------------------------------------------------------------------------*/
  722. /*------------------------- STM32L053xx/STM32L063xx---------------------------*/
  723. /*----------------------------------------------------------------------------*/
  724. #if defined (STM32L053xx) || defined (STM32L063xx)
  725. /* The table below gives an overview of the different alternate functions per port.
  726. * For more details refer yourself to the product data sheet.
  727. *
  728. */
  729. /* | AF0 | AF1 | AF2 | AF3 | AF4 | AF5 | AF6 | AF7 |
  730. *______________________________________________________________________________
  731. * PA0 | | |TIM2_C1 |TSC |USART2 |TIM2_TR | |COMP1 |
  732. * PA1 |EVENTOUT|LCD |TIM2_C2 |TSC |USART2 |TIM21_TR| | |
  733. * PA2 |TIM21_C1|LCD |TIM2_C3 |TSC |USART2 | | |COMP2 |
  734. * PA3 |TIM21_C2|LCD |TIM2_C4 |TSC |USART2 | | | |
  735. * PA4 |SPI1 | | |TSC |USART2 |TIM22_TR| | |
  736. * PA5 |SPI1 | |TIM2_TR |TSC | |TIM2_C1 | | |
  737. * PA6 |SPI1 |LCD | |TSC |LPUART |TIM22_C1|EVENTOUT|COMP1 |
  738. * PA7 |SPI1 |LCD | |TSC | |TIM22_C2|EVENTOUT|COMP2 |
  739. * PA8 |MCO |LCD |USB |EVENTOUT|USART1 | | | |
  740. * PA9 |MCO |LCD | |TSC |USART1 | | | |
  741. * PA10| |LCD | |TSC |USART1 | | | |
  742. * PA11|SPI1 | |EVENTOUT|TSC |USART1 | | |COMP1 |
  743. * PA12|SPI1 | |EVENTOUT|TSC |USART1 | | |COMP2 |
  744. * PA13|SWDIO | |USB | | | | | |
  745. * PA14|SWCLK | | | |USART2 | | | |
  746. * PA15|SPI1 |LCD |TIM2_TR |EVENTOUT|USART2 |TIM2_C1 | | |
  747. *______________________________________________________________________________
  748. * PB0 |EVENTOUT|LCD | |TSC | | | | |
  749. * PB1 | |LCD | |TSC |LPUART1 | | | |
  750. * PB2 | | |LPTIM1_O|TSC | | | | |
  751. * PB3 |SPI1 |LCD |TIM2_C2 |TSC |EVENTOUT| | | |
  752. * PB4 |SPI1 |LCD |EVENTOUT|TSC |TIM22_C1| | | |
  753. * PB5 |SPI1 |LCD |LPTIM1_I|I2C1 |TIM22_C2| | | |
  754. * PB6 |USART1 |I2C1 |LPTIM1_T|TSC | | | | |
  755. * PB7 |USART1 |I2C1 |LPTIM1_I|TSC | | | | |
  756. * PB8 | |LCD | |TSC |I2C1 | | | |
  757. * PB9 | |LCD |EVENTOUT| |I2C1 |SPI2 | | |
  758. * PB10| |LCD |TIM2_C3 |TSC |LPUART1 |SPI2 |I2C2 | |
  759. * PB11|EVENTOUT|LCD |TIM2_C4 |TSC |LPUART1 | |I2C2 | |
  760. * PB12|SPI2 |LCD |LPUART1 |TSC | |I2C2 |EVENTOUT| |
  761. * PB13|SPI2 |LCD | |TSC |LPUART1 |I2C2 |TIM21_C1| |
  762. * PB14|SPI2 |LCD |RTC |TSC |LPUART1 |I2C2 |TIM21_C2| |
  763. * PB15|SPI2 |LCD |RTC | | | | | |
  764. *______________________________________________________________________________
  765. * PC0 |LPTIM1_I|LCD |EVENTOUT|TSC | | | | |
  766. * PC1 |LPTIM1_O|LCD |EVENTOUT|TSC | | | | |
  767. * PC2 |LPTIM1_I|LCD |SPI2 |TSC | | | | |
  768. * PC3 |LPTIM1_T|LCD |SPI2 |TSC | | | | |
  769. * PC4 |EVENTOUT|LCD |LPUART | | | | | |
  770. * PC5 | |LCD |LPUART |TSC | | | | |
  771. * PC6 |TIM22_C1|LCD | |TSC | | | | |
  772. * PC7 |TIM22_C2|LCD | |TSC | | | | |
  773. * PC8 |TIM22_TR|LCD | |TSC | | | | |
  774. * PC9 |TIM21_TR|LCD |USB |TSC | | | | |
  775. * PC10|LPUART |LCD | | | | | | |
  776. * PC11|LPUART |LCD | | | | | | |
  777. * PC12| |LCD | | | | | | |
  778. * PC13| | | | | | | | |
  779. * PC14| | | | | | | | |
  780. * PC15| | | | | | | | |
  781. *______________________________________________________________________________
  782. * PD2 |LPUART |LCD | | | | | | |
  783. *______________________________________________________________________________
  784. * PH0 |USB | | | | | | | |
  785. * PH1 | | | | | | | | |
  786. * *
  787. */
  788. /** @defgroup GPIOEx_Alternate_function_selection Alternate function selection
  789. * @{
  790. */
  791. /*
  792. * Alternate function AF0
  793. */
  794. #define GPIO_AF0_SPI1 ((uint8_t)0x00U) /* SPI1 Alternate Function mapping */
  795. #define GPIO_AF0_SPI2 ((uint8_t)0x00U) /* SPI2 Alternate Function mapping */
  796. #define GPIO_AF0_USART1 ((uint8_t)0x00U) /* USART1 Alternate Function mapping */
  797. #define GPIO_AF0_USART2 ((uint8_t)0x00U) /* USART2 Alternate Function mapping */
  798. #define GPIO_AF0_LPUART1 ((uint8_t)0x00U) /* LPUART1 Alternate Function mapping */
  799. #define GPIO_AF0_USB ((uint8_t)0x00U) /* USB Alternate Function mapping */
  800. #define GPIO_AF0_LPTIM1 ((uint8_t)0x00U) /* LPTIM1 Alternate Function mapping */
  801. #define GPIO_AF0_TSC ((uint8_t)0x00U) /* TSC Alternate Function mapping */
  802. #define GPIO_AF0_TIM2 ((uint8_t)0x00U) /* TIM2 Alternate Function mapping */
  803. #define GPIO_AF0_TIM21 ((uint8_t)0x00U) /* TIM21 Alternate Function mapping */
  804. #define GPIO_AF0_TIM22 ((uint8_t)0x00U) /* TIM22 Alternate Function mapping */
  805. #define GPIO_AF0_EVENTOUT ((uint8_t)0x00U) /* EVENTOUT Alternate Function mapping */
  806. #define GPIO_AF0_MCO ((uint8_t)0x00U) /* MCO Alternate Function mapping */
  807. #define GPIO_AF0_SWDIO ((uint8_t)0x00U) /* SWDIO Alternate Function mapping */
  808. #define GPIO_AF0_SWCLK ((uint8_t)0x00U) /* SWCLK Alternate Function mapping */
  809. /**
  810. *
  811. */
  812. /*
  813. * Alternate function AF1
  814. */
  815. #define GPIO_AF1_SPI1 ((uint8_t)0x01U) /* SPI1 Alternate Function mapping */
  816. #define GPIO_AF1_SPI2 ((uint8_t)0x01U) /* SPI2 Alternate Function mapping */
  817. #define GPIO_AF1_I2C1 ((uint8_t)0x01U) /* I2C1 Alternate Function mapping */
  818. #define GPIO_AF1_LCD ((uint8_t)0x01U) /* LCD Alternate Function mapping */
  819. /**
  820. *
  821. */
  822. /*
  823. * Alternate function AF2
  824. */
  825. #define GPIO_AF2_SPI2 ((uint8_t)0x02U) /* SPI2 Alternate Function mapping */
  826. #define GPIO_AF2_LPUART1 ((uint8_t)0x02U) /* LPUART1 Alternate Function mapping */
  827. #define GPIO_AF2_USB ((uint8_t)0x02U) /* USB Alternate Function mapping */
  828. #define GPIO_AF2_LPTIM1 ((uint8_t)0x02U) /* LPTIM1 Alternate Function mapping */
  829. #define GPIO_AF2_TIM2 ((uint8_t)0x02U) /* TIM2 Alternate Function mapping */
  830. #define GPIO_AF2_EVENTOUT ((uint8_t)0x02U) /* EVENTOUT Alternate Function mapping */
  831. #define GPIO_AF2_RTC ((uint8_t)0x02U) /* RTC Alternate Function mapping */
  832. /**
  833. *
  834. */
  835. /*
  836. * Alternate function AF3
  837. */
  838. #define GPIO_AF3_I2C1 ((uint8_t)0x03U) /* I2C1 Alternate Function mapping */
  839. #define GPIO_AF3_TSC ((uint8_t)0x03U) /* TSC Alternate Function mapping */
  840. #define GPIO_AF3_EVENTOUT ((uint8_t)0x03U) /* EVENTOUT Alternate Function mapping */
  841. /**
  842. *
  843. */
  844. /*
  845. * Alternate function AF4
  846. */
  847. #define GPIO_AF4_I2C1 ((uint8_t)0x04U) /* I2C1 Alternate Function mapping */
  848. #define GPIO_AF4_USART1 ((uint8_t)0x04U) /* USART1 Alternate Function mapping */
  849. #define GPIO_AF4_USART2 ((uint8_t)0x04U) /* USART2 Alternate Function mapping */
  850. #define GPIO_AF4_LPUART1 ((uint8_t)0x04U) /* LPUART1 Alternate Function mapping */
  851. #define GPIO_AF4_TIM22 ((uint8_t)0x04U) /* TIM22 Alternate Function mapping */
  852. #define GPIO_AF4_EVENTOUT ((uint8_t)0x04U) /* EVENTOUT Alternate Function mapping */
  853. /**
  854. *
  855. */
  856. /*
  857. * Alternate function AF5
  858. */
  859. #define GPIO_AF5_SPI2 ((uint8_t)0x05U) /* SPI2 Alternate Function mapping */
  860. #define GPIO_AF5_I2C2 ((uint8_t)0x05U) /* I2C2 Alternate Function mapping */
  861. #define GPIO_AF5_TIM2 ((uint8_t)0x05U) /* TIM2 Alternate Function mapping */
  862. #define GPIO_AF5_TIM21 ((uint8_t)0x05U) /* TIM21 Alternate Function mapping */
  863. #define GPIO_AF5_TIM22 ((uint8_t)0x05U) /* TIM22 Alternate Function mapping */
  864. /**
  865. *
  866. */
  867. /*
  868. * Alternate function AF6
  869. */
  870. #define GPIO_AF6_I2C2 ((uint8_t)0x06U) /* I2C2 Alternate Function mapping */
  871. #define GPIO_AF6_TIM21 ((uint8_t)0x06U) /* TIM21 Alternate Function mapping */
  872. #define GPIO_AF6_EVENTOUT ((uint8_t)0x06U) /* EVENTOUT Alternate Function mapping */
  873. /**
  874. *
  875. */
  876. /*
  877. * Alternate function AF7
  878. */
  879. #define GPIO_AF7_COMP1 ((uint8_t)0x07U) /* COMP1 Alternate Function mapping */
  880. #define GPIO_AF7_COMP2 ((uint8_t)0x07U) /* COMP2 Alternate Function mapping */
  881. /**
  882. *
  883. */
  884. /**
  885. * @}
  886. */
  887. /**
  888. * @}
  889. */
  890. /** @defgroup GPIOEx_Private GPIOEx Private
  891. * @{
  892. */
  893. /**
  894. * @brief IS_GPIO_AF macro definition
  895. */
  896. #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x07)
  897. /**
  898. * @}
  899. */
  900. #endif /* STM32L053xx || STM32L063xx */
  901. /*------------------------------------------------------------------------------------------*/
  902. /*----------------------------------------------------------------------------*/
  903. /*------------------------- STM32L052xx/STM32L062xx---------------------------*/
  904. /*----------------------------------------------------------------------------*/
  905. #if defined (STM32L052xx) || defined (STM32L062xx)
  906. /* The table below gives an overview of the different alternate functions per port.
  907. * For more details refer yourself to the product data sheet.
  908. *
  909. */
  910. /* | AF0 | AF1 | AF2 | AF3 | AF4 | AF5 | AF6 | AF7 |
  911. *______________________________________________________________________________
  912. * PA0 | | |TIM2_C1 |TSC |USART2 |TIM2_TR | |COMP1 |
  913. * PA1 |EVENTOUT| |TIM2_C2 |TSC |USART2 |TIM21_TR| | |
  914. * PA2 |TIM21_C1| |TIM2_C3 |TSC |USART2 | | |COMP2 |
  915. * PA3 |TIM21_C2| |TIM2_C4 |TSC |USART2 | | | |
  916. * PA4 |SPI1 | | |TSC |USART2 |TIM22_TR| | |
  917. * PA5 |SPI1 | |TIM2_TR |TSC | |TIM2_C1 | | |
  918. * PA6 |SPI1 | | |TSC |LPUART |TIM22_C1|EVENTOUT|COMP1 |
  919. * PA7 |SPI1 | | |TSC | |TIM22_C2|EVENTOUT|COMP2 |
  920. * PA8 |MCO | |USB |EVENTOUT|USART1 | | | |
  921. * PA9 |MCO | | |TSC |USART1 | | | |
  922. * PA10| | | |TSC |USART1 | | | |
  923. * PA11|SPI1 | |EVENTOUT|TSC |USART1 | | |COMP1 |
  924. * PA12|SPI1 | |EVENTOUT|TSC |USART1 | | |COMP2 |
  925. * PA13|SWDIO | |USB | | | | | |
  926. * PA14|SWCLK | | | |USART2 | | | |
  927. * PA15|SPI1 | |TIM2_TR |EVENTOUT|USART2 |TIM2_C1 | | |
  928. *______________________________________________________________________________
  929. * PB0 |EVENTOUT| | |TSC | | | | |
  930. * PB1 | | | |TSC |LPUART1 | | | |
  931. * PB2 | | |LPTIM1_O|TSC | | | | |
  932. * PB3 |SPI1 | |TIM2_C2 |TSC |EVENTOUT| | | |
  933. * PB4 |SPI1 | |EVENTOUT|TSC |TIM22_C1| | | |
  934. * PB5 |SPI1 | |LPTIM1_I|I2C1 |TIM22_C2| | | |
  935. * PB6 |USART1 |I2C1 |LPTIM1_T|TSC | | | | |
  936. * PB7 |USART1 |I2C1 |LPTIM1_I|TSC | | | | |
  937. * PB8 | | | |TSC |I2C1 | | | |
  938. * PB9 | | |EVENTOUT| |I2C1 |SPI2 | | |
  939. * PB10| | |TIM2_C3 |TSC |LPUART1 |SPI2 |I2C2 | |
  940. * PB11|EVENTOUT| |TIM2_C4 |TSC |LPUART1 | |I2C2 | |
  941. * PB12|SPI2 | |LPUART1 |TSC | |I2C2 |EVENTOUT| |
  942. * PB13|SPI2 | | |TSC |LPUART1 |I2C2 |TIM21_C1| |
  943. * PB14|SPI2 | |RTC |TSC |LPUART1 |I2C2 |TIM21_C2| |
  944. * PB15|SPI2 | |RTC | | | | | |
  945. *______________________________________________________________________________
  946. * PC0 |LPTIM1_I| |EVENTOUT|TSC | | | | |
  947. * PC1 |LPTIM1_O| |EVENTOUT|TSC | | | | |
  948. * PC2 |LPTIM1_I| |SPI2 |TSC | | | | |
  949. * PC3 |LPTIM1_T| |SPI2 |TSC | | | | |
  950. * PC4 |EVENTOUT| |LPUART | | | | | |
  951. * PC5 | | |LPUART |TSC | | | | |
  952. * PC6 |TIM22_C1| | |TSC | | | | |
  953. * PC7 |TIM22_C2| | |TSC | | | | |
  954. * PC8 |TIM22_TR| | |TSC | | | | |
  955. * PC9 |TIM21_TR| |USB |TSC | | | | |
  956. * PC10|LPUART | | | | | | | |
  957. * PC11|LPUART | | | | | | | |
  958. * PC12| | | | | | | | |
  959. * PC13| | | | | | | | |
  960. * PC14| | | | | | | | |
  961. * PC15| | | | | | | | |
  962. *______________________________________________________________________________
  963. * PD2 |LPUART | | | | | | | |
  964. *______________________________________________________________________________
  965. * PH0 |USB | | | | | | | |
  966. * PH1 | | | | | | | | |
  967. * *
  968. */
  969. /** @defgroup GPIOEx_Alternate_function_selection Alternate function selection
  970. * @{
  971. */
  972. /*
  973. * Alternate function AF0
  974. */
  975. #define GPIO_AF0_SPI1 ((uint8_t)0x00U) /* SPI1 Alternate Function mapping */
  976. #define GPIO_AF0_SPI2 ((uint8_t)0x00U) /* SPI2 Alternate Function mapping */
  977. #define GPIO_AF0_USART1 ((uint8_t)0x00U) /* USART1 Alternate Function mapping */
  978. #define GPIO_AF0_USART2 ((uint8_t)0x00U) /* USART2 Alternate Function mapping */
  979. #define GPIO_AF0_LPUART1 ((uint8_t)0x00U) /* LPUART1 Alternate Function mapping */
  980. #define GPIO_AF0_USB ((uint8_t)0x00U) /* USB Alternate Function mapping */
  981. #define GPIO_AF0_LPTIM1 ((uint8_t)0x00U) /* LPTIM1 Alternate Function mapping */
  982. #define GPIO_AF0_TSC ((uint8_t)0x00U) /* TSC Alternate Function mapping */
  983. #define GPIO_AF0_TIM2 ((uint8_t)0x00U) /* TIM2 Alternate Function mapping */
  984. #define GPIO_AF0_TIM21 ((uint8_t)0x00U) /* TIM21 Alternate Function mapping */
  985. #define GPIO_AF0_TIM22 ((uint8_t)0x00U) /* TIM22 Alternate Function mapping */
  986. #define GPIO_AF0_EVENTOUT ((uint8_t)0x00U) /* EVENTOUT Alternate Function mapping */
  987. #define GPIO_AF0_MCO ((uint8_t)0x00U) /* MCO Alternate Function mapping */
  988. #define GPIO_AF0_SWDIO ((uint8_t)0x00U) /* SWDIO Alternate Function mapping */
  989. #define GPIO_AF0_SWCLK ((uint8_t)0x00U) /* SWCLK Alternate Function mapping */
  990. /**
  991. *
  992. */
  993. /*
  994. * Alternate function AF1
  995. */
  996. #define GPIO_AF1_SPI1 ((uint8_t)0x01U) /* SPI1 Alternate Function mapping */
  997. #define GPIO_AF1_SPI2 ((uint8_t)0x01U) /* SPI2 Alternate Function mapping */
  998. #define GPIO_AF1_I2C1 ((uint8_t)0x01U) /* I2C1 Alternate Function mapping */
  999. /**
  1000. *
  1001. */
  1002. /**
  1003. * Alternate function AF2
  1004. */
  1005. #define GPIO_AF2_SPI2 ((uint8_t)0x02U) /* SPI2 Alternate Function mapping */
  1006. #define GPIO_AF2_LPUART1 ((uint8_t)0x02U) /* LPUART1 Alternate Function mapping */
  1007. #define GPIO_AF2_USB ((uint8_t)0x02U) /* USB Alternate Function mapping */
  1008. #define GPIO_AF2_LPTIM1 ((uint8_t)0x02U) /* LPTIM1 Alternate Function mapping */
  1009. #define GPIO_AF2_TIM2 ((uint8_t)0x02U) /* TIM2 Alternate Function mapping */
  1010. #define GPIO_AF2_EVENTOUT ((uint8_t)0x02U) /* EVENTOUT Alternate Function mapping */
  1011. #define GPIO_AF2_RTC ((uint8_t)0x02U) /* RTC Alternate Function mapping */
  1012. /**
  1013. *
  1014. */
  1015. /*
  1016. * Alternate function AF3
  1017. */
  1018. #define GPIO_AF3_I2C1 ((uint8_t)0x03U) /* I2C1 Alternate Function mapping */
  1019. #define GPIO_AF3_TSC ((uint8_t)0x03U) /* TSC Alternate Function mapping */
  1020. #define GPIO_AF3_EVENTOUT ((uint8_t)0x03U) /* EVENTOUT Alternate Function mapping */
  1021. /**
  1022. *
  1023. */
  1024. /*
  1025. * Alternate function AF4
  1026. */
  1027. #define GPIO_AF4_I2C1 ((uint8_t)0x04U) /* I2C1 Alternate Function mapping */
  1028. #define GPIO_AF4_USART1 ((uint8_t)0x04U) /* USART1 Alternate Function mapping */
  1029. #define GPIO_AF4_USART2 ((uint8_t)0x04U) /* USART2 Alternate Function mapping */
  1030. #define GPIO_AF4_LPUART1 ((uint8_t)0x04U) /* LPUART1 Alternate Function mapping */
  1031. #define GPIO_AF4_TIM22 ((uint8_t)0x04U) /* TIM22 Alternate Function mapping */
  1032. #define GPIO_AF4_EVENTOUT ((uint8_t)0x04U) /* EVENTOUT Alternate Function mapping */
  1033. /**
  1034. *
  1035. */
  1036. /*
  1037. * Alternate function AF5
  1038. */
  1039. #define GPIO_AF5_SPI2 ((uint8_t)0x05U) /* SPI2 Alternate Function mapping */
  1040. #define GPIO_AF5_I2C2 ((uint8_t)0x05U) /* I2C2 Alternate Function mapping */
  1041. #define GPIO_AF5_TIM2 ((uint8_t)0x05U) /* TIM2 Alternate Function mapping */
  1042. #define GPIO_AF5_TIM21 ((uint8_t)0x05U) /* TIM21 Alternate Function mapping */
  1043. #define GPIO_AF5_TIM22 ((uint8_t)0x05U) /* TIM22 Alternate Function mapping */
  1044. /**
  1045. *
  1046. */
  1047. /*
  1048. * Alternate function AF6
  1049. */
  1050. #define GPIO_AF6_I2C2 ((uint8_t)0x06U) /* I2C2 Alternate Function mapping */
  1051. #define GPIO_AF6_TIM21 ((uint8_t)0x06U) /* TIM21 Alternate Function mapping */
  1052. #define GPIO_AF6_EVENTOUT ((uint8_t)0x06U) /* EVENTOUT Alternate Function mapping */
  1053. /**
  1054. *
  1055. */
  1056. /*
  1057. * Alternate function AF7
  1058. */
  1059. #define GPIO_AF7_COMP1 ((uint8_t)0x07U) /* COMP1 Alternate Function mapping */
  1060. #define GPIO_AF7_COMP2 ((uint8_t)0x07U) /* COMP2 Alternate Function mapping */
  1061. /**
  1062. *
  1063. */
  1064. /**
  1065. * @}
  1066. */
  1067. /**
  1068. * @}
  1069. */
  1070. /** @defgroup GPIOEx_Private GPIOEx Private
  1071. * @{
  1072. */
  1073. /**
  1074. * @brief IS_GPIO_AF macro definition
  1075. */
  1076. #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x07)
  1077. /**
  1078. * @}
  1079. */
  1080. #endif /* STM32L052xx || STM32L062xx */
  1081. /*------------------------------------------------------------------------------------------*/
  1082. /*----------------------------------------------------------------------------*/
  1083. /*------------------------- STM32L051xx/STM32L061xx---------------------------*/
  1084. /*----------------------------------------------------------------------------*/
  1085. #if defined (STM32L051xx)|| defined (STM32L061xx)
  1086. /* The table below gives an overview of the different alternate functions per port.
  1087. * For more details refer yourself to the product data sheet.
  1088. *
  1089. */
  1090. /* | AF0 | AF1 | AF2 | AF3 | AF4 | AF5 | AF6 | AF7 |
  1091. *______________________________________________________________________________
  1092. * PA0 | | |TIM2_C1 | |USART2 |TIM2_TR | |COMP1 |
  1093. * PA1 |EVENTOUT| |TIM2_C2 | |USART2 |TIM21_TR| | |
  1094. * PA2 |TIM21_C1| |TIM2_C3 | |USART2 | | |COMP2 |
  1095. * PA3 |TIM21_C2| |TIM2_C4 | |USART2 | | | |
  1096. * PA4 |SPI1 | | | |USART2 |TIM22_TR| | |
  1097. * PA5 |SPI1 | |TIM2_TR | | |TIM2_C1 | | |
  1098. * PA6 |SPI1 | | | |LPUART |TIM22_C1|EVENTOUT|COMP1 |
  1099. * PA7 |SPI1 | | | | |TIM22_C2|EVENTOUT|COMP2 |
  1100. * PA8 |MCO | | |EVENTOUT|USART1 | | | |
  1101. * PA9 |MCO | | | |USART1 | | | |
  1102. * PA10| | | | |USART1 | | | |
  1103. * PA11|SPI1 | |EVENTOUT| |USART1 | | |COMP1 |
  1104. * PA12|SPI1 | |EVENTOUT| |USART1 | | |COMP2 |
  1105. * PA13|SWDIO | | | | | | | |
  1106. * PA14|SWCLK | | | |USART2 | | | |
  1107. * PA15|SPI1 | |TIM2_TR |EVENTOUT|USART2 |TIM2_C1 | | |
  1108. *______________________________________________________________________________
  1109. * PB0 |EVENTOUT| | | | | | | |
  1110. * PB1 | | | | |LPUART1 | | | |
  1111. * PB2 | | |LPTIM1_O| | | | | |
  1112. * PB3 |SPI1 | |TIM2_C2 | |EVENTOUT| | | |
  1113. * PB4 |SPI1 | |EVENTOUT| |TIM22_C1| | | |
  1114. * PB5 |SPI1 | |LPTIM1_I|I2C1 |TIM22_C2| | | |
  1115. * PB6 |USART1 |I2C1 |LPTIM1_T| | | | | |
  1116. * PB7 |USART1 |I2C1 |LPTIM1_I| | | | | |
  1117. * PB8 | | | | |I2C1 | | | |
  1118. * PB9 | | |EVENTOUT| |I2C1 |SPI2 | | |
  1119. * PB10| | |TIM2_C3 | |LPUART1 |SPI2 |I2C2 | |
  1120. * PB11|EVENTOUT| |TIM2_C4 | |LPUART1 | |I2C2 | |
  1121. * PB12|SPI2 | |LPUART1 | | |I2C2 |EVENTOUT| |
  1122. * PB13|SPI2 | | | |LPUART1 |I2C2 |TIM21_C1| |
  1123. * PB14|SPI2 | |RTC | |LPUART1 |I2C2 |TIM21_C2| |
  1124. * PB15|SPI2 | |RTC | | | | | |
  1125. *______________________________________________________________________________
  1126. * PC0 |LPTIM1_I| |EVENTOUT| | | | | |
  1127. * PC1 |LPTIM1_O| |EVENTOUT| | | | | |
  1128. * PC2 |LPTIM1_I| |SPI2 | | | | | |
  1129. * PC3 |LPTIM1_T| |SPI2 | | | | | |
  1130. * PC4 |EVENTOUT| |LPUART | | | | | |
  1131. * PC5 | | |LPUART | | | | | |
  1132. * PC6 |TIM22_C1| | | | | | | |
  1133. * PC7 |TIM22_C2| | | | | | | |
  1134. * PC8 |TIM22_TR| | | | | | | |
  1135. * PC9 |TIM21_TR| | | | | | | |
  1136. * PC10|LPUART | | | | | | | |
  1137. * PC11|LPUART | | | | | | | |
  1138. * PC12| | | | | | | | |
  1139. * PC13| | | | | | | | |
  1140. * PC14| | | | | | | | |
  1141. * PC15| | | | | | | | |
  1142. *______________________________________________________________________________
  1143. * PD2 |LPUART | | | | | | | |
  1144. *______________________________________________________________________________
  1145. * PH0 | | | | | | | | |
  1146. * PH1 | | | | | | | | |
  1147. * *
  1148. */
  1149. /** @defgroup GPIOEx_Alternate_function_selection Alternate function selection
  1150. * @{
  1151. */
  1152. /*
  1153. * Alternate function AF0
  1154. */
  1155. #define GPIO_AF0_SPI1 ((uint8_t)0x00U) /* SPI1 Alternate Function mapping */
  1156. #define GPIO_AF0_SPI2 ((uint8_t)0x00U) /* SPI2 Alternate Function mapping */
  1157. #define GPIO_AF0_USART1 ((uint8_t)0x00U) /* USART1 Alternate Function mapping */
  1158. #define GPIO_AF0_USART2 ((uint8_t)0x00U) /* USART2 Alternate Function mapping */
  1159. #define GPIO_AF0_LPUART1 ((uint8_t)0x00U) /* LPUART1 Alternate Function mapping */
  1160. #define GPIO_AF0_LPTIM1 ((uint8_t)0x00U) /* LPTIM1 Alternate Function mapping */
  1161. #define GPIO_AF0_TIM2 ((uint8_t)0x00U) /* TIM2 Alternate Function mapping */
  1162. #define GPIO_AF0_TIM21 ((uint8_t)0x00U) /* TIM21 Alternate Function mapping */
  1163. #define GPIO_AF0_TIM22 ((uint8_t)0x00U) /* TIM22 Alternate Function mapping */
  1164. #define GPIO_AF0_EVENTOUT ((uint8_t)0x00U) /* EVENTOUT Alternate Function mapping */
  1165. #define GPIO_AF0_MCO ((uint8_t)0x00U) /* MCO Alternate Function mapping */
  1166. #define GPIO_AF0_SWDIO ((uint8_t)0x00U) /* SWDIO Alternate Function mapping */
  1167. #define GPIO_AF0_SWCLK ((uint8_t)0x00U) /* SWCLK Alternate Function mapping */
  1168. /**
  1169. *
  1170. */
  1171. /*
  1172. * Alternate function AF1
  1173. */
  1174. #define GPIO_AF1_SPI1 ((uint8_t)0x01U) /* SPI1 Alternate Function mapping */
  1175. #define GPIO_AF1_SPI2 ((uint8_t)0x01U) /* SPI2 Alternate Function mapping */
  1176. #define GPIO_AF1_I2C1 ((uint8_t)0x01U) /* I2C1 Alternate Function mapping */
  1177. /**
  1178. *
  1179. */
  1180. /*
  1181. * Alternate function AF2
  1182. */
  1183. #define GPIO_AF2_SPI2 ((uint8_t)0x02U) /* SPI2 Alternate Function mapping */
  1184. #define GPIO_AF2_LPUART1 ((uint8_t)0x02U) /* LPUART1 Alternate Function mapping */
  1185. #define GPIO_AF2_USB ((uint8_t)0x02U) /* USB Alternate Function mapping */
  1186. #define GPIO_AF2_LPTIM1 ((uint8_t)0x02U) /* LPTIM1 Alternate Function mapping */
  1187. #define GPIO_AF2_TIM2 ((uint8_t)0x02U) /* TIM2 Alternate Function mapping */
  1188. #define GPIO_AF2_EVENTOUT ((uint8_t)0x02U) /* EVENTOUT Alternate Function mapping */
  1189. #define GPIO_AF2_RTC ((uint8_t)0x02U) /* RTC Alternate Function mapping */
  1190. /**
  1191. *
  1192. */
  1193. /*
  1194. * Alternate function AF3
  1195. */
  1196. #define GPIO_AF3_I2C1 ((uint8_t)0x03U) /* I2C1 Alternate Function mapping */
  1197. #define GPIO_AF3_EVENTOUT ((uint8_t)0x03U) /* EVENTOUT Alternate Function mapping */
  1198. /**
  1199. *
  1200. */
  1201. /*
  1202. * Alternate function AF4
  1203. */
  1204. #define GPIO_AF4_I2C1 ((uint8_t)0x04U) /* I2C1 Alternate Function mapping */
  1205. #define GPIO_AF4_USART1 ((uint8_t)0x04U) /* USART1 Alternate Function mapping */
  1206. #define GPIO_AF4_USART2 ((uint8_t)0x04U) /* USART2 Alternate Function mapping */
  1207. #define GPIO_AF4_LPUART1 ((uint8_t)0x04U) /* LPUART1 Alternate Function mapping */
  1208. #define GPIO_AF4_TIM22 ((uint8_t)0x04U) /* TIM22 Alternate Function mapping */
  1209. #define GPIO_AF4_EVENTOUT ((uint8_t)0x04U) /* EVENTOUT Alternate Function mapping */
  1210. /**
  1211. *
  1212. */
  1213. /*
  1214. * Alternate function AF5
  1215. */
  1216. #define GPIO_AF5_SPI2 ((uint8_t)0x05U) /* SPI2 Alternate Function mapping */
  1217. #define GPIO_AF5_I2C2 ((uint8_t)0x05U) /* I2C2 Alternate Function mapping */
  1218. #define GPIO_AF5_TIM2 ((uint8_t)0x05U) /* TIM2 Alternate Function mapping */
  1219. #define GPIO_AF5_TIM21 ((uint8_t)0x05U) /* TIM21 Alternate Function mapping */
  1220. #define GPIO_AF5_TIM22 ((uint8_t)0x05U) /* TIM22 Alternate Function mapping */
  1221. /**
  1222. *
  1223. */
  1224. /*
  1225. * Alternate function AF6
  1226. */
  1227. #define GPIO_AF6_I2C2 ((uint8_t)0x06U) /* I2C2 Alternate Function mapping */
  1228. #define GPIO_AF6_TIM21 ((uint8_t)0x06U) /* TIM21 Alternate Function mapping */
  1229. #define GPIO_AF6_EVENTOUT ((uint8_t)0x06U) /* EVENTOUT Alternate Function mapping */
  1230. /**
  1231. *
  1232. */
  1233. /*
  1234. * Alternate function AF7
  1235. */
  1236. #define GPIO_AF7_COMP1 ((uint8_t)0x07U) /* COMP1 Alternate Function mapping */
  1237. #define GPIO_AF7_COMP2 ((uint8_t)0x07U) /* COMP2 Alternate Function mapping */
  1238. /**
  1239. *
  1240. */
  1241. /**
  1242. * @}
  1243. */
  1244. /**
  1245. * @}
  1246. */
  1247. /** @defgroup GPIOEx_Private GPIOEx Private
  1248. * @{
  1249. */
  1250. /**
  1251. * @brief IS_GPIO_AF macro definition
  1252. */
  1253. #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x07)
  1254. /**
  1255. * @}
  1256. */
  1257. #endif /* STM32L051xx/STM32L061xx*/
  1258. /*------------------------------------------------------------------------------------------*/
  1259. /*----------------------------------------------------------------------------*/
  1260. /*------------------------- STM32L031xx/STM32L041xx---------------------------*/
  1261. /*----------------------------------------------------------------------------*/
  1262. #if defined (STM32L031xx)|| defined (STM32L041xx)
  1263. /* The table below gives an overview of the different alternate functions per port.
  1264. * For more details refer yourself to the product data sheet.
  1265. *
  1266. */
  1267. /* | AF0 | AF1 | AF2 | AF3 | AF4 | AF5 | AF6 | AF7 |
  1268. *______________________________________________________________________________
  1269. * PA0 | |LPTIM1 |TIM2_C1 | |USART2 |TIM2_TR | |COMP1 |
  1270. * PA1 |EVENTOUT|LPTIM1 |TIM2_C2 |I2C1 |USART2 |TIM21_TR| | |
  1271. * PA2 |TIM21_C1| |TIM2_C3 | |USART2 | |LPUART1 |COMP2 |
  1272. * PA3 |TIM21_C2| |TIM2_C4 | |USART2 | |LPUART1 | |
  1273. * PA4 |SPI1 |LPTIM1 | | |USART2 |TIM22_TR| | |
  1274. * PA5 |SPI1 |LPTIM1 |TIM2_TR | | |TIM2_C1 | | |
  1275. * PA6 |SPI1 |LPTIM1 | | |LPUART |TIM22_C1|EVENTOUT|COMP1 |
  1276. * PA7 |SPI1 |LPTIM1 | | |USART2 |TIM22_C2|EVENTOUT|COMP2 |
  1277. * PA8 |MCO | |LPTIM1 |EVENTOUT|USART2 |TIM2_C1 | | |
  1278. * PA9 |MCO |I2C1 | | |USART2 |TIM22_C1| | |
  1279. * PA10| |I2C1 | | |USART2 |TIM22_C2| | |
  1280. * PA11|SPI1 | |EVENTOUT| |USART2 |TIM21_C2| |COMP1 |
  1281. * PA12|SPI1 | |EVENTOUT| |USART2 | | |COMP2 |
  1282. * PA13|SWDIO |LPTIM1 | | | | |LPUART1 | |
  1283. * PA14|SWCLK |LPTIM1 | |I2C1 |USART2 | |LPUART1 | |
  1284. * PA15|SPI1 | |TIM2_TR |EVENTOUT|USART2 |TIM2_C1 | | |
  1285. *_____________________________________________________________________________|
  1286. * PB0 |EVENTOUT|SPI1 | | |USART2 |TIM2_C3 | | |
  1287. * PB1 |USART2 |SPI1 | | |LPUART1 |TIM2_C4 | | |
  1288. * PB2 | | |LPTIM1_O| | | | | |
  1289. * PB3 |SPI1 | |TIM2_C2 | |EVENTOUT| | | |
  1290. * PB4 |SPI1 | |EVENTOUT| |TIM22_C1| | | |
  1291. * PB5 |SPI1 | |LPTIM1_I|I2C1 |TIM22_C2| | | |
  1292. * PB6 |USART2 |I2C1 |LPTIM1_T| | |TIM21_C1| | |
  1293. * PB7 |USART2 |I2C1 |LPTIM1_I| | | | | |
  1294. * PB8 | | | | |I2C1 | | | |
  1295. * PB9 | | |EVENTOUT| |I2C1 | | | |
  1296. * PB10| | |TIM2_C3 | | | |LPUART1 | |
  1297. * PB11|EVENTOUT| |TIM2_C4 | | | |LPUART1 | |
  1298. * PB12|SPI2 | | | | | |EVENTOUT| |
  1299. * PB13|SPI2 | |MCO | | |TIM21_C1|LPUART1 | |
  1300. * PB14|SPI2 | |RTC | | |TIM21_C2|LPUART1 | |
  1301. * PB15|SPI2 | |RTC | | | | | |
  1302. *_____________________________________________________________________________|
  1303. * PC0 |LPTIM1_I| |EVENTOUT| | | |LPUART1 | |
  1304. * PC13| | | | | | | | |
  1305. * PC14| | | | | | | | |
  1306. * PC15| | | | | | | | |
  1307. *_____________________________________________________________________________|
  1308. * PH0 | | | | | | | | |
  1309. * PH1 | | | | | | | | |
  1310. *_____________________________________________________________________________|
  1311. */
  1312. /** @defgroup GPIOEx_Alternate_function_selection Alternate function selection
  1313. * @{
  1314. */
  1315. /*
  1316. * Alternate function AF0
  1317. */
  1318. #define GPIO_AF0_EVENTOUT ((uint8_t)0x00U) /* EVENTOUT Alternate Function mapping */
  1319. #define GPIO_AF0_TIM21 ((uint8_t)0x00U) /* TIM21 Alternate Function mapping */
  1320. #define GPIO_AF0_SPI1 ((uint8_t)0x00U) /* SPI1 Alternate Function mapping */
  1321. #define GPIO_AF0_USART2 ((uint8_t)0x00U) /* USART2 Alternate Function mapping */
  1322. #define GPIO_AF0_LPTIM1 ((uint8_t)0x00U) /* LPTIM1 Alternate Function mapping */
  1323. #define GPIO_AF0_MCO ((uint8_t)0x00U) /* MCO Alternate Function mapping */
  1324. #define GPIO_AF0_SWDIO ((uint8_t)0x00U) /* SWDIO Alternate Function mapping */
  1325. #define GPIO_AF0_SWCLK ((uint8_t)0x00U) /* SWCLK Alternate Function mapping */
  1326. /**
  1327. *
  1328. */
  1329. /*
  1330. * Alternate function AF1
  1331. */
  1332. #define GPIO_AF1_SPI1 ((uint8_t)0x01U) /* SPI1 Alternate Function mapping */
  1333. #define GPIO_AF1_I2C1 ((uint8_t)0x01U) /* I2C1 Alternate Function mapping */
  1334. #define GPIO_AF1_LPTIM1 ((uint8_t)0x01U) /* LPTIM1 Alternate Function mapping */
  1335. /**
  1336. *
  1337. */
  1338. /*
  1339. * Alternate function AF2
  1340. */
  1341. #define GPIO_AF2_LPTIM1 ((uint8_t)0x02U) /* LPTIM1 Alternate Function mapping */
  1342. #define GPIO_AF2_TIM2 ((uint8_t)0x02U) /* TIM2 Alternate Function mapping */
  1343. #define GPIO_AF2_MCO ((uint8_t)0x02U) /* MCO Alternate Function mapping */
  1344. #define GPIO_AF2_EVENTOUT ((uint8_t)0x02U) /* EVENTOUT Alternate Function mapping */
  1345. #define GPIO_AF2_RTC ((uint8_t)0x02U) /* RTC Alternate Function mapping */
  1346. /**
  1347. *
  1348. */
  1349. /*
  1350. * Alternate function AF3
  1351. */
  1352. #define GPIO_AF3_I2C1 ((uint8_t)0x03U) /* I2C1 Alternate Function mapping */
  1353. #define GPIO_AF3_EVENTOUT ((uint8_t)0x03U) /* EVENTOUT Alternate Function mapping */
  1354. /**
  1355. *
  1356. */
  1357. /*
  1358. * Alternate function AF4
  1359. */
  1360. #define GPIO_AF4_I2C1 ((uint8_t)0x04U) /* I2C1 Alternate Function mapping */
  1361. #define GPIO_AF4_USART2 ((uint8_t)0x04U) /* USART2 Alternate Function mapping */
  1362. #define GPIO_AF4_LPUART1 ((uint8_t)0x04U) /* LPUART1 Alternate Function mapping */
  1363. #define GPIO_AF4_TIM22 ((uint8_t)0x04U) /* TIM22 Alternate Function mapping */
  1364. #define GPIO_AF4_EVENTOUT ((uint8_t)0x04U) /* EVENTOUT Alternate Function mapping */
  1365. /**
  1366. *
  1367. */
  1368. /*
  1369. * Alternate function AF5
  1370. */
  1371. #define GPIO_AF5_TIM2 ((uint8_t)0x05U) /* TIM2 Alternate Function mapping */
  1372. #define GPIO_AF5_TIM21 ((uint8_t)0x05U) /* TIM21 Alternate Function mapping */
  1373. #define GPIO_AF5_TIM22 ((uint8_t)0x05U) /* TIM22 Alternate Function mapping */
  1374. /**
  1375. *
  1376. */
  1377. /*
  1378. * Alternate function AF6
  1379. */
  1380. #define GPIO_AF6_LPUART1 ((uint8_t)0x06U) /* LPUART1 Alternate Function mapping */
  1381. #define GPIO_AF6_EVENTOUT ((uint8_t)0x06U) /* EVENTOUT Alternate Function mapping */
  1382. /**
  1383. *
  1384. */
  1385. /*
  1386. * Alternate function AF7
  1387. */
  1388. #define GPIO_AF7_COMP1 ((uint8_t)0x07U) /* COMP1 Alternate Function mapping */
  1389. #define GPIO_AF7_COMP2 ((uint8_t)0x07U) /* COMP2 Alternate Function mapping */
  1390. /**
  1391. *
  1392. */
  1393. /**
  1394. * @}
  1395. */
  1396. /**
  1397. * @}
  1398. */
  1399. /** @defgroup GPIOEx_Private GPIOEx Private
  1400. * @{
  1401. */
  1402. /**
  1403. * @brief IS_GPIO_AF macro definition
  1404. */
  1405. #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x07)
  1406. /**
  1407. * @}
  1408. */
  1409. #endif /* STM32L031xx/STM32L041xx*/
  1410. /*------------------------------------------------------------------------------------------*/
  1411. /*----------------------------------------------------------------------------*/
  1412. /*------------------------- STM32L011xx/STM32L021xx---------------------------*/
  1413. /*----------------------------------------------------------------------------*/
  1414. #if defined (STM32L011xx)|| defined (STM32L021xx)
  1415. /* The table below gives an overview of the different alternate functions per port.
  1416. * For more details refer yourself to the product data sheet.
  1417. *
  1418. */
  1419. /* | AF0 | AF1 | AF2 | AF3 | AF4 | AF5 | AF6 | AF7 |
  1420. *______________________________________________________________________________________
  1421. * PA0 |USART2_RX|LPTIM1_IN1|TIM2_C1 | |USART2_CTS|TIM2_ETR|LPUART1_RX |COMP1_OUT|
  1422. * PA1 |EVENTOUT |LPTIM1_IN2|TIM2_C2 |I2C1 |USART2_RTS|TIM21_TR|LPUART1_TX | |
  1423. * PA2 |TIM21_C1 | |TIM2_C3 | |USART2_TX | |LPUART1_TX |COMP2_OUT|
  1424. * PA3 |TIM21_C2 | |TIM2_C4 | |USART2_RX | |LPUART1_RX | |
  1425. * PA4 |SPI1 |LPTIM1_IN1|LPTIM1_TR|I2C1_SCL|USART2_CK |TIM2_TR |LPUART1_TX |COMP2_OUT|
  1426. * PA5 |SPI1 |LPTIM1_IN2|TIM2_TR | | |TIM2_C1 | | |
  1427. * PA6 |SPI1 |LPTIM1_ETR| | |LPUART1_CT| |EVENTOUT |COMP1_OUT|
  1428. * PA7 |SPI1 |LPTIM1_OUT| | |USART2_CTS|TIM21_T |EVENTOUT |COMP2_OUT|
  1429. * PA8 |MCO | |LPTIM1_I1|EVENTOUT|USART2_CK |TIM2_C1 | | |
  1430. * PA9 |MCO |I2C1_SCL |LPTIM1_O | |USART2_TX |TIM21_C2| |COMP1_OUT|
  1431. * PA10|TIM21_C1 |I2C1_SDA |RTC_REFIN| |USART2_RX |TIM2_C3 | |COMP1_OUT|
  1432. * PA11|SPI1 |LPTIM1_OUT|EVENTOUT | |USART2_CTS|TIM21_C2| |COMP1_OUT|
  1433. * PA12|SPI1 | |EVENTOUT | |USART2_RTS| | |COMP2_OUT|
  1434. * PA13|SWDIO |LPTIM1_T | |I2C1_SDA| |SPI1 |LPUART1_RX |COMP1_OUT|
  1435. * PA14|SWCLK |LPTIM1_O | |I2C1_SMB|USART2_TX |SPI1 |LPUART1_TX |COMP2_OUT|
  1436. * PA15|SPI1 | |TIM2_TR |EVENTOUT|USART2_RX |TIM2_C1 | | |
  1437. *______________________________________________________________________________________ |
  1438. * PB0 |EVENTOUT |SPI1 |TIM2_C2 | |USART2_RTS|TIM2_C3 | | |
  1439. * PB1 |USART2_CK|SPI1 |LPTIM1_I1| |LPUART1_RT|TIM2_C4 | | |
  1440. * PB2 | | |LPTIM1_O | | | | | |
  1441. * PB3 |SPI1 | |TIM2_C2 | |EVENTOUT | | | |
  1442. * PB4 |SPI1 | |EVENTOUT | | | | | |
  1443. * PB5 |SPI1 | |LPTIM1_I1|I2C1 | |TIM21_C1| | |
  1444. * PB6 |USART2_TX|I2C1_SCL |LPTIM1_T | | |TIM2_C3 |LPUART1_TX | |
  1445. * PB7 |USART2_RX|I2C1 |LPTIM1_I2| | |TIM2_C4 |LPUART1_RX | |
  1446. * PB8 |USART2_TX| |EVENTOUT | |I2C1 |SPI1 | | |
  1447. * PB9 | | | | | | | | |
  1448. *______________________________________________________________________________________ |
  1449. * PC14| | | | | | | | |
  1450. * PC15| | | | | | | | |
  1451. *______________________________________________________________________________________ |
  1452. */
  1453. /** @defgroup GPIOEx_Alternate_function_selection Alternate function selection
  1454. * @{
  1455. */
  1456. /*
  1457. * Alternate function AF0
  1458. */
  1459. #define GPIO_AF0_EVENTOUT ((uint8_t)0x00U) /* EVENTOUT Alternate Function mapping */
  1460. #define GPIO_AF0_TIM21 ((uint8_t)0x00U) /* TIM21 Alternate Function mapping */
  1461. #define GPIO_AF0_SPI1 ((uint8_t)0x00U) /* SPI1 Alternate Function mapping */
  1462. #define GPIO_AF0_USART2 ((uint8_t)0x00U) /* USART2 Alternate Function mapping */
  1463. #define GPIO_AF0_MCO ((uint8_t)0x00U) /* MCO Alternate Function mapping */
  1464. #define GPIO_AF0_SWDIO ((uint8_t)0x00U) /* SWDIO Alternate Function mapping */
  1465. #define GPIO_AF0_SWCLK ((uint8_t)0x00U) /* SWCLK Alternate Function mapping */
  1466. /**
  1467. *
  1468. */
  1469. /*
  1470. * Alternate function AF1
  1471. */
  1472. #define GPIO_AF1_SPI1 ((uint8_t)0x01U) /* SPI1 Alternate Function mapping */
  1473. #define GPIO_AF1_I2C1 ((uint8_t)0x01U) /* I2C1 Alternate Function mapping */
  1474. #define GPIO_AF1_LPTIM1 ((uint8_t)0x01U) /* LPTIM1 Alternate Function mapping */
  1475. /**
  1476. *
  1477. */
  1478. /* Alternate function AF2
  1479. *
  1480. */
  1481. #define GPIO_AF2_LPTIM1 ((uint8_t)0x02U) /* LPTIM1 Alternate Function mapping */
  1482. #define GPIO_AF2_TIM2 ((uint8_t)0x02U) /* TIM2 Alternate Function mapping */
  1483. #define GPIO_AF2_RTC ((uint8_t)0x02U) /* RTC Alternate Function mapping */
  1484. #define GPIO_AF2_EVENTOUT ((uint8_t)0x02U) /* EVENTOUT Alternate Function mapping */
  1485. /**
  1486. *
  1487. */
  1488. /*
  1489. * Alternate function AF3
  1490. */
  1491. #define GPIO_AF3_I2C1 ((uint8_t)0x03U) /* I2C1 Alternate Function mapping */
  1492. #define GPIO_AF3_EVENTOUT ((uint8_t)0x03U) /* EVENTOUT Alternate Function mapping */
  1493. /**
  1494. *
  1495. */
  1496. /*
  1497. * Alternate function AF4
  1498. */
  1499. #define GPIO_AF4_I2C1 ((uint8_t)0x04U) /* I2C1 Alternate Function mapping */
  1500. #define GPIO_AF4_USART2 ((uint8_t)0x04U) /* USART2 Alternate Function mapping */
  1501. #define GPIO_AF4_LPUART1 ((uint8_t)0x04U) /* LPUART1 Alternate Function mapping */
  1502. #define GPIO_AF4_EVENTOUT ((uint8_t)0x04U) /* EVENTOUT Alternate Function mapping */
  1503. /**
  1504. *
  1505. */
  1506. /*
  1507. * Alternate function AF5
  1508. */
  1509. #define GPIO_AF5_TIM2 ((uint8_t)0x05U) /* TIM2 Alternate Function mapping */
  1510. #define GPIO_AF5_TIM21 ((uint8_t)0x05U) /* TIM21 Alternate Function mapping */
  1511. #define GPIO_AF5_SPI1 ((uint8_t)0x05U) /* SPI1 Alternate Function mapping */
  1512. /**
  1513. *
  1514. */
  1515. /*
  1516. * Alternate function AF6
  1517. */
  1518. #define GPIO_AF6_LPUART1 ((uint8_t)0x06U) /* LPUART1 Alternate Function mapping */
  1519. #define GPIO_AF6_EVENTOUT ((uint8_t)0x06U) /* EVENTOUT Alternate Function mapping */
  1520. /**
  1521. *
  1522. */
  1523. /*
  1524. * Alternate function AF7
  1525. */
  1526. #define GPIO_AF7_COMP1 ((uint8_t)0x07U) /* COMP1 Alternate Function mapping */
  1527. #define GPIO_AF7_COMP2 ((uint8_t)0x07U) /* COMP2 Alternate Function mapping */
  1528. /**
  1529. *
  1530. */
  1531. /**
  1532. * @}
  1533. */
  1534. /**
  1535. * @}
  1536. */
  1537. /** @defgroup GPIOEx_Private GPIOEx Private
  1538. * @{
  1539. */
  1540. /**
  1541. * IS_GPIO_AF macro definition
  1542. */
  1543. #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x07)
  1544. /**
  1545. * @}
  1546. */
  1547. #endif /* STM32L011xx/STM32L021xx*/
  1548. /*----------------------------------------------------------------------------*/
  1549. /*----------------------------- STM32L010xB ----------------------------------*/
  1550. /*----------------------------------------------------------------------------*/
  1551. #if defined (STM32L010xB)
  1552. /* The table below gives an overview of the different alternate functions per port.
  1553. * For more details refer yourself to the product data sheet.
  1554. *
  1555. */
  1556. /* | AF0 | AF1 | AF2 | AF3 | AF4 | AF5 | AF6 | AF7 |
  1557. *_______________________________________________________________________________________________|
  1558. * PA0 | | |TIM2_CH1 | |USART2_CTS |TIM2_ETR | | |
  1559. * PA1 |EVENTOUT | |TIM2_CH2 | |USART2_RTS |TIM21_ETR| | |
  1560. * PA2 |TIM21_CH1 | |TIM2_CH3 | |USART2_TX | |LPUART1_TX | |
  1561. * PA3 |TIM21_CH2 | |TIM2_CH4 | |USART2_RX | |LPUART1_RX | |
  1562. * PA4 |SPI1_NSS | | | |USART2_CK |TIM22_ETR| | |
  1563. * PA5 |SPI1_SCK | |TIM2_ETR | | |TIM2_CH1 | | |
  1564. * PA6 |SPI1_MISO | | | |LPUART1_CTS|TIM22_CH1|EVENTOUT | |
  1565. * PA7 |SPI1_MOSI | | | | |TIM22_CH2|EVENTOUT | |
  1566. * PA8 |MCO | | |EVENTOUT | | | | |
  1567. * PA9 |MCO | | | | | |I2C1_SCL | |
  1568. * PA10| | | | | | |I2C1_SDA | |
  1569. * PA11|SPI1_MISO | |EVENTOUT | | | | | |
  1570. * PA12|SPI1_MOSI | |EVENTOUT | | | | | |
  1571. * PA13|SWDIO | | | | | |LPUART1_RX | |
  1572. * PA14|SWCLK | | | |USART2_TX | |LPUART1_TX | |
  1573. * PA15|SPI1_NSS | |TIM2_ETR |EVENTOUT |USART2_RX |TIM2_CH1 | | |
  1574. *_______________________________________________________________________________________________|
  1575. * PB0 |EVENTOUT | | | | | | | |
  1576. * PB1 | | | | |LPUART1_RTS| | | |
  1577. * PB2 | | |LPTIM1_OUT | | | | | |
  1578. * PB3 |SPI1_SCK | |TIM2_CH2 | |EVENTOUT | | | |
  1579. * PB4 |SPI1_MISO | | | |TIM22_CH1 | | | |
  1580. * PB5 |SPI1_MOSI | |LPTIM1_IN1 |I2C1_SMBA|TIM22_CH2 | | | |
  1581. * PB6 | |I2C1_SCL |LPTIM1_ETR | | | | | |
  1582. * PB7 | |I2C1_SDA |LPTIM1_IN2 | | | | | |
  1583. * PB8 | | | | |I2C1_SCL | | | |
  1584. * PB9 | | |EVENTOUT | |I2C1_SDA | | | |
  1585. * PB10| | |TIM2_CH3 | |LPUART1_TX | | |LPUART1_RX|
  1586. * PB11|EVENTOUT | |TIM2_CH4 | |LPUART1_RX | | |LPUART1_TX|
  1587. * PB12| | |LPUART1_RTS| | | |EVENTOUT | |
  1588. * PB13| | |MCO | |LPUART1_CTS| |TIM21_CH1 | |
  1589. * PB14| | |RTC_OUT | |LPUART1_RTS| |TIM21_CH2 | |
  1590. * PB15| | |RTC_REFIN | | | | | |
  1591. *_______________________________________________________________________________________________|
  1592. * PC0 |LPTIM1_IN1 | |EVENTOUT | | | |LPUART1_RX | |
  1593. * PC1 |LPTIM1_OUT | |EVENTOUT | | | |LPUART1_TX | |
  1594. * PC2 |LPTIM1_IN2 | | | | | | | |
  1595. * PC3 |LPTIM1_ETR | | | | | | | |
  1596. * PC4 |EVENTOUT | |LPUART1_TX | | | | | |
  1597. * PC5 | | |LPUART1_RX | | | | | |
  1598. * PC6 |TIM22_CH1 | | | | | | | |
  1599. * PC7 |TIM22_CH2 | | | | | | | |
  1600. * PC8 |TIM22_ETR | | | | | | | |
  1601. * PC9 |TIM21_ETR | | | | | | | |
  1602. * PC10|LPUART1_TX | | | | | | | |
  1603. * PC11|LPUART1_RX | | | | | | | |
  1604. *_______________________________________________________________________________________________|
  1605. * PD2 |LPUART1_RTS| | | | | | | |
  1606. *_______________________________________________________________________________________________|
  1607. */
  1608. /** @defgroup GPIOEx_Alternate_function_selection Alternate function selection
  1609. * @{
  1610. */
  1611. /*
  1612. * Alternate function AF0
  1613. *
  1614. */
  1615. #define GPIO_AF0_EVENTOUT ((uint8_t)0x00U) /* EVENTOUT Alternate Function mapping */
  1616. #define GPIO_AF0_TIM21 ((uint8_t)0x00U) /* TIM21 Alternate Function mapping */
  1617. #define GPIO_AF0_SPI1 ((uint8_t)0x00U) /* SPI1 Alternate Function mapping */
  1618. #define GPIO_AF0_MCO ((uint8_t)0x00U) /* MCO Alternate Function mapping */
  1619. #define GPIO_AF0_SWDIO ((uint8_t)0x00U) /* SWDIO Alternate Function mapping */
  1620. #define GPIO_AF0_SWCLK ((uint8_t)0x00U) /* SWCLK Alternate Function mapping */
  1621. #define GPIO_AF0_LPTIM1 ((uint8_t)0x00U) /* LPTIM1 Alternate Function mapping */
  1622. #define GPIO_AF0_TIM22 ((uint8_t)0x00U) /* TIM22 Alternate Function mapping */
  1623. #define GPIO_AF0_LPUART1 ((uint8_t)0x00U) /* LPUART1 Alternate Function mapping */
  1624. /**
  1625. *
  1626. */
  1627. /*
  1628. * Alternate function AF1
  1629. *
  1630. */
  1631. #define GPIO_AF1_I2C1 ((uint8_t)0x01U) /* I2C1 Alternate Function mapping */
  1632. /**
  1633. *
  1634. */
  1635. /*
  1636. * Alternate function AF2
  1637. *
  1638. */
  1639. #define GPIO_AF2_TIM2 ((uint8_t)0x02U) /* TIM2 Alternate Function mapping */
  1640. #define GPIO_AF2_EVENTOUT ((uint8_t)0x02U) /* EVENTOUT Alternate Function mapping */
  1641. #define GPIO_AF2_LPTIM1 ((uint8_t)0x02U) /* LPTIM1 Alternate Function mapping */
  1642. #define GPIO_AF2_LPUART1 ((uint8_t)0x02U) /* LPUART1 Alternate Function mapping */
  1643. #define GPIO_AF2_MCO ((uint8_t)0x02U) /* MCO Alternate Function mapping */
  1644. #define GPIO_AF2_RTC ((uint8_t)0x02U) /* RTC Alternate Function mapping */
  1645. /**
  1646. *
  1647. */
  1648. /*
  1649. * Alternate function AF3
  1650. * @{
  1651. */
  1652. #define GPIO_AF3_EVENTOUT ((uint8_t)0x03U) /* EVENTOUT Alternate Function mapping */
  1653. #define GPIO_AF3_I2C1 ((uint8_t)0x03U) /* I2C1 Alternate Function mapping */
  1654. /**
  1655. *
  1656. */
  1657. /*
  1658. * Alternate function AF4
  1659. *
  1660. */
  1661. #define GPIO_AF4_USART2 ((uint8_t)0x04U) /* USART2 Alternate Function mapping */
  1662. #define GPIO_AF4_LPUART1 ((uint8_t)0x04U) /* LPUART1 Alternate Function mapping */
  1663. #define GPIO_AF4_EVENTOUT ((uint8_t)0x04U) /* EVENTOUT Alternate Function mapping */
  1664. #define GPIO_AF4_TIM22 ((uint8_t)0x04U) /* TIM22 Alternate Function mapping */
  1665. #define GPIO_AF4_I2C1 ((uint8_t)0x04U) /* I2C1 Alternate Function mapping */
  1666. /**
  1667. *
  1668. */
  1669. /*
  1670. * Alternate function AF5
  1671. *
  1672. */
  1673. #define GPIO_AF5_TIM2 ((uint8_t)0x05U) /* TIM2 Alternate Function mapping */
  1674. #define GPIO_AF5_TIM21 ((uint8_t)0x05U) /* TIM21 Alternate Function mapping */
  1675. #define GPIO_AF5_TIM22 ((uint8_t)0x05U) /* TIM22 Alternate Function mapping */
  1676. /**
  1677. *
  1678. */
  1679. /*
  1680. * Alternate function AF6
  1681. *
  1682. */
  1683. #define GPIO_AF6_LPUART1 ((uint8_t)0x06U) /* LPUART1 Alternate Function mapping */
  1684. #define GPIO_AF6_EVENTOUT ((uint8_t)0x06U) /* EVENTOUT Alternate Function mapping */
  1685. #define GPIO_AF6_I2C1 ((uint8_t)0x06U) /* I2C1 Alternate Function mapping */
  1686. #define GPIO_AF6_TIM21 ((uint8_t)0x06U) /* TIM21 Alternate Function mapping */
  1687. /**
  1688. *
  1689. */
  1690. /*
  1691. * Alternate function AF7
  1692. *
  1693. */
  1694. #define GPIO_AF7_LPUART1 ((uint8_t)0x07U) /* LPUART1 Alternate Function mapping */
  1695. /**
  1696. *
  1697. */
  1698. /**
  1699. * @}
  1700. */
  1701. /**
  1702. * @}
  1703. */
  1704. /** @defgroup GPIOEx_Private GPIOEx Private
  1705. * @{
  1706. */
  1707. /**
  1708. * IS_GPIO_AF macro definition
  1709. */
  1710. #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x07)
  1711. /**
  1712. * @}
  1713. */
  1714. #endif /* STM32L010xB */
  1715. /*----------------------------------------------------------------------------*/
  1716. /*------------------------- STM32L010x8 --------------------------------------*/
  1717. /*----------------------------------------------------------------------------*/
  1718. #if defined (STM32L010x8)
  1719. /* The table below gives an overview of the different alternate functions per port.
  1720. * For more details refer yourself to the product data sheet.
  1721. *
  1722. */
  1723. /* | AF0 | AF1 | AF2 | AF3 | AF4 | AF5 | AF6 |
  1724. *________________________________________________________________________________________________|
  1725. * PA0 | | | TIM2_CH1 | | USART2_CTS | TIM2_ETR | |
  1726. * PA1 | EVENTOUT | | TIM2_CH2 | | USART2_RTS | TIM21_ETR | |
  1727. * PA2 | TIM21_CH1 | | TIM2_CH3 | | USART2_TX | | |
  1728. * PA3 | TIM21_CH2 | | TIM2_CH4 | | USART2_RX | | |
  1729. * PA4 | SPI1_NSS | | | | USART2_CK | | |
  1730. * PA5 | SPI1_SCK | | TIM2_ETR | | | TIM2_CH1 | |
  1731. * PA6 | SPI1_MISO | | | | LPUART1_CTS | | EVENTOUT |
  1732. * PA7 | SPI1_MOSI | | | | | | EVENTOUT |
  1733. * PA8 | MCO | | | EVENTOUT | | | |
  1734. * PA9 | MCO | | | | | | |
  1735. * PA10 | | | | | | | |
  1736. * PA11 | SPI1_MISO | | EVENTOUT | | | | |
  1737. * PA12 | SPI1_MOSI | | EVENTOUT | | | | |
  1738. * PA13 | SWDIO | | | | | | |
  1739. * PA14 | SWCLK | | | | USART2_TX | | |
  1740. * PA15 | SPI1_NSS | | TIM2_ETR | EVENTOUT | USART2_RX | TIM2_CH1 | |
  1741. *________________________________________________________________________________________________|
  1742. * PB0 | EVENTOUT | | | | | | |
  1743. * PB1 | | | | | LPUART1_RTS | | |
  1744. * PB2 | | | LPTIM1_OUT | | | | |
  1745. * PB3 | SPI1_SCK | | TIM2_CH2 | | EVENTOUT | | |
  1746. * PB4 | SPI1_MISO | EVENTOUT | | | | | |
  1747. * PB5 | SPI1_MOSI | LPTIM1_IN1 | I2C1_SMBA | | | | |
  1748. * PB6 | | I2C1_SCL | LPTIM1_ETR | | | | |
  1749. * PB7 | | I2C1_SDA | LPTIM1_IN2 | | | | |
  1750. * PB8 | | | | | I2C1_SCL | | |
  1751. * PB9 | | | EVENTOUT | | I2C1_SDA | | |
  1752. * PB10 | | | TIM2_CH3 | | LPUART1_TX | | |
  1753. * PB11 | EVENTOUT | | TIM2_CH4 | | LPUART1_RX | | |
  1754. * PB12 | | | LPUART1_RTS | | | EVENTOUT | |
  1755. * PB13 | | | | | LPUART1_CTS | | TIM21_CH1 |
  1756. * PB14 | | | RTC_OUT | | LPUART1_RTS | | TIM21_CH2 |
  1757. * PB15 | | | RTC_REFIN | | | | |
  1758. *________________________________________________________________________________________________|
  1759. * PC0 | LPTIM1_IN1 | | EVENTOUT | | | | |
  1760. * PC1 | LPTIM1_OUT | | EVENTOUT | | | | |
  1761. * PC2 | LPTIM1_IN2 | | | | | | |
  1762. * PC3 | LPTIM1_ETR | | | | | | |
  1763. * PC4 | EVENTOUT | | LPUART1_TX | | | | |
  1764. * PC5 | | | LPUART1_RX | | | | |
  1765. * PC9 | TIM21_ETR | | | | | | |
  1766. * PC10 | LPUART1_TX | | | | | | |
  1767. * PC11 | LPUART1_RX | | | | | | |
  1768. * PD2 | LPUART1_RTS | | | | | | |
  1769. *________________________________________________________________________________________________|
  1770. */
  1771. /** @defgroup GPIOEx_Alternate_function_selection Alternate function selection
  1772. * @{
  1773. */
  1774. /*
  1775. * Alternate function AF0
  1776. */
  1777. #define GPIO_AF0_EVENTOUT ((uint8_t)0x00U) /* EVENTOUT Alternate Function mapping */
  1778. #define GPIO_AF0_TIM21 ((uint8_t)0x00U) /* TIM21 Alternate Function mapping */
  1779. #define GPIO_AF0_SPI1 ((uint8_t)0x00U) /* SPI1 Alternate Function mapping */
  1780. #define GPIO_AF0_MCO ((uint8_t)0x00U) /* MCO Alternate Function mapping */
  1781. #define GPIO_AF0_SWDIO ((uint8_t)0x00U) /* SWDIO Alternate Function mapping */
  1782. #define GPIO_AF0_SWCLK ((uint8_t)0x00U) /* SWCLK Alternate Function mapping */
  1783. #define GPIO_AF0_LPTIM1 ((uint8_t)0x00U) /* LPTIM1 Alternate Function mapping */
  1784. #define GPIO_AF0_LPUART1 ((uint8_t)0x00U) /* LPUART1 Alternate Function mapping */
  1785. /**
  1786. *
  1787. */
  1788. /*
  1789. * Alternate function AF1
  1790. */
  1791. #define GPIO_AF1_I2C1 ((uint8_t)0x01U) /* I2C1 Alternate Function mapping */
  1792. /**
  1793. *
  1794. */
  1795. /*
  1796. * Alternate function AF2
  1797. */
  1798. #define GPIO_AF2_TIM2 ((uint8_t)0x02U) /* TIM2 Alternate Function mapping */
  1799. #define GPIO_AF2_EVENTOUT ((uint8_t)0x02U) /* EVENTOUT Alternate Function mapping */
  1800. #define GPIO_AF2_LPTIM1 ((uint8_t)0x02U) /* LPTIM1 Alternate Function mapping */
  1801. #define GPIO_AF2_LPUART1 ((uint8_t)0x02U) /* LPUART1 Alternate Function mapping */
  1802. #define GPIO_AF2_RTC ((uint8_t)0x02U) /* RTC Alternate Function mapping */
  1803. /**
  1804. *
  1805. */
  1806. /*
  1807. * Alternate function AF3
  1808. */
  1809. #define GPIO_AF3_I2C1 ((uint8_t)0x03U) /* I2C1 Alternate Function mapping */
  1810. #define GPIO_AF3_EVENTOUT ((uint8_t)0x03U) /* EVENTOUT Alternate Function mapping */
  1811. /**
  1812. *
  1813. */
  1814. /*
  1815. * Alternate function AF4
  1816. */
  1817. #define GPIO_AF4_USART2 ((uint8_t)0x04U) /* USART2 Alternate Function mapping */
  1818. #define GPIO_AF4_LPUART1 ((uint8_t)0x04U) /* LPUART1 Alternate Function mapping */
  1819. #define GPIO_AF4_I2C1 ((uint8_t)0x04U) /* I2C1 Alternate Function mapping */
  1820. #define GPIO_AF4_EVENTOUT ((uint8_t)0x04U) /* EVENTOUT Alternate Function mapping */
  1821. /**
  1822. *
  1823. */
  1824. /*
  1825. * Alternate function AF5
  1826. */
  1827. #define GPIO_AF5_TIM2 ((uint8_t)0x05U) /* TIM2 Alternate Function mapping */
  1828. /**
  1829. *
  1830. */
  1831. /*
  1832. * Alternate function AF6
  1833. */
  1834. #define GPIO_AF6_TIM21 ((uint8_t)0x06U) /* TIM21 Alternate Function mapping */
  1835. #define GPIO_AF6_EVENTOUT ((uint8_t)0x06U) /* EVENTOUT Alternate Function mapping */
  1836. /**
  1837. *
  1838. */
  1839. /**
  1840. * @}
  1841. */
  1842. /**
  1843. * @}
  1844. */
  1845. /** @defgroup GPIOEx_Private GPIOEx Private
  1846. * @{
  1847. */
  1848. /**
  1849. * @brief IS_GPIO_AF macro definition
  1850. */
  1851. #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x06)
  1852. /**
  1853. * @}
  1854. */
  1855. #endif /* STM32L010x8 */
  1856. /*----------------------------------------------------------------------------*/
  1857. /*------------------------- STM32L010x6 --------------------------------------*/
  1858. /*----------------------------------------------------------------------------*/
  1859. #if defined (STM32L010x6)
  1860. /* The table below gives an overview of the different alternate functions per port.
  1861. * For more details refer yourself to the product data sheet.
  1862. *
  1863. */
  1864. /* | AF0 | AF1 | AF2 | AF3 | AF4 | AF5 | AF6 |
  1865. *__________________________________________________________________________________________________|
  1866. * PA1 | EVENTOUT | LPTIM1_IN2 | TIM2_CH2 | I2C1_SMBA | USART2_RTS | TIM21_ETR | |
  1867. * PA2 | TIM21_CH1 | | TIM2_CH3 | | USART2_TX | | LPUART1_TX |
  1868. * PA3 | TIM21_CH2 | | TIM2_CH4 | | USART2_RX | | LPUART1_RX |
  1869. * PA4 | SPI1_NSS | LPTIM1_IN1 | | | USART2_CK | | |
  1870. * PA5 | SPI1_SCK | LPTIM1_IN2 | TIM2_ETR | | | TIM2_CH1 | |
  1871. * PA6 | SPI1_MISO | LPTIM1_ETR | | | LPUART1_CTS | | EVENTOUT |
  1872. * PA7 | SPI1_MOSI | LPTIM1_OUT | | | USART2_CTS | | EVENTOUT |
  1873. * PA8 | MCO | | LPTIM1_IN1 | EVENTOUT | USART2_CK | TIM2_CH1 | |
  1874. * PA9 | MCO | I2C1_SCL | | | USART2_TX | | |
  1875. * PA10 | | I2C1_SDA | | | USART2_RX | | |
  1876. * PA11 | SPI1_MISO | | EVENTOUT | | USART2_CTS | TIM21_CH2 | |
  1877. * PA12 | SPI1_MOSI | | EVENTOUT | | USART2_RTS | | |
  1878. * PA13 | SWDIO | LPTIM1_ETR | | | | | LPUART1_RX |
  1879. * PA14 | SWCLK | LPTIM1_OUT | | I2C1_SMBA | USART2_TX | | LPUART1_TX |
  1880. * PA15 | SPI1_NSS | | TIM2_ETR | EVENTOUT | USART2_RX | TIM2_CH1 | |
  1881. *__________________________________________________________________________________________________|
  1882. * PB0 | EVENTOUT | SPI1_MISO | | | USART2_RTS | TIM2_CH3 | |
  1883. * PB1 | USART2_CK | SPI1_MOSI | | | LPUART1_RTS | TIM2_CH4 | |
  1884. * PB2 | | | LPTIM1_OUT | | | | |
  1885. * PB3 | SPI1_SCK | | TIM2_CH2 | | EVENTOUT | | |
  1886. * PB4 | SPI1_MISO | | EVENTOUT | | | | |
  1887. * PB5 | SPI1_MOSI | LPTIM1_IN1 | I2C1_SMBA | | | | |
  1888. * PB6 | USART2_TX | I2C1_SCL | LPTIM1_ETR | | | TIM21_CH1 | |
  1889. * PB7 | USART2_RX | I2C1_SDA | LPTIM1_IN2 | | | | |
  1890. * PB8 | | | | | I2C1_SCL | | |
  1891. * PB9 | | | EVENTOUT | | I2C1_SDA | | |
  1892. * PB10 | | | TIM2_CH3 | | | | LPUART1_TX |
  1893. * PB11 | EVENTOUT | | TIM2_CH4 | | | | LPUART1_RX |
  1894. * PB12 | SPI1_NSS | | | | | | EVENTOUT |
  1895. * PB13 | SPI1_SCK | | MCO | | | TIM21_CH1 | LPUART1_CTS|
  1896. * PB14 | SPI1_MISO | | RTC_OUT | | | TIM21_CH2 | LPUART1_RTS|
  1897. * PB15 | SPI1_MOSI | | RTC_REFIN | | | | |
  1898. *__________________________________________________________________________________________________|
  1899. * PC0 | LPTIM1_IN1 | | EVENTOUT | | | | LPUART1_RX |
  1900. *__________________________________________________________________________________________________|
  1901. */
  1902. /** @defgroup GPIOEx_Alternate_function_selection Alternate function selection
  1903. * @{
  1904. */
  1905. /*
  1906. * Alternate function AF0
  1907. */
  1908. #define GPIO_AF0_EVENTOUT ((uint8_t)0x00U) /* EVENTOUT Alternate Function mapping */
  1909. #define GPIO_AF0_TIM21 ((uint8_t)0x00U) /* TIM21 Alternate Function mapping */
  1910. #define GPIO_AF0_SPI1 ((uint8_t)0x00U) /* SPI1 Alternate Function mapping */
  1911. #define GPIO_AF0_MCO ((uint8_t)0x00U) /* MCO Alternate Function mapping */
  1912. #define GPIO_AF0_SWDIO ((uint8_t)0x00U) /* SWDIO Alternate Function mapping */
  1913. #define GPIO_AF0_SWCLK ((uint8_t)0x00U) /* SWCLK Alternate Function mapping */
  1914. #define GPIO_AF0_USART2 ((uint8_t)0x00U) /* USART2 Alternate Function mapping */
  1915. #define GPIO_AF0_LPTIM1 ((uint8_t)0x00U) /* LPTIM1 Alternate Function mapping */
  1916. /**
  1917. *
  1918. */
  1919. /*
  1920. * Alternate function AF1
  1921. */
  1922. #define GPIO_AF1_I2C1 ((uint8_t)0x01U) /* I2C1 Alternate Function mapping */
  1923. #define GPIO_AF1_LPTIM1 ((uint8_t)0x01U) /* LPTIM1 Alternate Function mapping */
  1924. /**
  1925. *
  1926. */
  1927. /*
  1928. * Alternate function AF2
  1929. */
  1930. #define GPIO_AF2_LPTIM1 ((uint8_t)0x02U) /* LPTIM1 Alternate Function mapping */
  1931. #define GPIO_AF2_TIM2 ((uint8_t)0x02U) /* TIM2 Alternate Function mapping */
  1932. #define GPIO_AF2_MCO ((uint8_t)0x02U) /* MCO Alternate Function mapping */
  1933. #define GPIO_AF2_I2C1 ((uint8_t)0x02U) /* I2C1 Alternate Function mapping */
  1934. #define GPIO_AF2_EVENTOUT ((uint8_t)0x02U) /* EVENTOUT Alternate Function mapping */
  1935. #define GPIO_AF2_RTC ((uint8_t)0x02U) /* RTC Alternate Function mapping */
  1936. /**
  1937. *
  1938. */
  1939. /*
  1940. * Alternate function AF3
  1941. */
  1942. #define GPIO_AF3_I2C1 ((uint8_t)0x03U) /* I2C1 Alternate Function mapping */
  1943. #define GPIO_AF3_EVENTOUT ((uint8_t)0x03U) /* EVENTOUT Alternate Function mapping */
  1944. /**
  1945. *
  1946. */
  1947. /*
  1948. * Alternate function AF4
  1949. */
  1950. #define GPIO_AF4_USART2 ((uint8_t)0x04U) /* USART2 Alternate Function mapping */
  1951. #define GPIO_AF4_LPUART1 ((uint8_t)0x04U) /* LPUART1 Alternate Function mapping */
  1952. #define GPIO_AF4_I2C1 ((uint8_t)0x04U) /* I2C1 Alternate Function mapping */
  1953. #define GPIO_AF4_EVENTOUT ((uint8_t)0x04U) /* EVENTOUT Alternate Function mapping */
  1954. /**
  1955. *
  1956. */
  1957. /*
  1958. * Alternate function AF5
  1959. */
  1960. #define GPIO_AF5_TIM2 ((uint8_t)0x05U) /* TIM2 Alternate Function mapping */
  1961. #define GPIO_AF5_TIM21 ((uint8_t)0x05U) /* TIM21 Alternate Function mapping */
  1962. /**
  1963. *
  1964. */
  1965. /*
  1966. * Alternate function AF6
  1967. */
  1968. #define GPIO_AF6_LPUART1 ((uint8_t)0x06U) /* LPUART1 Alternate Function mapping */
  1969. #define GPIO_AF6_EVENTOUT ((uint8_t)0x06U) /* EVENTOUT Alternate Function mapping */
  1970. /**
  1971. *
  1972. */
  1973. /*
  1974. * Alternate function AF7
  1975. */
  1976. #define GPIO_AF7_COMP1 ((uint8_t)0x07U) /* COMP1 Alternate Function mapping */
  1977. #define GPIO_AF7_COMP2 ((uint8_t)0x07U) /* COMP2 Alternate Function mapping */
  1978. /**
  1979. *
  1980. */
  1981. /**
  1982. * @}
  1983. */
  1984. /**
  1985. * @}
  1986. */
  1987. /** @defgroup GPIOEx_Private GPIOEx Private
  1988. * @{
  1989. */
  1990. /**
  1991. * @brief IS_GPIO_AF macro definition
  1992. */
  1993. #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x06)
  1994. /**
  1995. * @}
  1996. */
  1997. #endif /* STM32L010x6 */
  1998. /*----------------------------------------------------------------------------*/
  1999. /*------------------------- STM32L010x4 --------------------------------------*/
  2000. /*----------------------------------------------------------------------------*/
  2001. #if defined (STM32L010x4)
  2002. /* The table below gives an overview of the different alternate functions per port.
  2003. * For more details refer yourself to the product data sheet.
  2004. *
  2005. */
  2006. /* | AF0 | AF1 | AF2 | AF3 | AF4 | AF5 | AF6 |
  2007. *_______________________________________________________________________ _________________________|
  2008. * PA0 | USART2_RX | LPTIM1_IN1 | TIM2_CH1 | | USART2_CTS | TIM2_ETR | LPUART1_RX |
  2009. * PA1 | EVENTOUT | LPTIM1_IN2 | TIM2_CH2 | I2C1_SMBA | USART2_RTS | TIM21_ETR | LPUART1_TX |
  2010. * PA2 | TIM21_CH1 | | TIM2_CH3 | | USART2_TX | | LPUART1_TX |
  2011. * PA3 | TIM21_CH2 | | TIM2_CH4 | | USART2_RX | | LPUART1_RX |
  2012. * PA4 | SPI1_NSS | LPTIM1_IN1 | LPTIM1_ETR | I2C1_SCL | USART2_CK | TIM2_ETR | LPUART1_TX |
  2013. * PA5 | SPI1_SCK | LPTIM1_IN2 | TIM2_ETR | | | TIM2_CH1 | |
  2014. * PA6 | SPI1_MISO | LPTIM1_ETR | | LPUART1_CTS | | EVENTOUT | |
  2015. * PA7 | SPI1_MOSI | LPTIM1_OUT | | USART2_CTS | TIM21_ETR | EVENTOUT | |
  2016. * PA8 | MCO | | LPTIM1_IN1 | EVENTOUT | USART2_CK | TIM2_CH1 | |
  2017. * PA9 | MCO | I2C1_SCL | LPTIM1_OUT | | USART2_TX | TIM21_CH2 | |
  2018. * PA10 | TIM21_CH1 | I2C1_SDA | RTC_REFIN | | USART2_RX | TIM2_CH3 | |
  2019. * PA11 | SPI1_MISO | LPTIM1_OUT | EVENTOUT | | USART2_CTS | TIM21_CH2 | |
  2020. * PA12 | SPI1_MOSI | | EVENTOUT | | USART2_RTS | | |
  2021. * PA13 | SWDIO | LPTIM1_ETR | | I2C1_SDA | | SPI1_SCK | LPUART1_RX |
  2022. * PA14 | SWCLK | LPTIM1_OUT | | I2C1_SMBA | USART2_TX | SPI1_MISO | LPUART1_TX |
  2023. * PA15 | SPI1_NSS | | TIM2_ETR | EVENTOUT | USART2_RX | TIM2_CH1 | |
  2024. *_________________________________________________________________________________________________|
  2025. * PB0 | EVENTOUT | SPI1_MISO | TIM2_CH2 | | USART2_RTS | TIM2_CH3 | |
  2026. * PB1 | USART2_CK | SPI1_MOSI | LPTIM1_IN1 | | LPUART1_RTS | TIM2_CH4 | |
  2027. * PB3 | SPI1_SCK | | TIM2_CH2 | | EVENTOUT | | |
  2028. * PB4 | SPI1_MISO | | EVENTOUT | | | | |
  2029. * PB5 | SPI1_MOSI | | LPTIM1_IN1 | I2C1_SMBA | | TIM21_CH1 | |
  2030. * PB6 | USART2_TX | I2C1_SCL | LPTIM1_ETR | | | TIM2_CH3 | LPUART1_TX |
  2031. * PB7 | USART2_RX | I2C1_SDA | LPTIM1_IN2 | | | TIM2_CH4 | LPUART1_RX |
  2032. *_________________________________________________________________________________________________|
  2033. */
  2034. /** @defgroup GPIOEx_Alternate_function_selection Alternate function selection
  2035. * @{
  2036. */
  2037. /*
  2038. * Alternate function AF0
  2039. */
  2040. #define GPIO_AF0_USART2 ((uint8_t)0x00U) /* USART2 Alternate Function mapping */
  2041. #define GPIO_AF0_EVENTOUT ((uint8_t)0x00U) /* EVENTOUT Alternate Function mapping */
  2042. #define GPIO_AF0_TIM21 ((uint8_t)0x00U) /* TIM21 Alternate Function mapping */
  2043. #define GPIO_AF0_SPI1 ((uint8_t)0x00U) /* SPI1 Alternate Function mapping */
  2044. #define GPIO_AF0_MCO ((uint8_t)0x00U) /* MCO Alternate Function mapping */
  2045. #define GPIO_AF0_SWDIO ((uint8_t)0x00U) /* SWDIO Alternate Function mapping */
  2046. #define GPIO_AF0_SWCLK ((uint8_t)0x00U) /* SWCLK Alternate Function mapping */
  2047. /**
  2048. *
  2049. */
  2050. /*
  2051. * Alternate function AF1
  2052. */
  2053. #define GPIO_AF1_SPI1 ((uint8_t)0x01U) /* SPI1 Alternate Function mapping */
  2054. #define GPIO_AF1_I2C1 ((uint8_t)0x01U) /* I2C1 Alternate Function mapping */
  2055. #define GPIO_AF1_LPTIM1 ((uint8_t)0x01U) /* LPTIM1 Alternate Function mapping */
  2056. /**
  2057. *
  2058. */
  2059. /* Alternate function AF2
  2060. *
  2061. */
  2062. #define GPIO_AF2_LPTIM1 ((uint8_t)0x02U) /* LPTIM1 Alternate Function mapping */
  2063. #define GPIO_AF2_TIM2 ((uint8_t)0x02U) /* TIM2 Alternate Function mapping */
  2064. #define GPIO_AF2_RTC ((uint8_t)0x02U) /* RTC Alternate Function mapping */
  2065. #define GPIO_AF2_EVENTOUT ((uint8_t)0x02U) /* EVENTOUT Alternate Function mapping */
  2066. /**
  2067. *
  2068. */
  2069. /*
  2070. * Alternate function AF3
  2071. */
  2072. #define GPIO_AF3_I2C1 ((uint8_t)0x03U) /* I2C1 Alternate Function mapping */
  2073. #define GPIO_AF3_EVENTOUT ((uint8_t)0x03U) /* EVENTOUT Alternate Function mapping */
  2074. #define GPIO_AF3_LPUART1 ((uint8_t)0x03U) /* LPUART1 Alternate Function mapping */
  2075. #define GPIO_AF3_USART2 ((uint8_t)0x03U) /* USART2 Alternate Function mapping */
  2076. /**
  2077. *
  2078. */
  2079. /*
  2080. * Alternate function AF4
  2081. */
  2082. #define GPIO_AF4_USART2 ((uint8_t)0x04U) /* USART2 Alternate Function mapping */
  2083. #define GPIO_AF4_TIM21 ((uint8_t)0x04U) /* TIM21 Alternate Function mapping */
  2084. #define GPIO_AF4_LPUART1 ((uint8_t)0x04U) /* LPUART1 Alternate Function mapping */
  2085. #define GPIO_AF4_EVENTOUT ((uint8_t)0x04U) /* EVENTOUT Alternate Function mapping */
  2086. /**
  2087. *
  2088. */
  2089. /*
  2090. * Alternate function AF5
  2091. */
  2092. #define GPIO_AF5_TIM2 ((uint8_t)0x05U) /* TIM2 Alternate Function mapping */
  2093. #define GPIO_AF5_TIM21 ((uint8_t)0x05U) /* TIM21 Alternate Function mapping */
  2094. #define GPIO_AF5_SPI1 ((uint8_t)0x05U) /* SPI1 Alternate Function mapping */
  2095. #define GPIO_AF5_EVENTOUT ((uint8_t)0x05U) /* EVENTOUT Alternate Function mapping */
  2096. /**
  2097. *
  2098. */
  2099. /*
  2100. * Alternate function AF6
  2101. */
  2102. #define GPIO_AF6_LPUART1 ((uint8_t)0x06U) /* LPUART1 Alternate Function mapping */
  2103. /**
  2104. *
  2105. */
  2106. /**
  2107. * @}
  2108. */
  2109. /**
  2110. * @}
  2111. */
  2112. /** @defgroup GPIOEx_Private GPIOEx Private
  2113. * @{
  2114. */
  2115. /**
  2116. * IS_GPIO_AF macro definition
  2117. */
  2118. #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x06)
  2119. /**
  2120. * @}
  2121. */
  2122. #endif /* STM32L010x4*/
  2123. #if defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \
  2124. defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx) || \
  2125. defined (STM32L010xB)
  2126. /** @addtogroup GPIOEx_Exported_Constants
  2127. * @{
  2128. */
  2129. /** @defgroup GPIOEx_Pin_Available Pin available
  2130. * @{
  2131. */
  2132. #define GPIOA_PIN_AVAILABLE GPIO_PIN_All
  2133. #define GPIOB_PIN_AVAILABLE GPIO_PIN_All
  2134. #define GPIOC_PIN_AVAILABLE GPIO_PIN_All
  2135. #define GPIOD_PIN_AVAILABLE GPIO_PIN_All
  2136. #define GPIOE_PIN_AVAILABLE GPIO_PIN_All
  2137. #define GPIOH_PIN_AVAILABLE (GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_9 | GPIO_PIN_10)
  2138. /**
  2139. * @}
  2140. */
  2141. /**
  2142. * @}
  2143. */
  2144. /** @addtogroup GPIOEx_Private
  2145. * @{
  2146. */
  2147. #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
  2148. ((__GPIOx__) == (GPIOB))? 1U :\
  2149. ((__GPIOx__) == (GPIOC))? 2U :\
  2150. ((__GPIOx__) == (GPIOD))? 3U :\
  2151. ((__GPIOx__) == (GPIOE))? 4U :\
  2152. ((__GPIOx__) == (GPIOH))? 5U : 6U)
  2153. #define IS_GPIO_PIN_AVAILABLE(__INSTANCE__,__PIN__) \
  2154. ((((__INSTANCE__) == GPIOA) && (((__PIN__) & (GPIOA_PIN_AVAILABLE)) != 0U) && (((__PIN__) | (GPIOA_PIN_AVAILABLE)) == (GPIOA_PIN_AVAILABLE))) || \
  2155. (((__INSTANCE__) == GPIOB) && (((__PIN__) & (GPIOB_PIN_AVAILABLE)) != 0U) && (((__PIN__) | (GPIOB_PIN_AVAILABLE)) == (GPIOB_PIN_AVAILABLE))) || \
  2156. (((__INSTANCE__) == GPIOC) && (((__PIN__) & (GPIOC_PIN_AVAILABLE)) != 0U) && (((__PIN__) | (GPIOC_PIN_AVAILABLE)) == (GPIOC_PIN_AVAILABLE))) || \
  2157. (((__INSTANCE__) == GPIOD) && (((__PIN__) & (GPIOD_PIN_AVAILABLE)) != 0U) && (((__PIN__) | (GPIOD_PIN_AVAILABLE)) == (GPIOD_PIN_AVAILABLE))) || \
  2158. (((__INSTANCE__) == GPIOE) && (((__PIN__) & (GPIOE_PIN_AVAILABLE)) != 0U) && (((__PIN__) | (GPIOE_PIN_AVAILABLE)) == (GPIOE_PIN_AVAILABLE))) || \
  2159. (((__INSTANCE__) == GPIOH) && (((__PIN__) & (GPIOH_PIN_AVAILABLE)) != 0U) && (((__PIN__) | (GPIOH_PIN_AVAILABLE)) == (GPIOH_PIN_AVAILABLE))))
  2160. /**
  2161. * @}
  2162. */
  2163. #elif defined (STM32L031xx) || defined (STM32L041xx) || defined (STM32L010x6)
  2164. /** @addtogroup GPIOEx_Exported_Constants
  2165. * @{
  2166. */
  2167. /** @defgroup GPIOEx_Pin_Available Pin available
  2168. * @{
  2169. */
  2170. #define GPIOA_PIN_AVAILABLE GPIO_PIN_All
  2171. #define GPIOB_PIN_AVAILABLE GPIO_PIN_All
  2172. #define GPIOC_PIN_AVAILABLE (GPIO_PIN_0 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15)
  2173. #define GPIOH_PIN_AVAILABLE (GPIO_PIN_0 | GPIO_PIN_1)
  2174. /**
  2175. * @}
  2176. */
  2177. /**
  2178. * @}
  2179. */
  2180. /** @addtogroup GPIOEx_Private
  2181. * @{
  2182. */
  2183. #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
  2184. ((__GPIOx__) == (GPIOB))? 1U :\
  2185. ((__GPIOx__) == (GPIOC))? 2U :\
  2186. ((__GPIOx__) == (GPIOH))? 5U : 6U)
  2187. #define IS_GPIO_PIN_AVAILABLE(__INSTANCE__,__PIN__) \
  2188. ((((__INSTANCE__) == GPIOA) && (((__PIN__) & (GPIOA_PIN_AVAILABLE)) != 0U) && (((__PIN__) | (GPIOA_PIN_AVAILABLE)) == (GPIOA_PIN_AVAILABLE))) || \
  2189. (((__INSTANCE__) == GPIOB) && (((__PIN__) & (GPIOB_PIN_AVAILABLE)) != 0U) && (((__PIN__) | (GPIOB_PIN_AVAILABLE)) == (GPIOB_PIN_AVAILABLE))) || \
  2190. (((__INSTANCE__) == GPIOC) && (((__PIN__) & (GPIOC_PIN_AVAILABLE)) != 0U) && (((__PIN__) | (GPIOC_PIN_AVAILABLE)) == (GPIOC_PIN_AVAILABLE))) || \
  2191. (((__INSTANCE__) == GPIOH) && (((__PIN__) & (GPIOH_PIN_AVAILABLE)) != 0U) && (((__PIN__) | (GPIOH_PIN_AVAILABLE)) == (GPIOH_PIN_AVAILABLE))))
  2192. /**
  2193. * @}
  2194. */
  2195. #elif defined (STM32L011xx) || defined (STM32L021xx) || defined (STM32L010x4)
  2196. /** @addtogroup GPIOEx_Exported_Constants
  2197. * @{
  2198. */
  2199. /** @defgroup GPIOEx_Pin_Available Pin available
  2200. * @{
  2201. */
  2202. #define GPIOA_PIN_AVAILABLE GPIO_PIN_All
  2203. #define GPIOB_PIN_AVAILABLE (GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | \
  2204. GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9 )
  2205. #define GPIOC_PIN_AVAILABLE (GPIO_PIN_14 | GPIO_PIN_15)
  2206. /**
  2207. * @}
  2208. */
  2209. /**
  2210. * @}
  2211. */
  2212. /** @addtogroup GPIOEx_Private
  2213. * @{
  2214. */
  2215. #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
  2216. ((__GPIOx__) == (GPIOB))? 1U :\
  2217. ((__GPIOx__) == (GPIOC))? 2U : 6U)
  2218. #define IS_GPIO_PIN_AVAILABLE(__INSTANCE__,__PIN__) \
  2219. ((((__INSTANCE__) == GPIOA) && (((__PIN__) & (GPIOA_PIN_AVAILABLE)) != 0U) && (((__PIN__) | (GPIOA_PIN_AVAILABLE)) == (GPIOA_PIN_AVAILABLE))) || \
  2220. (((__INSTANCE__) == GPIOB) && (((__PIN__) & (GPIOB_PIN_AVAILABLE)) != 0U) && (((__PIN__) | (GPIOB_PIN_AVAILABLE)) == (GPIOB_PIN_AVAILABLE))) || \
  2221. (((__INSTANCE__) == GPIOC) && (((__PIN__) & (GPIOC_PIN_AVAILABLE)) != 0U) && (((__PIN__) | (GPIOC_PIN_AVAILABLE)) == (GPIOC_PIN_AVAILABLE))))
  2222. /**
  2223. * @}
  2224. */
  2225. #elif defined (STM32L063xx) || defined (STM32L062xx) || defined (STM32L061xx) || \
  2226. defined (STM32L053xx) || defined (STM32L052xx) || defined (STM32L051xx) || \
  2227. defined (STM32L010x8)
  2228. /** @addtogroup GPIOEx_Exported_Constants
  2229. * @{
  2230. */
  2231. /** @defgroup GPIOEx_Pin_Available Pin available
  2232. * @{
  2233. */
  2234. #define GPIOA_PIN_AVAILABLE GPIO_PIN_All
  2235. #define GPIOB_PIN_AVAILABLE GPIO_PIN_All
  2236. #define GPIOC_PIN_AVAILABLE GPIO_PIN_All
  2237. #define GPIOD_PIN_AVAILABLE GPIO_PIN_2
  2238. #define GPIOH_PIN_AVAILABLE GPIO_PIN_0 | GPIO_PIN_1
  2239. /**
  2240. * @}
  2241. */
  2242. /**
  2243. * @}
  2244. */
  2245. /** @addtogroup GPIOEx_Private
  2246. * @{
  2247. */
  2248. #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
  2249. ((__GPIOx__) == (GPIOB))? 1U :\
  2250. ((__GPIOx__) == (GPIOC))? 2U :\
  2251. ((__GPIOx__) == (GPIOD))? 3U :\
  2252. ((__GPIOx__) == (GPIOH))? 5U : 6U)
  2253. #define IS_GPIO_PIN_AVAILABLE(__INSTANCE__,__PIN__) \
  2254. ((((__INSTANCE__) == GPIOA) && (((__PIN__) & (GPIOA_PIN_AVAILABLE)) != 0U) && (((__PIN__) | (GPIOA_PIN_AVAILABLE)) == (GPIOA_PIN_AVAILABLE))) || \
  2255. (((__INSTANCE__) == GPIOB) && (((__PIN__) & (GPIOB_PIN_AVAILABLE)) != 0U) && (((__PIN__) | (GPIOB_PIN_AVAILABLE)) == (GPIOB_PIN_AVAILABLE))) || \
  2256. (((__INSTANCE__) == GPIOC) && (((__PIN__) & (GPIOC_PIN_AVAILABLE)) != 0U) && (((__PIN__) | (GPIOC_PIN_AVAILABLE)) == (GPIOC_PIN_AVAILABLE))) || \
  2257. (((__INSTANCE__) == GPIOD) && (((__PIN__) & (GPIOD_PIN_AVAILABLE)) != 0U) && (((__PIN__) | (GPIOD_PIN_AVAILABLE)) == (GPIOD_PIN_AVAILABLE))) || \
  2258. (((__INSTANCE__) == GPIOH) && (((__PIN__) & (GPIOH_PIN_AVAILABLE)) != 0U) && (((__PIN__) | (GPIOH_PIN_AVAILABLE)) == (GPIOH_PIN_AVAILABLE))))
  2259. /**
  2260. * @}
  2261. */
  2262. #endif /* STM32L083xx || STM32L082xx || STM32L081xx || STM32L073xx || STM32L072xx || STM32L071xx*/
  2263. /**
  2264. * @}
  2265. */
  2266. /**
  2267. * @}
  2268. */
  2269. #ifdef __cplusplus
  2270. }
  2271. #endif
  2272. #endif /* __STM32L0xx_HAL_GPIO_EX_H */
  2273. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/