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.
 
 
 

956 lines
36 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32f0xx_ll_gpio.h
  4. * @author MCD Application Team
  5. * @brief Header file of GPIO LL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
  10. *
  11. * Redistribution and use in source and binary forms, with or without modification,
  12. * are permitted provided that the following conditions are met:
  13. * 1. Redistributions of source code must retain the above copyright notice,
  14. * this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  19. * may be used to endorse or promote products derived from this software
  20. * without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  23. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  25. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  26. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  28. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  29. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  30. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. *
  33. ******************************************************************************
  34. */
  35. /* Define to prevent recursive inclusion -------------------------------------*/
  36. #ifndef __STM32F0xx_LL_GPIO_H
  37. #define __STM32F0xx_LL_GPIO_H
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. /* Includes ------------------------------------------------------------------*/
  42. #include "stm32f0xx.h"
  43. /** @addtogroup STM32F0xx_LL_Driver
  44. * @{
  45. */
  46. #if defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOF)
  47. /** @defgroup GPIO_LL GPIO
  48. * @{
  49. */
  50. /* Private types -------------------------------------------------------------*/
  51. /* Private variables ---------------------------------------------------------*/
  52. /* Private constants ---------------------------------------------------------*/
  53. /* Private macros ------------------------------------------------------------*/
  54. #if defined(USE_FULL_LL_DRIVER)
  55. /** @defgroup GPIO_LL_Private_Macros GPIO Private Macros
  56. * @{
  57. */
  58. /**
  59. * @}
  60. */
  61. #endif /*USE_FULL_LL_DRIVER*/
  62. /* Exported types ------------------------------------------------------------*/
  63. #if defined(USE_FULL_LL_DRIVER)
  64. /** @defgroup GPIO_LL_ES_INIT GPIO Exported Init structures
  65. * @{
  66. */
  67. /**
  68. * @brief LL GPIO Init Structure definition
  69. */
  70. typedef struct
  71. {
  72. uint32_t Pin; /*!< Specifies the GPIO pins to be configured.
  73. This parameter can be any value of @ref GPIO_LL_EC_PIN */
  74. uint32_t Mode; /*!< Specifies the operating mode for the selected pins.
  75. This parameter can be a value of @ref GPIO_LL_EC_MODE.
  76. GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinMode().*/
  77. uint32_t Speed; /*!< Specifies the speed for the selected pins.
  78. This parameter can be a value of @ref GPIO_LL_EC_SPEED.
  79. GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinSpeed().*/
  80. uint32_t OutputType; /*!< Specifies the operating output type for the selected pins.
  81. This parameter can be a value of @ref GPIO_LL_EC_OUTPUT.
  82. GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinOutputType().*/
  83. uint32_t Pull; /*!< Specifies the operating Pull-up/Pull down for the selected pins.
  84. This parameter can be a value of @ref GPIO_LL_EC_PULL.
  85. GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinPull().*/
  86. uint32_t Alternate; /*!< Specifies the Peripheral to be connected to the selected pins.
  87. This parameter can be a value of @ref GPIO_LL_EC_AF.
  88. GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetAFPin_0_7() and LL_GPIO_SetAFPin_8_15().*/
  89. } LL_GPIO_InitTypeDef;
  90. /**
  91. * @}
  92. */
  93. #endif /* USE_FULL_LL_DRIVER */
  94. /* Exported constants --------------------------------------------------------*/
  95. /** @defgroup GPIO_LL_Exported_Constants GPIO Exported Constants
  96. * @{
  97. */
  98. /** @defgroup GPIO_LL_EC_PIN PIN
  99. * @{
  100. */
  101. #define LL_GPIO_PIN_0 GPIO_BSRR_BS_0 /*!< Select pin 0 */
  102. #define LL_GPIO_PIN_1 GPIO_BSRR_BS_1 /*!< Select pin 1 */
  103. #define LL_GPIO_PIN_2 GPIO_BSRR_BS_2 /*!< Select pin 2 */
  104. #define LL_GPIO_PIN_3 GPIO_BSRR_BS_3 /*!< Select pin 3 */
  105. #define LL_GPIO_PIN_4 GPIO_BSRR_BS_4 /*!< Select pin 4 */
  106. #define LL_GPIO_PIN_5 GPIO_BSRR_BS_5 /*!< Select pin 5 */
  107. #define LL_GPIO_PIN_6 GPIO_BSRR_BS_6 /*!< Select pin 6 */
  108. #define LL_GPIO_PIN_7 GPIO_BSRR_BS_7 /*!< Select pin 7 */
  109. #define LL_GPIO_PIN_8 GPIO_BSRR_BS_8 /*!< Select pin 8 */
  110. #define LL_GPIO_PIN_9 GPIO_BSRR_BS_9 /*!< Select pin 9 */
  111. #define LL_GPIO_PIN_10 GPIO_BSRR_BS_10 /*!< Select pin 10 */
  112. #define LL_GPIO_PIN_11 GPIO_BSRR_BS_11 /*!< Select pin 11 */
  113. #define LL_GPIO_PIN_12 GPIO_BSRR_BS_12 /*!< Select pin 12 */
  114. #define LL_GPIO_PIN_13 GPIO_BSRR_BS_13 /*!< Select pin 13 */
  115. #define LL_GPIO_PIN_14 GPIO_BSRR_BS_14 /*!< Select pin 14 */
  116. #define LL_GPIO_PIN_15 GPIO_BSRR_BS_15 /*!< Select pin 15 */
  117. #define LL_GPIO_PIN_ALL (GPIO_BSRR_BS_0 | GPIO_BSRR_BS_1 | GPIO_BSRR_BS_2 | \
  118. GPIO_BSRR_BS_3 | GPIO_BSRR_BS_4 | GPIO_BSRR_BS_5 | \
  119. GPIO_BSRR_BS_6 | GPIO_BSRR_BS_7 | GPIO_BSRR_BS_8 | \
  120. GPIO_BSRR_BS_9 | GPIO_BSRR_BS_10 | GPIO_BSRR_BS_11 | \
  121. GPIO_BSRR_BS_12 | GPIO_BSRR_BS_13 | GPIO_BSRR_BS_14 | \
  122. GPIO_BSRR_BS_15) /*!< Select all pins */
  123. /**
  124. * @}
  125. */
  126. /** @defgroup GPIO_LL_EC_MODE Mode
  127. * @{
  128. */
  129. #define LL_GPIO_MODE_INPUT (0x00000000U) /*!< Select input mode */
  130. #define LL_GPIO_MODE_OUTPUT GPIO_MODER_MODER0_0 /*!< Select output mode */
  131. #define LL_GPIO_MODE_ALTERNATE GPIO_MODER_MODER0_1 /*!< Select alternate function mode */
  132. #define LL_GPIO_MODE_ANALOG GPIO_MODER_MODER0 /*!< Select analog mode */
  133. /**
  134. * @}
  135. */
  136. /** @defgroup GPIO_LL_EC_OUTPUT Output Type
  137. * @{
  138. */
  139. #define LL_GPIO_OUTPUT_PUSHPULL (0x00000000U) /*!< Select push-pull as output type */
  140. #define LL_GPIO_OUTPUT_OPENDRAIN GPIO_OTYPER_OT_0 /*!< Select open-drain as output type */
  141. /**
  142. * @}
  143. */
  144. /** @defgroup GPIO_LL_EC_SPEED Output Speed
  145. * @{
  146. */
  147. #define LL_GPIO_SPEED_FREQ_LOW (0x00000000U) /*!< Select I/O low output speed */
  148. #define LL_GPIO_SPEED_FREQ_MEDIUM GPIO_OSPEEDR_OSPEEDR0_0 /*!< Select I/O medium output speed */
  149. #define LL_GPIO_SPEED_FREQ_HIGH GPIO_OSPEEDR_OSPEEDR0 /*!< Select I/O high output speed */
  150. /**
  151. * @}
  152. */
  153. #define LL_GPIO_SPEED_LOW LL_GPIO_SPEED_FREQ_LOW
  154. #define LL_GPIO_SPEED_MEDIUM LL_GPIO_SPEED_FREQ_MEDIUM
  155. #define LL_GPIO_SPEED_HIGH LL_GPIO_SPEED_FREQ_HIGH
  156. /** @defgroup GPIO_LL_EC_PULL Pull Up Pull Down
  157. * @{
  158. */
  159. #define LL_GPIO_PULL_NO (0x00000000U) /*!< Select I/O no pull */
  160. #define LL_GPIO_PULL_UP GPIO_PUPDR_PUPDR0_0 /*!< Select I/O pull up */
  161. #define LL_GPIO_PULL_DOWN GPIO_PUPDR_PUPDR0_1 /*!< Select I/O pull down */
  162. /**
  163. * @}
  164. */
  165. /** @defgroup GPIO_LL_EC_AF Alternate Function
  166. * @{
  167. */
  168. #define LL_GPIO_AF_0 (0x0000000U) /*!< Select alternate function 0 */
  169. #define LL_GPIO_AF_1 (0x0000001U) /*!< Select alternate function 1 */
  170. #define LL_GPIO_AF_2 (0x0000002U) /*!< Select alternate function 2 */
  171. #define LL_GPIO_AF_3 (0x0000003U) /*!< Select alternate function 3 */
  172. #define LL_GPIO_AF_4 (0x0000004U) /*!< Select alternate function 4 */
  173. #define LL_GPIO_AF_5 (0x0000005U) /*!< Select alternate function 5 */
  174. #define LL_GPIO_AF_6 (0x0000006U) /*!< Select alternate function 6 */
  175. #define LL_GPIO_AF_7 (0x0000007U) /*!< Select alternate function 7 */
  176. /**
  177. * @}
  178. */
  179. /**
  180. * @}
  181. */
  182. /* Exported macro ------------------------------------------------------------*/
  183. /** @defgroup GPIO_LL_Exported_Macros GPIO Exported Macros
  184. * @{
  185. */
  186. /** @defgroup GPIO_LL_EM_WRITE_READ Common Write and read registers Macros
  187. * @{
  188. */
  189. /**
  190. * @brief Write a value in GPIO register
  191. * @param __INSTANCE__ GPIO Instance
  192. * @param __REG__ Register to be written
  193. * @param __VALUE__ Value to be written in the register
  194. * @retval None
  195. */
  196. #define LL_GPIO_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
  197. /**
  198. * @brief Read a value in GPIO register
  199. * @param __INSTANCE__ GPIO Instance
  200. * @param __REG__ Register to be read
  201. * @retval Register value
  202. */
  203. #define LL_GPIO_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
  204. /**
  205. * @}
  206. */
  207. /**
  208. * @}
  209. */
  210. /* Exported functions --------------------------------------------------------*/
  211. /** @defgroup GPIO_LL_Exported_Functions GPIO Exported Functions
  212. * @{
  213. */
  214. /** @defgroup GPIO_LL_EF_Port_Configuration Port Configuration
  215. * @{
  216. */
  217. /**
  218. * @brief Configure gpio mode for a dedicated pin on dedicated port.
  219. * @note I/O mode can be Input mode, General purpose output, Alternate function mode or Analog.
  220. * @note Warning: only one pin can be passed as parameter.
  221. * @rmtoll MODER MODEy LL_GPIO_SetPinMode
  222. * @param GPIOx GPIO Port
  223. * @param Pin This parameter can be one of the following values:
  224. * @arg @ref LL_GPIO_PIN_0
  225. * @arg @ref LL_GPIO_PIN_1
  226. * @arg @ref LL_GPIO_PIN_2
  227. * @arg @ref LL_GPIO_PIN_3
  228. * @arg @ref LL_GPIO_PIN_4
  229. * @arg @ref LL_GPIO_PIN_5
  230. * @arg @ref LL_GPIO_PIN_6
  231. * @arg @ref LL_GPIO_PIN_7
  232. * @arg @ref LL_GPIO_PIN_8
  233. * @arg @ref LL_GPIO_PIN_9
  234. * @arg @ref LL_GPIO_PIN_10
  235. * @arg @ref LL_GPIO_PIN_11
  236. * @arg @ref LL_GPIO_PIN_12
  237. * @arg @ref LL_GPIO_PIN_13
  238. * @arg @ref LL_GPIO_PIN_14
  239. * @arg @ref LL_GPIO_PIN_15
  240. * @param Mode This parameter can be one of the following values:
  241. * @arg @ref LL_GPIO_MODE_INPUT
  242. * @arg @ref LL_GPIO_MODE_OUTPUT
  243. * @arg @ref LL_GPIO_MODE_ALTERNATE
  244. * @arg @ref LL_GPIO_MODE_ANALOG
  245. * @retval None
  246. */
  247. __STATIC_INLINE void LL_GPIO_SetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Mode)
  248. {
  249. MODIFY_REG(GPIOx->MODER, ((Pin * Pin) * GPIO_MODER_MODER0), ((Pin * Pin) * Mode));
  250. }
  251. /**
  252. * @brief Return gpio mode for a dedicated pin on dedicated port.
  253. * @note I/O mode can be Input mode, General purpose output, Alternate function mode or Analog.
  254. * @note Warning: only one pin can be passed as parameter.
  255. * @rmtoll MODER MODEy LL_GPIO_GetPinMode
  256. * @param GPIOx GPIO Port
  257. * @param Pin This parameter can be one of the following values:
  258. * @arg @ref LL_GPIO_PIN_0
  259. * @arg @ref LL_GPIO_PIN_1
  260. * @arg @ref LL_GPIO_PIN_2
  261. * @arg @ref LL_GPIO_PIN_3
  262. * @arg @ref LL_GPIO_PIN_4
  263. * @arg @ref LL_GPIO_PIN_5
  264. * @arg @ref LL_GPIO_PIN_6
  265. * @arg @ref LL_GPIO_PIN_7
  266. * @arg @ref LL_GPIO_PIN_8
  267. * @arg @ref LL_GPIO_PIN_9
  268. * @arg @ref LL_GPIO_PIN_10
  269. * @arg @ref LL_GPIO_PIN_11
  270. * @arg @ref LL_GPIO_PIN_12
  271. * @arg @ref LL_GPIO_PIN_13
  272. * @arg @ref LL_GPIO_PIN_14
  273. * @arg @ref LL_GPIO_PIN_15
  274. * @retval Returned value can be one of the following values:
  275. * @arg @ref LL_GPIO_MODE_INPUT
  276. * @arg @ref LL_GPIO_MODE_OUTPUT
  277. * @arg @ref LL_GPIO_MODE_ALTERNATE
  278. * @arg @ref LL_GPIO_MODE_ANALOG
  279. */
  280. __STATIC_INLINE uint32_t LL_GPIO_GetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin)
  281. {
  282. return (uint32_t)(READ_BIT(GPIOx->MODER, ((Pin * Pin) * GPIO_MODER_MODER0)) / (Pin * Pin));
  283. }
  284. /**
  285. * @brief Configure gpio output type for several pins on dedicated port.
  286. * @note Output type as to be set when gpio pin is in output or
  287. * alternate modes. Possible type are Push-pull or Open-drain.
  288. * @rmtoll OTYPER OTy LL_GPIO_SetPinOutputType
  289. * @param GPIOx GPIO Port
  290. * @param PinMask This parameter can be a combination of the following values:
  291. * @arg @ref LL_GPIO_PIN_0
  292. * @arg @ref LL_GPIO_PIN_1
  293. * @arg @ref LL_GPIO_PIN_2
  294. * @arg @ref LL_GPIO_PIN_3
  295. * @arg @ref LL_GPIO_PIN_4
  296. * @arg @ref LL_GPIO_PIN_5
  297. * @arg @ref LL_GPIO_PIN_6
  298. * @arg @ref LL_GPIO_PIN_7
  299. * @arg @ref LL_GPIO_PIN_8
  300. * @arg @ref LL_GPIO_PIN_9
  301. * @arg @ref LL_GPIO_PIN_10
  302. * @arg @ref LL_GPIO_PIN_11
  303. * @arg @ref LL_GPIO_PIN_12
  304. * @arg @ref LL_GPIO_PIN_13
  305. * @arg @ref LL_GPIO_PIN_14
  306. * @arg @ref LL_GPIO_PIN_15
  307. * @arg @ref LL_GPIO_PIN_ALL
  308. * @param OutputType This parameter can be one of the following values:
  309. * @arg @ref LL_GPIO_OUTPUT_PUSHPULL
  310. * @arg @ref LL_GPIO_OUTPUT_OPENDRAIN
  311. * @retval None
  312. */
  313. __STATIC_INLINE void LL_GPIO_SetPinOutputType(GPIO_TypeDef *GPIOx, uint32_t PinMask, uint32_t OutputType)
  314. {
  315. MODIFY_REG(GPIOx->OTYPER, PinMask, (PinMask * OutputType));
  316. }
  317. /**
  318. * @brief Return gpio output type for several pins on dedicated port.
  319. * @note Output type as to be set when gpio pin is in output or
  320. * alternate modes. Possible type are Push-pull or Open-drain.
  321. * @note Warning: only one pin can be passed as parameter.
  322. * @rmtoll OTYPER OTy LL_GPIO_GetPinOutputType
  323. * @param GPIOx GPIO Port
  324. * @param Pin This parameter can be one of the following values:
  325. * @arg @ref LL_GPIO_PIN_0
  326. * @arg @ref LL_GPIO_PIN_1
  327. * @arg @ref LL_GPIO_PIN_2
  328. * @arg @ref LL_GPIO_PIN_3
  329. * @arg @ref LL_GPIO_PIN_4
  330. * @arg @ref LL_GPIO_PIN_5
  331. * @arg @ref LL_GPIO_PIN_6
  332. * @arg @ref LL_GPIO_PIN_7
  333. * @arg @ref LL_GPIO_PIN_8
  334. * @arg @ref LL_GPIO_PIN_9
  335. * @arg @ref LL_GPIO_PIN_10
  336. * @arg @ref LL_GPIO_PIN_11
  337. * @arg @ref LL_GPIO_PIN_12
  338. * @arg @ref LL_GPIO_PIN_13
  339. * @arg @ref LL_GPIO_PIN_14
  340. * @arg @ref LL_GPIO_PIN_15
  341. * @arg @ref LL_GPIO_PIN_ALL
  342. * @retval Returned value can be one of the following values:
  343. * @arg @ref LL_GPIO_OUTPUT_PUSHPULL
  344. * @arg @ref LL_GPIO_OUTPUT_OPENDRAIN
  345. */
  346. __STATIC_INLINE uint32_t LL_GPIO_GetPinOutputType(GPIO_TypeDef *GPIOx, uint32_t Pin)
  347. {
  348. return (uint32_t)(READ_BIT(GPIOx->OTYPER, Pin) / Pin);
  349. }
  350. /**
  351. * @brief Configure gpio speed for a dedicated pin on dedicated port.
  352. * @note I/O speed can be Low, Medium, Fast or High speed.
  353. * @note Warning: only one pin can be passed as parameter.
  354. * @note Refer to datasheet for frequency specifications and the power
  355. * supply and load conditions for each speed.
  356. * @rmtoll OSPEEDR OSPEEDy LL_GPIO_SetPinSpeed
  357. * @param GPIOx GPIO Port
  358. * @param Pin This parameter can be one of the following values:
  359. * @arg @ref LL_GPIO_PIN_0
  360. * @arg @ref LL_GPIO_PIN_1
  361. * @arg @ref LL_GPIO_PIN_2
  362. * @arg @ref LL_GPIO_PIN_3
  363. * @arg @ref LL_GPIO_PIN_4
  364. * @arg @ref LL_GPIO_PIN_5
  365. * @arg @ref LL_GPIO_PIN_6
  366. * @arg @ref LL_GPIO_PIN_7
  367. * @arg @ref LL_GPIO_PIN_8
  368. * @arg @ref LL_GPIO_PIN_9
  369. * @arg @ref LL_GPIO_PIN_10
  370. * @arg @ref LL_GPIO_PIN_11
  371. * @arg @ref LL_GPIO_PIN_12
  372. * @arg @ref LL_GPIO_PIN_13
  373. * @arg @ref LL_GPIO_PIN_14
  374. * @arg @ref LL_GPIO_PIN_15
  375. * @param Speed This parameter can be one of the following values:
  376. * @arg @ref LL_GPIO_SPEED_FREQ_LOW
  377. * @arg @ref LL_GPIO_SPEED_FREQ_MEDIUM
  378. * @arg @ref LL_GPIO_SPEED_FREQ_HIGH
  379. * @retval None
  380. */
  381. __STATIC_INLINE void LL_GPIO_SetPinSpeed(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Speed)
  382. {
  383. MODIFY_REG(GPIOx->OSPEEDR, ((Pin * Pin) * GPIO_OSPEEDR_OSPEEDR0), ((Pin * Pin) * Speed));
  384. }
  385. /**
  386. * @brief Return gpio speed for a dedicated pin on dedicated port.
  387. * @note I/O speed can be Low, Medium, Fast or High speed.
  388. * @note Warning: only one pin can be passed as parameter.
  389. * @note Refer to datasheet for frequency specifications and the power
  390. * supply and load conditions for each speed.
  391. * @rmtoll OSPEEDR OSPEEDy LL_GPIO_GetPinSpeed
  392. * @param GPIOx GPIO Port
  393. * @param Pin This parameter can be one of the following values:
  394. * @arg @ref LL_GPIO_PIN_0
  395. * @arg @ref LL_GPIO_PIN_1
  396. * @arg @ref LL_GPIO_PIN_2
  397. * @arg @ref LL_GPIO_PIN_3
  398. * @arg @ref LL_GPIO_PIN_4
  399. * @arg @ref LL_GPIO_PIN_5
  400. * @arg @ref LL_GPIO_PIN_6
  401. * @arg @ref LL_GPIO_PIN_7
  402. * @arg @ref LL_GPIO_PIN_8
  403. * @arg @ref LL_GPIO_PIN_9
  404. * @arg @ref LL_GPIO_PIN_10
  405. * @arg @ref LL_GPIO_PIN_11
  406. * @arg @ref LL_GPIO_PIN_12
  407. * @arg @ref LL_GPIO_PIN_13
  408. * @arg @ref LL_GPIO_PIN_14
  409. * @arg @ref LL_GPIO_PIN_15
  410. * @retval Returned value can be one of the following values:
  411. * @arg @ref LL_GPIO_SPEED_FREQ_LOW
  412. * @arg @ref LL_GPIO_SPEED_FREQ_MEDIUM
  413. * @arg @ref LL_GPIO_SPEED_FREQ_HIGH
  414. */
  415. __STATIC_INLINE uint32_t LL_GPIO_GetPinSpeed(GPIO_TypeDef *GPIOx, uint32_t Pin)
  416. {
  417. return (uint32_t)(READ_BIT(GPIOx->OSPEEDR, ((Pin * Pin) * GPIO_OSPEEDR_OSPEEDR0)) / (Pin * Pin));
  418. }
  419. /**
  420. * @brief Configure gpio pull-up or pull-down for a dedicated pin on a dedicated port.
  421. * @note Warning: only one pin can be passed as parameter.
  422. * @rmtoll PUPDR PUPDy LL_GPIO_SetPinPull
  423. * @param GPIOx GPIO Port
  424. * @param Pin This parameter can be one of the following values:
  425. * @arg @ref LL_GPIO_PIN_0
  426. * @arg @ref LL_GPIO_PIN_1
  427. * @arg @ref LL_GPIO_PIN_2
  428. * @arg @ref LL_GPIO_PIN_3
  429. * @arg @ref LL_GPIO_PIN_4
  430. * @arg @ref LL_GPIO_PIN_5
  431. * @arg @ref LL_GPIO_PIN_6
  432. * @arg @ref LL_GPIO_PIN_7
  433. * @arg @ref LL_GPIO_PIN_8
  434. * @arg @ref LL_GPIO_PIN_9
  435. * @arg @ref LL_GPIO_PIN_10
  436. * @arg @ref LL_GPIO_PIN_11
  437. * @arg @ref LL_GPIO_PIN_12
  438. * @arg @ref LL_GPIO_PIN_13
  439. * @arg @ref LL_GPIO_PIN_14
  440. * @arg @ref LL_GPIO_PIN_15
  441. * @param Pull This parameter can be one of the following values:
  442. * @arg @ref LL_GPIO_PULL_NO
  443. * @arg @ref LL_GPIO_PULL_UP
  444. * @arg @ref LL_GPIO_PULL_DOWN
  445. * @retval None
  446. */
  447. __STATIC_INLINE void LL_GPIO_SetPinPull(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Pull)
  448. {
  449. MODIFY_REG(GPIOx->PUPDR, ((Pin * Pin) * GPIO_PUPDR_PUPDR0), ((Pin * Pin) * Pull));
  450. }
  451. /**
  452. * @brief Return gpio pull-up or pull-down for a dedicated pin on a dedicated port
  453. * @note Warning: only one pin can be passed as parameter.
  454. * @rmtoll PUPDR PUPDy LL_GPIO_GetPinPull
  455. * @param GPIOx GPIO Port
  456. * @param Pin This parameter can be one of the following values:
  457. * @arg @ref LL_GPIO_PIN_0
  458. * @arg @ref LL_GPIO_PIN_1
  459. * @arg @ref LL_GPIO_PIN_2
  460. * @arg @ref LL_GPIO_PIN_3
  461. * @arg @ref LL_GPIO_PIN_4
  462. * @arg @ref LL_GPIO_PIN_5
  463. * @arg @ref LL_GPIO_PIN_6
  464. * @arg @ref LL_GPIO_PIN_7
  465. * @arg @ref LL_GPIO_PIN_8
  466. * @arg @ref LL_GPIO_PIN_9
  467. * @arg @ref LL_GPIO_PIN_10
  468. * @arg @ref LL_GPIO_PIN_11
  469. * @arg @ref LL_GPIO_PIN_12
  470. * @arg @ref LL_GPIO_PIN_13
  471. * @arg @ref LL_GPIO_PIN_14
  472. * @arg @ref LL_GPIO_PIN_15
  473. * @retval Returned value can be one of the following values:
  474. * @arg @ref LL_GPIO_PULL_NO
  475. * @arg @ref LL_GPIO_PULL_UP
  476. * @arg @ref LL_GPIO_PULL_DOWN
  477. */
  478. __STATIC_INLINE uint32_t LL_GPIO_GetPinPull(GPIO_TypeDef *GPIOx, uint32_t Pin)
  479. {
  480. return (uint32_t)(READ_BIT(GPIOx->PUPDR, ((Pin * Pin) * GPIO_PUPDR_PUPDR0)) / (Pin * Pin));
  481. }
  482. /**
  483. * @brief Configure gpio alternate function of a dedicated pin from 0 to 7 for a dedicated port.
  484. * @note Possible values are from AF0 to AF7 depending on target.
  485. * @note Warning: only one pin can be passed as parameter.
  486. * @rmtoll AFRL AFSELy LL_GPIO_SetAFPin_0_7
  487. * @param GPIOx GPIO Port
  488. * @param Pin This parameter can be one of the following values:
  489. * @arg @ref LL_GPIO_PIN_0
  490. * @arg @ref LL_GPIO_PIN_1
  491. * @arg @ref LL_GPIO_PIN_2
  492. * @arg @ref LL_GPIO_PIN_3
  493. * @arg @ref LL_GPIO_PIN_4
  494. * @arg @ref LL_GPIO_PIN_5
  495. * @arg @ref LL_GPIO_PIN_6
  496. * @arg @ref LL_GPIO_PIN_7
  497. * @param Alternate This parameter can be one of the following values:
  498. * @arg @ref LL_GPIO_AF_0
  499. * @arg @ref LL_GPIO_AF_1
  500. * @arg @ref LL_GPIO_AF_2
  501. * @arg @ref LL_GPIO_AF_3
  502. * @arg @ref LL_GPIO_AF_4
  503. * @arg @ref LL_GPIO_AF_5
  504. * @arg @ref LL_GPIO_AF_6
  505. * @arg @ref LL_GPIO_AF_7
  506. * @retval None
  507. */
  508. __STATIC_INLINE void LL_GPIO_SetAFPin_0_7(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate)
  509. {
  510. MODIFY_REG(GPIOx->AFR[0], ((((Pin * Pin) * Pin) * Pin) * GPIO_AFRL_AFSEL0),
  511. ((((Pin * Pin) * Pin) * Pin) * Alternate));
  512. }
  513. /**
  514. * @brief Return gpio alternate function of a dedicated pin from 0 to 7 for a dedicated port.
  515. * @rmtoll AFRL AFSELy LL_GPIO_GetAFPin_0_7
  516. * @param GPIOx GPIO Port
  517. * @param Pin This parameter can be one of the following values:
  518. * @arg @ref LL_GPIO_PIN_0
  519. * @arg @ref LL_GPIO_PIN_1
  520. * @arg @ref LL_GPIO_PIN_2
  521. * @arg @ref LL_GPIO_PIN_3
  522. * @arg @ref LL_GPIO_PIN_4
  523. * @arg @ref LL_GPIO_PIN_5
  524. * @arg @ref LL_GPIO_PIN_6
  525. * @arg @ref LL_GPIO_PIN_7
  526. * @retval Returned value can be one of the following values:
  527. * @arg @ref LL_GPIO_AF_0
  528. * @arg @ref LL_GPIO_AF_1
  529. * @arg @ref LL_GPIO_AF_2
  530. * @arg @ref LL_GPIO_AF_3
  531. * @arg @ref LL_GPIO_AF_4
  532. * @arg @ref LL_GPIO_AF_5
  533. * @arg @ref LL_GPIO_AF_6
  534. * @arg @ref LL_GPIO_AF_7
  535. */
  536. __STATIC_INLINE uint32_t LL_GPIO_GetAFPin_0_7(GPIO_TypeDef *GPIOx, uint32_t Pin)
  537. {
  538. return (uint32_t)(READ_BIT(GPIOx->AFR[0],
  539. ((((Pin * Pin) * Pin) * Pin) * GPIO_AFRL_AFSEL0)) / (((Pin * Pin) * Pin) * Pin));
  540. }
  541. /**
  542. * @brief Configure gpio alternate function of a dedicated pin from 8 to 15 for a dedicated port.
  543. * @note Possible values are from AF0 to AF7 depending on target.
  544. * @note Warning: only one pin can be passed as parameter.
  545. * @rmtoll AFRH AFSELy LL_GPIO_SetAFPin_8_15
  546. * @param GPIOx GPIO Port
  547. * @param Pin This parameter can be one of the following values:
  548. * @arg @ref LL_GPIO_PIN_8
  549. * @arg @ref LL_GPIO_PIN_9
  550. * @arg @ref LL_GPIO_PIN_10
  551. * @arg @ref LL_GPIO_PIN_11
  552. * @arg @ref LL_GPIO_PIN_12
  553. * @arg @ref LL_GPIO_PIN_13
  554. * @arg @ref LL_GPIO_PIN_14
  555. * @arg @ref LL_GPIO_PIN_15
  556. * @param Alternate This parameter can be one of the following values:
  557. * @arg @ref LL_GPIO_AF_0
  558. * @arg @ref LL_GPIO_AF_1
  559. * @arg @ref LL_GPIO_AF_2
  560. * @arg @ref LL_GPIO_AF_3
  561. * @arg @ref LL_GPIO_AF_4
  562. * @arg @ref LL_GPIO_AF_5
  563. * @arg @ref LL_GPIO_AF_6
  564. * @arg @ref LL_GPIO_AF_7
  565. * @retval None
  566. */
  567. __STATIC_INLINE void LL_GPIO_SetAFPin_8_15(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate)
  568. {
  569. MODIFY_REG(GPIOx->AFR[1], (((((Pin >> 8U) * (Pin >> 8U)) * (Pin >> 8U)) * (Pin >> 8U)) * GPIO_AFRH_AFSEL8),
  570. (((((Pin >> 8U) * (Pin >> 8U)) * (Pin >> 8U)) * (Pin >> 8U)) * Alternate));
  571. }
  572. /**
  573. * @brief Return gpio alternate function of a dedicated pin from 8 to 15 for a dedicated port.
  574. * @note Possible values are from AF0 to AF7 depending on target.
  575. * @rmtoll AFRH AFSELy LL_GPIO_GetAFPin_8_15
  576. * @param GPIOx GPIO Port
  577. * @param Pin This parameter can be one of the following values:
  578. * @arg @ref LL_GPIO_PIN_8
  579. * @arg @ref LL_GPIO_PIN_9
  580. * @arg @ref LL_GPIO_PIN_10
  581. * @arg @ref LL_GPIO_PIN_11
  582. * @arg @ref LL_GPIO_PIN_12
  583. * @arg @ref LL_GPIO_PIN_13
  584. * @arg @ref LL_GPIO_PIN_14
  585. * @arg @ref LL_GPIO_PIN_15
  586. * @retval Returned value can be one of the following values:
  587. * @arg @ref LL_GPIO_AF_0
  588. * @arg @ref LL_GPIO_AF_1
  589. * @arg @ref LL_GPIO_AF_2
  590. * @arg @ref LL_GPIO_AF_3
  591. * @arg @ref LL_GPIO_AF_4
  592. * @arg @ref LL_GPIO_AF_5
  593. * @arg @ref LL_GPIO_AF_6
  594. * @arg @ref LL_GPIO_AF_7
  595. */
  596. __STATIC_INLINE uint32_t LL_GPIO_GetAFPin_8_15(GPIO_TypeDef *GPIOx, uint32_t Pin)
  597. {
  598. return (uint32_t)(READ_BIT(GPIOx->AFR[1],
  599. (((((Pin >> 8U) * (Pin >> 8U)) * (Pin >> 8U)) * (Pin >> 8U)) * GPIO_AFRH_AFSEL8)) / ((((Pin >> 8U) *
  600. (Pin >> 8U)) * (Pin >> 8U)) * (Pin >> 8U)));
  601. }
  602. /**
  603. * @brief Lock configuration of several pins for a dedicated port.
  604. * @note When the lock sequence has been applied on a port bit, the
  605. * value of this port bit can no longer be modified until the
  606. * next reset.
  607. * @note Each lock bit freezes a specific configuration register
  608. * (control and alternate function registers).
  609. * @rmtoll LCKR LCKK LL_GPIO_LockPin
  610. * @param GPIOx GPIO Port
  611. * @param PinMask This parameter can be a combination of the following values:
  612. * @arg @ref LL_GPIO_PIN_0
  613. * @arg @ref LL_GPIO_PIN_1
  614. * @arg @ref LL_GPIO_PIN_2
  615. * @arg @ref LL_GPIO_PIN_3
  616. * @arg @ref LL_GPIO_PIN_4
  617. * @arg @ref LL_GPIO_PIN_5
  618. * @arg @ref LL_GPIO_PIN_6
  619. * @arg @ref LL_GPIO_PIN_7
  620. * @arg @ref LL_GPIO_PIN_8
  621. * @arg @ref LL_GPIO_PIN_9
  622. * @arg @ref LL_GPIO_PIN_10
  623. * @arg @ref LL_GPIO_PIN_11
  624. * @arg @ref LL_GPIO_PIN_12
  625. * @arg @ref LL_GPIO_PIN_13
  626. * @arg @ref LL_GPIO_PIN_14
  627. * @arg @ref LL_GPIO_PIN_15
  628. * @arg @ref LL_GPIO_PIN_ALL
  629. * @retval None
  630. */
  631. __STATIC_INLINE void LL_GPIO_LockPin(GPIO_TypeDef *GPIOx, uint32_t PinMask)
  632. {
  633. __IO uint32_t temp;
  634. WRITE_REG(GPIOx->LCKR, GPIO_LCKR_LCKK | PinMask);
  635. WRITE_REG(GPIOx->LCKR, PinMask);
  636. WRITE_REG(GPIOx->LCKR, GPIO_LCKR_LCKK | PinMask);
  637. temp = READ_REG(GPIOx->LCKR);
  638. (void) temp;
  639. }
  640. /**
  641. * @brief Return 1 if all pins passed as parameter, of a dedicated port, are locked. else Return 0.
  642. * @rmtoll LCKR LCKy LL_GPIO_IsPinLocked
  643. * @param GPIOx GPIO Port
  644. * @param PinMask This parameter can be a combination of the following values:
  645. * @arg @ref LL_GPIO_PIN_0
  646. * @arg @ref LL_GPIO_PIN_1
  647. * @arg @ref LL_GPIO_PIN_2
  648. * @arg @ref LL_GPIO_PIN_3
  649. * @arg @ref LL_GPIO_PIN_4
  650. * @arg @ref LL_GPIO_PIN_5
  651. * @arg @ref LL_GPIO_PIN_6
  652. * @arg @ref LL_GPIO_PIN_7
  653. * @arg @ref LL_GPIO_PIN_8
  654. * @arg @ref LL_GPIO_PIN_9
  655. * @arg @ref LL_GPIO_PIN_10
  656. * @arg @ref LL_GPIO_PIN_11
  657. * @arg @ref LL_GPIO_PIN_12
  658. * @arg @ref LL_GPIO_PIN_13
  659. * @arg @ref LL_GPIO_PIN_14
  660. * @arg @ref LL_GPIO_PIN_15
  661. * @arg @ref LL_GPIO_PIN_ALL
  662. * @retval State of bit (1 or 0).
  663. */
  664. __STATIC_INLINE uint32_t LL_GPIO_IsPinLocked(GPIO_TypeDef *GPIOx, uint32_t PinMask)
  665. {
  666. return (READ_BIT(GPIOx->LCKR, PinMask) == (PinMask));
  667. }
  668. /**
  669. * @brief Return 1 if one of the pin of a dedicated port is locked. else return 0.
  670. * @rmtoll LCKR LCKK LL_GPIO_IsAnyPinLocked
  671. * @param GPIOx GPIO Port
  672. * @retval State of bit (1 or 0).
  673. */
  674. __STATIC_INLINE uint32_t LL_GPIO_IsAnyPinLocked(GPIO_TypeDef *GPIOx)
  675. {
  676. return (READ_BIT(GPIOx->LCKR, GPIO_LCKR_LCKK) == (GPIO_LCKR_LCKK));
  677. }
  678. /**
  679. * @}
  680. */
  681. /** @defgroup GPIO_LL_EF_Data_Access Data Access
  682. * @{
  683. */
  684. /**
  685. * @brief Return full input data register value for a dedicated port.
  686. * @rmtoll IDR IDy LL_GPIO_ReadInputPort
  687. * @param GPIOx GPIO Port
  688. * @retval Input data register value of port
  689. */
  690. __STATIC_INLINE uint32_t LL_GPIO_ReadInputPort(GPIO_TypeDef *GPIOx)
  691. {
  692. return (uint32_t)(READ_REG(GPIOx->IDR));
  693. }
  694. /**
  695. * @brief Return if input data level for several pins of dedicated port is high or low.
  696. * @rmtoll IDR IDy LL_GPIO_IsInputPinSet
  697. * @param GPIOx GPIO Port
  698. * @param PinMask This parameter can be a combination of the following values:
  699. * @arg @ref LL_GPIO_PIN_0
  700. * @arg @ref LL_GPIO_PIN_1
  701. * @arg @ref LL_GPIO_PIN_2
  702. * @arg @ref LL_GPIO_PIN_3
  703. * @arg @ref LL_GPIO_PIN_4
  704. * @arg @ref LL_GPIO_PIN_5
  705. * @arg @ref LL_GPIO_PIN_6
  706. * @arg @ref LL_GPIO_PIN_7
  707. * @arg @ref LL_GPIO_PIN_8
  708. * @arg @ref LL_GPIO_PIN_9
  709. * @arg @ref LL_GPIO_PIN_10
  710. * @arg @ref LL_GPIO_PIN_11
  711. * @arg @ref LL_GPIO_PIN_12
  712. * @arg @ref LL_GPIO_PIN_13
  713. * @arg @ref LL_GPIO_PIN_14
  714. * @arg @ref LL_GPIO_PIN_15
  715. * @arg @ref LL_GPIO_PIN_ALL
  716. * @retval State of bit (1 or 0).
  717. */
  718. __STATIC_INLINE uint32_t LL_GPIO_IsInputPinSet(GPIO_TypeDef *GPIOx, uint32_t PinMask)
  719. {
  720. return (READ_BIT(GPIOx->IDR, PinMask) == (PinMask));
  721. }
  722. /**
  723. * @brief Write output data register for the port.
  724. * @rmtoll ODR ODy LL_GPIO_WriteOutputPort
  725. * @param GPIOx GPIO Port
  726. * @param PortValue Level value for each pin of the port
  727. * @retval None
  728. */
  729. __STATIC_INLINE void LL_GPIO_WriteOutputPort(GPIO_TypeDef *GPIOx, uint32_t PortValue)
  730. {
  731. WRITE_REG(GPIOx->ODR, PortValue);
  732. }
  733. /**
  734. * @brief Return full output data register value for a dedicated port.
  735. * @rmtoll ODR ODy LL_GPIO_ReadOutputPort
  736. * @param GPIOx GPIO Port
  737. * @retval Output data register value of port
  738. */
  739. __STATIC_INLINE uint32_t LL_GPIO_ReadOutputPort(GPIO_TypeDef *GPIOx)
  740. {
  741. return (uint32_t)(READ_REG(GPIOx->ODR));
  742. }
  743. /**
  744. * @brief Return if input data level for several pins of dedicated port is high or low.
  745. * @rmtoll ODR ODy LL_GPIO_IsOutputPinSet
  746. * @param GPIOx GPIO Port
  747. * @param PinMask This parameter can be a combination of the following values:
  748. * @arg @ref LL_GPIO_PIN_0
  749. * @arg @ref LL_GPIO_PIN_1
  750. * @arg @ref LL_GPIO_PIN_2
  751. * @arg @ref LL_GPIO_PIN_3
  752. * @arg @ref LL_GPIO_PIN_4
  753. * @arg @ref LL_GPIO_PIN_5
  754. * @arg @ref LL_GPIO_PIN_6
  755. * @arg @ref LL_GPIO_PIN_7
  756. * @arg @ref LL_GPIO_PIN_8
  757. * @arg @ref LL_GPIO_PIN_9
  758. * @arg @ref LL_GPIO_PIN_10
  759. * @arg @ref LL_GPIO_PIN_11
  760. * @arg @ref LL_GPIO_PIN_12
  761. * @arg @ref LL_GPIO_PIN_13
  762. * @arg @ref LL_GPIO_PIN_14
  763. * @arg @ref LL_GPIO_PIN_15
  764. * @arg @ref LL_GPIO_PIN_ALL
  765. * @retval State of bit (1 or 0).
  766. */
  767. __STATIC_INLINE uint32_t LL_GPIO_IsOutputPinSet(GPIO_TypeDef *GPIOx, uint32_t PinMask)
  768. {
  769. return (READ_BIT(GPIOx->ODR, PinMask) == (PinMask));
  770. }
  771. /**
  772. * @brief Set several pins to high level on dedicated gpio port.
  773. * @rmtoll BSRR BSy LL_GPIO_SetOutputPin
  774. * @param GPIOx GPIO Port
  775. * @param PinMask This parameter can be a combination of the following values:
  776. * @arg @ref LL_GPIO_PIN_0
  777. * @arg @ref LL_GPIO_PIN_1
  778. * @arg @ref LL_GPIO_PIN_2
  779. * @arg @ref LL_GPIO_PIN_3
  780. * @arg @ref LL_GPIO_PIN_4
  781. * @arg @ref LL_GPIO_PIN_5
  782. * @arg @ref LL_GPIO_PIN_6
  783. * @arg @ref LL_GPIO_PIN_7
  784. * @arg @ref LL_GPIO_PIN_8
  785. * @arg @ref LL_GPIO_PIN_9
  786. * @arg @ref LL_GPIO_PIN_10
  787. * @arg @ref LL_GPIO_PIN_11
  788. * @arg @ref LL_GPIO_PIN_12
  789. * @arg @ref LL_GPIO_PIN_13
  790. * @arg @ref LL_GPIO_PIN_14
  791. * @arg @ref LL_GPIO_PIN_15
  792. * @arg @ref LL_GPIO_PIN_ALL
  793. * @retval None
  794. */
  795. __STATIC_INLINE void LL_GPIO_SetOutputPin(GPIO_TypeDef *GPIOx, uint32_t PinMask)
  796. {
  797. WRITE_REG(GPIOx->BSRR, PinMask);
  798. }
  799. /**
  800. * @brief Set several pins to low level on dedicated gpio port.
  801. * @rmtoll BRR BRy LL_GPIO_ResetOutputPin
  802. * @param GPIOx GPIO Port
  803. * @param PinMask This parameter can be a combination of the following values:
  804. * @arg @ref LL_GPIO_PIN_0
  805. * @arg @ref LL_GPIO_PIN_1
  806. * @arg @ref LL_GPIO_PIN_2
  807. * @arg @ref LL_GPIO_PIN_3
  808. * @arg @ref LL_GPIO_PIN_4
  809. * @arg @ref LL_GPIO_PIN_5
  810. * @arg @ref LL_GPIO_PIN_6
  811. * @arg @ref LL_GPIO_PIN_7
  812. * @arg @ref LL_GPIO_PIN_8
  813. * @arg @ref LL_GPIO_PIN_9
  814. * @arg @ref LL_GPIO_PIN_10
  815. * @arg @ref LL_GPIO_PIN_11
  816. * @arg @ref LL_GPIO_PIN_12
  817. * @arg @ref LL_GPIO_PIN_13
  818. * @arg @ref LL_GPIO_PIN_14
  819. * @arg @ref LL_GPIO_PIN_15
  820. * @arg @ref LL_GPIO_PIN_ALL
  821. * @retval None
  822. */
  823. __STATIC_INLINE void LL_GPIO_ResetOutputPin(GPIO_TypeDef *GPIOx, uint32_t PinMask)
  824. {
  825. WRITE_REG(GPIOx->BRR, PinMask);
  826. }
  827. /**
  828. * @brief Toggle data value for several pin of dedicated port.
  829. * @rmtoll ODR ODy LL_GPIO_TogglePin
  830. * @param GPIOx GPIO Port
  831. * @param PinMask This parameter can be a combination of the following values:
  832. * @arg @ref LL_GPIO_PIN_0
  833. * @arg @ref LL_GPIO_PIN_1
  834. * @arg @ref LL_GPIO_PIN_2
  835. * @arg @ref LL_GPIO_PIN_3
  836. * @arg @ref LL_GPIO_PIN_4
  837. * @arg @ref LL_GPIO_PIN_5
  838. * @arg @ref LL_GPIO_PIN_6
  839. * @arg @ref LL_GPIO_PIN_7
  840. * @arg @ref LL_GPIO_PIN_8
  841. * @arg @ref LL_GPIO_PIN_9
  842. * @arg @ref LL_GPIO_PIN_10
  843. * @arg @ref LL_GPIO_PIN_11
  844. * @arg @ref LL_GPIO_PIN_12
  845. * @arg @ref LL_GPIO_PIN_13
  846. * @arg @ref LL_GPIO_PIN_14
  847. * @arg @ref LL_GPIO_PIN_15
  848. * @arg @ref LL_GPIO_PIN_ALL
  849. * @retval None
  850. */
  851. __STATIC_INLINE void LL_GPIO_TogglePin(GPIO_TypeDef *GPIOx, uint32_t PinMask)
  852. {
  853. WRITE_REG(GPIOx->ODR, READ_REG(GPIOx->ODR) ^ PinMask);
  854. }
  855. /**
  856. * @}
  857. */
  858. #if defined(USE_FULL_LL_DRIVER)
  859. /** @defgroup GPIO_LL_EF_Init Initialization and de-initialization functions
  860. * @{
  861. */
  862. ErrorStatus LL_GPIO_DeInit(GPIO_TypeDef *GPIOx);
  863. ErrorStatus LL_GPIO_Init(GPIO_TypeDef *GPIOx, LL_GPIO_InitTypeDef *GPIO_InitStruct);
  864. void LL_GPIO_StructInit(LL_GPIO_InitTypeDef *GPIO_InitStruct);
  865. /**
  866. * @}
  867. */
  868. #endif /* USE_FULL_LL_DRIVER */
  869. /**
  870. * @}
  871. */
  872. /**
  873. * @}
  874. */
  875. #endif /* defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOF) */
  876. /**
  877. * @}
  878. */
  879. #ifdef __cplusplus
  880. }
  881. #endif
  882. #endif /* __STM32F0xx_LL_GPIO_H */
  883. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/