Implement a secure ICS protocol targeting LoRa Node151 microcontroller for controlling irrigation.
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.
 
 
 
 
 
 

960 lines
37 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32l0xx_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 __STM32L0xx_LL_GPIO_H
  37. #define __STM32L0xx_LL_GPIO_H
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. /* Includes ------------------------------------------------------------------*/
  42. #include "stm32l0xx.h"
  43. /** @addtogroup STM32L0xx_LL_Driver
  44. * @{
  45. */
  46. #if defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOH)
  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 ((uint32_t)0x00000000U) /*!< Select input mode */
  130. #define LL_GPIO_MODE_OUTPUT GPIO_MODER_MODE0_0 /*!< Select output mode */
  131. #define LL_GPIO_MODE_ALTERNATE GPIO_MODER_MODE0_1 /*!< Select alternate function mode */
  132. #define LL_GPIO_MODE_ANALOG GPIO_MODER_MODE0 /*!< Select analog mode */
  133. /**
  134. * @}
  135. */
  136. /** @defgroup GPIO_LL_EC_OUTPUT Output Type
  137. * @{
  138. */
  139. #define LL_GPIO_OUTPUT_PUSHPULL ((uint32_t)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 ((uint32_t)0x00000000U) /*!< Select I/O low output speed */
  148. #define LL_GPIO_SPEED_FREQ_MEDIUM GPIO_OSPEEDER_OSPEED0_0 /*!< Select I/O medium output speed */
  149. #define LL_GPIO_SPEED_FREQ_HIGH GPIO_OSPEEDER_OSPEED0_1 /*!< Select I/O fast output speed */
  150. #define LL_GPIO_SPEED_FREQ_VERY_HIGH GPIO_OSPEEDER_OSPEED0 /*!< Select I/O high output speed */
  151. /**
  152. * @}
  153. */
  154. #define LL_GPIO_SPEED_LOW LL_GPIO_SPEED_FREQ_LOW
  155. #define LL_GPIO_SPEED_MEDIUM LL_GPIO_SPEED_FREQ_MEDIUM
  156. #define LL_GPIO_SPEED_FAST LL_GPIO_SPEED_FREQ_HIGH
  157. #define LL_GPIO_SPEED_HIGH LL_GPIO_SPEED_FREQ_VERY_HIGH
  158. /** @defgroup GPIO_LL_EC_PULL Pull Up Pull Down
  159. * @{
  160. */
  161. #define LL_GPIO_PULL_NO ((uint32_t)0x00000000U) /*!< Select I/O no pull */
  162. #define LL_GPIO_PULL_UP GPIO_PUPDR_PUPD0_0 /*!< Select I/O pull up */
  163. #define LL_GPIO_PULL_DOWN GPIO_PUPDR_PUPD0_1 /*!< Select I/O pull down */
  164. /**
  165. * @}
  166. */
  167. /** @defgroup GPIO_LL_EC_AF Alternate Function
  168. * @{
  169. */
  170. #define LL_GPIO_AF_0 ((uint32_t)0x0000000U) /*!< Select alternate function 0 */
  171. #define LL_GPIO_AF_1 ((uint32_t)0x0000001U) /*!< Select alternate function 1 */
  172. #define LL_GPIO_AF_2 ((uint32_t)0x0000002U) /*!< Select alternate function 2 */
  173. #define LL_GPIO_AF_3 ((uint32_t)0x0000003U) /*!< Select alternate function 3 */
  174. #define LL_GPIO_AF_4 ((uint32_t)0x0000004U) /*!< Select alternate function 4 */
  175. #define LL_GPIO_AF_5 ((uint32_t)0x0000005U) /*!< Select alternate function 5 */
  176. #define LL_GPIO_AF_6 ((uint32_t)0x0000006U) /*!< Select alternate function 6 */
  177. #define LL_GPIO_AF_7 ((uint32_t)0x0000007U) /*!< Select alternate function 7 */
  178. /**
  179. * @}
  180. */
  181. /**
  182. * @}
  183. */
  184. /* Exported macro ------------------------------------------------------------*/
  185. /** @defgroup GPIO_LL_Exported_Macros GPIO Exported Macros
  186. * @{
  187. */
  188. /** @defgroup GPIO_LL_EM_WRITE_READ Common Write and read registers Macros
  189. * @{
  190. */
  191. /**
  192. * @brief Write a value in GPIO register
  193. * @param __INSTANCE__ GPIO Instance
  194. * @param __REG__ Register to be written
  195. * @param __VALUE__ Value to be written in the register
  196. * @retval None
  197. */
  198. #define LL_GPIO_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
  199. /**
  200. * @brief Read a value in GPIO register
  201. * @param __INSTANCE__ GPIO Instance
  202. * @param __REG__ Register to be read
  203. * @retval Register value
  204. */
  205. #define LL_GPIO_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
  206. /**
  207. * @}
  208. */
  209. /**
  210. * @}
  211. */
  212. /* Exported functions --------------------------------------------------------*/
  213. /** @defgroup GPIO_LL_Exported_Functions GPIO Exported Functions
  214. * @{
  215. */
  216. /** @defgroup GPIO_LL_EF_Port_Configuration Port Configuration
  217. * @{
  218. */
  219. /**
  220. * @brief Configure gpio mode for a dedicated pin on dedicated port.
  221. * @note I/O mode can be Input mode, General purpose output, Alternate function mode or Analog.
  222. * @note Warning: only one pin can be passed as parameter.
  223. * @rmtoll MODER MODEy LL_GPIO_SetPinMode
  224. * @param GPIOx GPIO Port
  225. * @param Pin This parameter can be one of the following values:
  226. * @arg @ref LL_GPIO_PIN_0
  227. * @arg @ref LL_GPIO_PIN_1
  228. * @arg @ref LL_GPIO_PIN_2
  229. * @arg @ref LL_GPIO_PIN_3
  230. * @arg @ref LL_GPIO_PIN_4
  231. * @arg @ref LL_GPIO_PIN_5
  232. * @arg @ref LL_GPIO_PIN_6
  233. * @arg @ref LL_GPIO_PIN_7
  234. * @arg @ref LL_GPIO_PIN_8
  235. * @arg @ref LL_GPIO_PIN_9
  236. * @arg @ref LL_GPIO_PIN_10
  237. * @arg @ref LL_GPIO_PIN_11
  238. * @arg @ref LL_GPIO_PIN_12
  239. * @arg @ref LL_GPIO_PIN_13
  240. * @arg @ref LL_GPIO_PIN_14
  241. * @arg @ref LL_GPIO_PIN_15
  242. * @param Mode This parameter can be one of the following values:
  243. * @arg @ref LL_GPIO_MODE_INPUT
  244. * @arg @ref LL_GPIO_MODE_OUTPUT
  245. * @arg @ref LL_GPIO_MODE_ALTERNATE
  246. * @arg @ref LL_GPIO_MODE_ANALOG
  247. * @retval None
  248. */
  249. __STATIC_INLINE void LL_GPIO_SetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Mode)
  250. {
  251. MODIFY_REG(GPIOx->MODER, ((Pin * Pin) * GPIO_MODER_MODE0), ((Pin * Pin) * Mode));
  252. }
  253. /**
  254. * @brief Return gpio mode for a dedicated pin on dedicated port.
  255. * @note I/O mode can be Input mode, General purpose output, Alternate function mode or Analog.
  256. * @note Warning: only one pin can be passed as parameter.
  257. * @rmtoll MODER MODEy LL_GPIO_GetPinMode
  258. * @param GPIOx GPIO Port
  259. * @param Pin This parameter can be one of the following values:
  260. * @arg @ref LL_GPIO_PIN_0
  261. * @arg @ref LL_GPIO_PIN_1
  262. * @arg @ref LL_GPIO_PIN_2
  263. * @arg @ref LL_GPIO_PIN_3
  264. * @arg @ref LL_GPIO_PIN_4
  265. * @arg @ref LL_GPIO_PIN_5
  266. * @arg @ref LL_GPIO_PIN_6
  267. * @arg @ref LL_GPIO_PIN_7
  268. * @arg @ref LL_GPIO_PIN_8
  269. * @arg @ref LL_GPIO_PIN_9
  270. * @arg @ref LL_GPIO_PIN_10
  271. * @arg @ref LL_GPIO_PIN_11
  272. * @arg @ref LL_GPIO_PIN_12
  273. * @arg @ref LL_GPIO_PIN_13
  274. * @arg @ref LL_GPIO_PIN_14
  275. * @arg @ref LL_GPIO_PIN_15
  276. * @retval Returned value can be one of the following values:
  277. * @arg @ref LL_GPIO_MODE_INPUT
  278. * @arg @ref LL_GPIO_MODE_OUTPUT
  279. * @arg @ref LL_GPIO_MODE_ALTERNATE
  280. * @arg @ref LL_GPIO_MODE_ANALOG
  281. */
  282. __STATIC_INLINE uint32_t LL_GPIO_GetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin)
  283. {
  284. return (uint32_t)(READ_BIT(GPIOx->MODER, ((Pin * Pin) * GPIO_MODER_MODE0)) / (Pin * Pin));
  285. }
  286. /**
  287. * @brief Configure gpio output type for several pins on dedicated port.
  288. * @note Output type as to be set when gpio pin is in output or
  289. * alternate modes. Possible type are Push-pull or Open-drain.
  290. * @rmtoll OTYPER OTy LL_GPIO_SetPinOutputType
  291. * @param GPIOx GPIO Port
  292. * @param PinMask This parameter can be a combination of the following values:
  293. * @arg @ref LL_GPIO_PIN_0
  294. * @arg @ref LL_GPIO_PIN_1
  295. * @arg @ref LL_GPIO_PIN_2
  296. * @arg @ref LL_GPIO_PIN_3
  297. * @arg @ref LL_GPIO_PIN_4
  298. * @arg @ref LL_GPIO_PIN_5
  299. * @arg @ref LL_GPIO_PIN_6
  300. * @arg @ref LL_GPIO_PIN_7
  301. * @arg @ref LL_GPIO_PIN_8
  302. * @arg @ref LL_GPIO_PIN_9
  303. * @arg @ref LL_GPIO_PIN_10
  304. * @arg @ref LL_GPIO_PIN_11
  305. * @arg @ref LL_GPIO_PIN_12
  306. * @arg @ref LL_GPIO_PIN_13
  307. * @arg @ref LL_GPIO_PIN_14
  308. * @arg @ref LL_GPIO_PIN_15
  309. * @arg @ref LL_GPIO_PIN_ALL
  310. * @param OutputType This parameter can be one of the following values:
  311. * @arg @ref LL_GPIO_OUTPUT_PUSHPULL
  312. * @arg @ref LL_GPIO_OUTPUT_OPENDRAIN
  313. * @retval None
  314. */
  315. __STATIC_INLINE void LL_GPIO_SetPinOutputType(GPIO_TypeDef *GPIOx, uint32_t PinMask, uint32_t OutputType)
  316. {
  317. MODIFY_REG(GPIOx->OTYPER, PinMask, (PinMask * OutputType));
  318. }
  319. /**
  320. * @brief Return gpio output type for several pins on dedicated port.
  321. * @note Output type as to be set when gpio pin is in output or
  322. * alternate modes. Possible type are Push-pull or Open-drain.
  323. * @note Warning: only one pin can be passed as parameter.
  324. * @rmtoll OTYPER OTy LL_GPIO_GetPinOutputType
  325. * @param GPIOx GPIO Port
  326. * @param Pin This parameter can be one of the following values:
  327. * @arg @ref LL_GPIO_PIN_0
  328. * @arg @ref LL_GPIO_PIN_1
  329. * @arg @ref LL_GPIO_PIN_2
  330. * @arg @ref LL_GPIO_PIN_3
  331. * @arg @ref LL_GPIO_PIN_4
  332. * @arg @ref LL_GPIO_PIN_5
  333. * @arg @ref LL_GPIO_PIN_6
  334. * @arg @ref LL_GPIO_PIN_7
  335. * @arg @ref LL_GPIO_PIN_8
  336. * @arg @ref LL_GPIO_PIN_9
  337. * @arg @ref LL_GPIO_PIN_10
  338. * @arg @ref LL_GPIO_PIN_11
  339. * @arg @ref LL_GPIO_PIN_12
  340. * @arg @ref LL_GPIO_PIN_13
  341. * @arg @ref LL_GPIO_PIN_14
  342. * @arg @ref LL_GPIO_PIN_15
  343. * @arg @ref LL_GPIO_PIN_ALL
  344. * @retval Returned value can be one of the following values:
  345. * @arg @ref LL_GPIO_OUTPUT_PUSHPULL
  346. * @arg @ref LL_GPIO_OUTPUT_OPENDRAIN
  347. */
  348. __STATIC_INLINE uint32_t LL_GPIO_GetPinOutputType(GPIO_TypeDef *GPIOx, uint32_t Pin)
  349. {
  350. return (uint32_t)(READ_BIT(GPIOx->OTYPER, Pin) / Pin);
  351. }
  352. /**
  353. * @brief Configure gpio speed for a dedicated pin on dedicated port.
  354. * @note I/O speed can be Low, Medium, Fast or High speed.
  355. * @note Warning: only one pin can be passed as parameter.
  356. * @note Refer to datasheet for frequency specifications and the power
  357. * supply and load conditions for each speed.
  358. * @rmtoll OSPEEDR OSPEEDy LL_GPIO_SetPinSpeed
  359. * @param GPIOx GPIO Port
  360. * @param Pin This parameter can be one of the following values:
  361. * @arg @ref LL_GPIO_PIN_0
  362. * @arg @ref LL_GPIO_PIN_1
  363. * @arg @ref LL_GPIO_PIN_2
  364. * @arg @ref LL_GPIO_PIN_3
  365. * @arg @ref LL_GPIO_PIN_4
  366. * @arg @ref LL_GPIO_PIN_5
  367. * @arg @ref LL_GPIO_PIN_6
  368. * @arg @ref LL_GPIO_PIN_7
  369. * @arg @ref LL_GPIO_PIN_8
  370. * @arg @ref LL_GPIO_PIN_9
  371. * @arg @ref LL_GPIO_PIN_10
  372. * @arg @ref LL_GPIO_PIN_11
  373. * @arg @ref LL_GPIO_PIN_12
  374. * @arg @ref LL_GPIO_PIN_13
  375. * @arg @ref LL_GPIO_PIN_14
  376. * @arg @ref LL_GPIO_PIN_15
  377. * @param Speed This parameter can be one of the following values:
  378. * @arg @ref LL_GPIO_SPEED_FREQ_LOW
  379. * @arg @ref LL_GPIO_SPEED_FREQ_MEDIUM
  380. * @arg @ref LL_GPIO_SPEED_FREQ_HIGH
  381. * @arg @ref LL_GPIO_SPEED_FREQ_VERY_HIGH
  382. * @retval None
  383. */
  384. __STATIC_INLINE void LL_GPIO_SetPinSpeed(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Speed)
  385. {
  386. MODIFY_REG(GPIOx->OSPEEDR, ((Pin * Pin) * GPIO_OSPEEDER_OSPEED0), ((Pin * Pin) * Speed));
  387. }
  388. /**
  389. * @brief Return gpio speed for a dedicated pin on dedicated port.
  390. * @note I/O speed can be Low, Medium, Fast or High speed.
  391. * @note Warning: only one pin can be passed as parameter.
  392. * @note Refer to datasheet for frequency specifications and the power
  393. * supply and load conditions for each speed.
  394. * @rmtoll OSPEEDR OSPEEDy LL_GPIO_GetPinSpeed
  395. * @param GPIOx GPIO Port
  396. * @param Pin This parameter can be one of the following values:
  397. * @arg @ref LL_GPIO_PIN_0
  398. * @arg @ref LL_GPIO_PIN_1
  399. * @arg @ref LL_GPIO_PIN_2
  400. * @arg @ref LL_GPIO_PIN_3
  401. * @arg @ref LL_GPIO_PIN_4
  402. * @arg @ref LL_GPIO_PIN_5
  403. * @arg @ref LL_GPIO_PIN_6
  404. * @arg @ref LL_GPIO_PIN_7
  405. * @arg @ref LL_GPIO_PIN_8
  406. * @arg @ref LL_GPIO_PIN_9
  407. * @arg @ref LL_GPIO_PIN_10
  408. * @arg @ref LL_GPIO_PIN_11
  409. * @arg @ref LL_GPIO_PIN_12
  410. * @arg @ref LL_GPIO_PIN_13
  411. * @arg @ref LL_GPIO_PIN_14
  412. * @arg @ref LL_GPIO_PIN_15
  413. * @retval Returned value can be one of the following values:
  414. * @arg @ref LL_GPIO_SPEED_FREQ_LOW
  415. * @arg @ref LL_GPIO_SPEED_FREQ_MEDIUM
  416. * @arg @ref LL_GPIO_SPEED_FREQ_HIGH
  417. * @arg @ref LL_GPIO_SPEED_FREQ_VERY_HIGH
  418. */
  419. __STATIC_INLINE uint32_t LL_GPIO_GetPinSpeed(GPIO_TypeDef *GPIOx, uint32_t Pin)
  420. {
  421. return (uint32_t)(READ_BIT(GPIOx->OSPEEDR, ((Pin * Pin) * GPIO_OSPEEDER_OSPEED0)) / (Pin * Pin));
  422. }
  423. /**
  424. * @brief Configure gpio pull-up or pull-down for a dedicated pin on a dedicated port.
  425. * @note Warning: only one pin can be passed as parameter.
  426. * @rmtoll PUPDR PUPDy LL_GPIO_SetPinPull
  427. * @param GPIOx GPIO Port
  428. * @param Pin This parameter can be one of the following values:
  429. * @arg @ref LL_GPIO_PIN_0
  430. * @arg @ref LL_GPIO_PIN_1
  431. * @arg @ref LL_GPIO_PIN_2
  432. * @arg @ref LL_GPIO_PIN_3
  433. * @arg @ref LL_GPIO_PIN_4
  434. * @arg @ref LL_GPIO_PIN_5
  435. * @arg @ref LL_GPIO_PIN_6
  436. * @arg @ref LL_GPIO_PIN_7
  437. * @arg @ref LL_GPIO_PIN_8
  438. * @arg @ref LL_GPIO_PIN_9
  439. * @arg @ref LL_GPIO_PIN_10
  440. * @arg @ref LL_GPIO_PIN_11
  441. * @arg @ref LL_GPIO_PIN_12
  442. * @arg @ref LL_GPIO_PIN_13
  443. * @arg @ref LL_GPIO_PIN_14
  444. * @arg @ref LL_GPIO_PIN_15
  445. * @param Pull This parameter can be one of the following values:
  446. * @arg @ref LL_GPIO_PULL_NO
  447. * @arg @ref LL_GPIO_PULL_UP
  448. * @arg @ref LL_GPIO_PULL_DOWN
  449. * @retval None
  450. */
  451. __STATIC_INLINE void LL_GPIO_SetPinPull(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Pull)
  452. {
  453. MODIFY_REG(GPIOx->PUPDR, ((Pin * Pin) * GPIO_PUPDR_PUPD0), ((Pin * Pin) * Pull));
  454. }
  455. /**
  456. * @brief Return gpio pull-up or pull-down for a dedicated pin on a dedicated port
  457. * @note Warning: only one pin can be passed as parameter.
  458. * @rmtoll PUPDR PUPDy LL_GPIO_GetPinPull
  459. * @param GPIOx GPIO Port
  460. * @param Pin This parameter can be one of the following values:
  461. * @arg @ref LL_GPIO_PIN_0
  462. * @arg @ref LL_GPIO_PIN_1
  463. * @arg @ref LL_GPIO_PIN_2
  464. * @arg @ref LL_GPIO_PIN_3
  465. * @arg @ref LL_GPIO_PIN_4
  466. * @arg @ref LL_GPIO_PIN_5
  467. * @arg @ref LL_GPIO_PIN_6
  468. * @arg @ref LL_GPIO_PIN_7
  469. * @arg @ref LL_GPIO_PIN_8
  470. * @arg @ref LL_GPIO_PIN_9
  471. * @arg @ref LL_GPIO_PIN_10
  472. * @arg @ref LL_GPIO_PIN_11
  473. * @arg @ref LL_GPIO_PIN_12
  474. * @arg @ref LL_GPIO_PIN_13
  475. * @arg @ref LL_GPIO_PIN_14
  476. * @arg @ref LL_GPIO_PIN_15
  477. * @retval Returned value can be one of the following values:
  478. * @arg @ref LL_GPIO_PULL_NO
  479. * @arg @ref LL_GPIO_PULL_UP
  480. * @arg @ref LL_GPIO_PULL_DOWN
  481. */
  482. __STATIC_INLINE uint32_t LL_GPIO_GetPinPull(GPIO_TypeDef *GPIOx, uint32_t Pin)
  483. {
  484. return (uint32_t)(READ_BIT(GPIOx->PUPDR, ((Pin * Pin) * GPIO_PUPDR_PUPD0)) / (Pin * Pin));
  485. }
  486. /**
  487. * @brief Configure gpio alternate function of a dedicated pin from 0 to 7 for a dedicated port.
  488. * @note Possible values are from AF0 to AF7 depending on target.
  489. * @note Warning: only one pin can be passed as parameter.
  490. * @rmtoll AFRL AFSELy LL_GPIO_SetAFPin_0_7
  491. * @param GPIOx GPIO Port
  492. * @param Pin This parameter can be one of the following values:
  493. * @arg @ref LL_GPIO_PIN_0
  494. * @arg @ref LL_GPIO_PIN_1
  495. * @arg @ref LL_GPIO_PIN_2
  496. * @arg @ref LL_GPIO_PIN_3
  497. * @arg @ref LL_GPIO_PIN_4
  498. * @arg @ref LL_GPIO_PIN_5
  499. * @arg @ref LL_GPIO_PIN_6
  500. * @arg @ref LL_GPIO_PIN_7
  501. * @param Alternate This parameter can be one of the following values:
  502. * @arg @ref LL_GPIO_AF_0
  503. * @arg @ref LL_GPIO_AF_1
  504. * @arg @ref LL_GPIO_AF_2
  505. * @arg @ref LL_GPIO_AF_3
  506. * @arg @ref LL_GPIO_AF_4
  507. * @arg @ref LL_GPIO_AF_5
  508. * @arg @ref LL_GPIO_AF_6
  509. * @arg @ref LL_GPIO_AF_7
  510. * @retval None
  511. */
  512. __STATIC_INLINE void LL_GPIO_SetAFPin_0_7(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate)
  513. {
  514. MODIFY_REG(GPIOx->AFR[0], ((((Pin * Pin) * Pin) * Pin) * GPIO_AFRL_AFRL0),
  515. ((((Pin * Pin) * Pin) * Pin) * Alternate));
  516. }
  517. /**
  518. * @brief Return gpio alternate function of a dedicated pin from 0 to 7 for a dedicated port.
  519. * @rmtoll AFRL AFSELy LL_GPIO_GetAFPin_0_7
  520. * @param GPIOx GPIO Port
  521. * @param Pin This parameter can be one of the following values:
  522. * @arg @ref LL_GPIO_PIN_0
  523. * @arg @ref LL_GPIO_PIN_1
  524. * @arg @ref LL_GPIO_PIN_2
  525. * @arg @ref LL_GPIO_PIN_3
  526. * @arg @ref LL_GPIO_PIN_4
  527. * @arg @ref LL_GPIO_PIN_5
  528. * @arg @ref LL_GPIO_PIN_6
  529. * @arg @ref LL_GPIO_PIN_7
  530. * @retval Returned value can be one of the following values:
  531. * @arg @ref LL_GPIO_AF_0
  532. * @arg @ref LL_GPIO_AF_1
  533. * @arg @ref LL_GPIO_AF_2
  534. * @arg @ref LL_GPIO_AF_3
  535. * @arg @ref LL_GPIO_AF_4
  536. * @arg @ref LL_GPIO_AF_5
  537. * @arg @ref LL_GPIO_AF_6
  538. * @arg @ref LL_GPIO_AF_7
  539. */
  540. __STATIC_INLINE uint32_t LL_GPIO_GetAFPin_0_7(GPIO_TypeDef *GPIOx, uint32_t Pin)
  541. {
  542. return (uint32_t)(READ_BIT(GPIOx->AFR[0],
  543. ((((Pin * Pin) * Pin) * Pin) * GPIO_AFRL_AFRL0)) / (((Pin * Pin) * Pin) * Pin));
  544. }
  545. /**
  546. * @brief Configure gpio alternate function of a dedicated pin from 8 to 15 for a dedicated port.
  547. * @note Possible values are from AF0 to AF7 depending on target.
  548. * @note Warning: only one pin can be passed as parameter.
  549. * @rmtoll AFRH AFSELy LL_GPIO_SetAFPin_8_15
  550. * @param GPIOx GPIO Port
  551. * @param Pin This parameter can be one of the following values:
  552. * @arg @ref LL_GPIO_PIN_8
  553. * @arg @ref LL_GPIO_PIN_9
  554. * @arg @ref LL_GPIO_PIN_10
  555. * @arg @ref LL_GPIO_PIN_11
  556. * @arg @ref LL_GPIO_PIN_12
  557. * @arg @ref LL_GPIO_PIN_13
  558. * @arg @ref LL_GPIO_PIN_14
  559. * @arg @ref LL_GPIO_PIN_15
  560. * @param Alternate This parameter can be one of the following values:
  561. * @arg @ref LL_GPIO_AF_0
  562. * @arg @ref LL_GPIO_AF_1
  563. * @arg @ref LL_GPIO_AF_2
  564. * @arg @ref LL_GPIO_AF_3
  565. * @arg @ref LL_GPIO_AF_4
  566. * @arg @ref LL_GPIO_AF_5
  567. * @arg @ref LL_GPIO_AF_6
  568. * @arg @ref LL_GPIO_AF_7
  569. * @retval None
  570. */
  571. __STATIC_INLINE void LL_GPIO_SetAFPin_8_15(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate)
  572. {
  573. MODIFY_REG(GPIOx->AFR[1], (((((Pin >> 8U) * (Pin >> 8U)) * (Pin >> 8U)) * (Pin >> 8U)) * GPIO_AFRH_AFRH0),
  574. (((((Pin >> 8U) * (Pin >> 8U)) * (Pin >> 8U)) * (Pin >> 8U)) * Alternate));
  575. }
  576. /**
  577. * @brief Return gpio alternate function of a dedicated pin from 8 to 15 for a dedicated port.
  578. * @note Possible values are from AF0 to AF7 depending on target.
  579. * @rmtoll AFRH AFSELy LL_GPIO_GetAFPin_8_15
  580. * @param GPIOx GPIO Port
  581. * @param Pin This parameter can be one of the following values:
  582. * @arg @ref LL_GPIO_PIN_8
  583. * @arg @ref LL_GPIO_PIN_9
  584. * @arg @ref LL_GPIO_PIN_10
  585. * @arg @ref LL_GPIO_PIN_11
  586. * @arg @ref LL_GPIO_PIN_12
  587. * @arg @ref LL_GPIO_PIN_13
  588. * @arg @ref LL_GPIO_PIN_14
  589. * @arg @ref LL_GPIO_PIN_15
  590. * @retval Returned value can be one of the following values:
  591. * @arg @ref LL_GPIO_AF_0
  592. * @arg @ref LL_GPIO_AF_1
  593. * @arg @ref LL_GPIO_AF_2
  594. * @arg @ref LL_GPIO_AF_3
  595. * @arg @ref LL_GPIO_AF_4
  596. * @arg @ref LL_GPIO_AF_5
  597. * @arg @ref LL_GPIO_AF_6
  598. * @arg @ref LL_GPIO_AF_7
  599. */
  600. __STATIC_INLINE uint32_t LL_GPIO_GetAFPin_8_15(GPIO_TypeDef *GPIOx, uint32_t Pin)
  601. {
  602. return (uint32_t)(READ_BIT(GPIOx->AFR[1],
  603. (((((Pin >> 8U) * (Pin >> 8U)) * (Pin >> 8U)) * (Pin >> 8U)) * GPIO_AFRH_AFRH0)) / ((((Pin >> 8U) *
  604. (Pin >> 8U)) * (Pin >> 8U)) * (Pin >> 8U)));
  605. }
  606. /**
  607. * @brief Lock configuration of several pins for a dedicated port.
  608. * @note When the lock sequence has been applied on a port bit, the
  609. * value of this port bit can no longer be modified until the
  610. * next reset.
  611. * @note Each lock bit freezes a specific configuration register
  612. * (control and alternate function registers).
  613. * @rmtoll LCKR LCKK LL_GPIO_LockPin
  614. * @param GPIOx GPIO Port
  615. * @param PinMask This parameter can be a combination of the following values:
  616. * @arg @ref LL_GPIO_PIN_0
  617. * @arg @ref LL_GPIO_PIN_1
  618. * @arg @ref LL_GPIO_PIN_2
  619. * @arg @ref LL_GPIO_PIN_3
  620. * @arg @ref LL_GPIO_PIN_4
  621. * @arg @ref LL_GPIO_PIN_5
  622. * @arg @ref LL_GPIO_PIN_6
  623. * @arg @ref LL_GPIO_PIN_7
  624. * @arg @ref LL_GPIO_PIN_8
  625. * @arg @ref LL_GPIO_PIN_9
  626. * @arg @ref LL_GPIO_PIN_10
  627. * @arg @ref LL_GPIO_PIN_11
  628. * @arg @ref LL_GPIO_PIN_12
  629. * @arg @ref LL_GPIO_PIN_13
  630. * @arg @ref LL_GPIO_PIN_14
  631. * @arg @ref LL_GPIO_PIN_15
  632. * @arg @ref LL_GPIO_PIN_ALL
  633. * @retval None
  634. */
  635. __STATIC_INLINE void LL_GPIO_LockPin(GPIO_TypeDef *GPIOx, uint32_t PinMask)
  636. {
  637. __IO uint32_t temp;
  638. WRITE_REG(GPIOx->LCKR, GPIO_LCKR_LCKK | PinMask);
  639. WRITE_REG(GPIOx->LCKR, PinMask);
  640. WRITE_REG(GPIOx->LCKR, GPIO_LCKR_LCKK | PinMask);
  641. temp = READ_REG(GPIOx->LCKR);
  642. (void) temp;
  643. }
  644. /**
  645. * @brief Return 1 if all pins passed as parameter, of a dedicated port, are locked. else Return 0.
  646. * @rmtoll LCKR LCKy LL_GPIO_IsPinLocked
  647. * @param GPIOx GPIO Port
  648. * @param PinMask This parameter can be a combination of the following values:
  649. * @arg @ref LL_GPIO_PIN_0
  650. * @arg @ref LL_GPIO_PIN_1
  651. * @arg @ref LL_GPIO_PIN_2
  652. * @arg @ref LL_GPIO_PIN_3
  653. * @arg @ref LL_GPIO_PIN_4
  654. * @arg @ref LL_GPIO_PIN_5
  655. * @arg @ref LL_GPIO_PIN_6
  656. * @arg @ref LL_GPIO_PIN_7
  657. * @arg @ref LL_GPIO_PIN_8
  658. * @arg @ref LL_GPIO_PIN_9
  659. * @arg @ref LL_GPIO_PIN_10
  660. * @arg @ref LL_GPIO_PIN_11
  661. * @arg @ref LL_GPIO_PIN_12
  662. * @arg @ref LL_GPIO_PIN_13
  663. * @arg @ref LL_GPIO_PIN_14
  664. * @arg @ref LL_GPIO_PIN_15
  665. * @arg @ref LL_GPIO_PIN_ALL
  666. * @retval State of bit (1 or 0).
  667. */
  668. __STATIC_INLINE uint32_t LL_GPIO_IsPinLocked(GPIO_TypeDef *GPIOx, uint32_t PinMask)
  669. {
  670. return (READ_BIT(GPIOx->LCKR, PinMask) == (PinMask));
  671. }
  672. /**
  673. * @brief Return 1 if one of the pin of a dedicated port is locked. else return 0.
  674. * @rmtoll LCKR LCKK LL_GPIO_IsAnyPinLocked
  675. * @param GPIOx GPIO Port
  676. * @retval State of bit (1 or 0).
  677. */
  678. __STATIC_INLINE uint32_t LL_GPIO_IsAnyPinLocked(GPIO_TypeDef *GPIOx)
  679. {
  680. return (READ_BIT(GPIOx->LCKR, GPIO_LCKR_LCKK) == (GPIO_LCKR_LCKK));
  681. }
  682. /**
  683. * @}
  684. */
  685. /** @defgroup GPIO_LL_EF_Data_Access Data Access
  686. * @{
  687. */
  688. /**
  689. * @brief Return full input data register value for a dedicated port.
  690. * @rmtoll IDR IDy LL_GPIO_ReadInputPort
  691. * @param GPIOx GPIO Port
  692. * @retval Input data register value of port
  693. */
  694. __STATIC_INLINE uint32_t LL_GPIO_ReadInputPort(GPIO_TypeDef *GPIOx)
  695. {
  696. return (uint32_t)(READ_REG(GPIOx->IDR));
  697. }
  698. /**
  699. * @brief Return if input data level for several pins of dedicated port is high or low.
  700. * @rmtoll IDR IDy LL_GPIO_IsInputPinSet
  701. * @param GPIOx GPIO Port
  702. * @param PinMask This parameter can be a combination of the following values:
  703. * @arg @ref LL_GPIO_PIN_0
  704. * @arg @ref LL_GPIO_PIN_1
  705. * @arg @ref LL_GPIO_PIN_2
  706. * @arg @ref LL_GPIO_PIN_3
  707. * @arg @ref LL_GPIO_PIN_4
  708. * @arg @ref LL_GPIO_PIN_5
  709. * @arg @ref LL_GPIO_PIN_6
  710. * @arg @ref LL_GPIO_PIN_7
  711. * @arg @ref LL_GPIO_PIN_8
  712. * @arg @ref LL_GPIO_PIN_9
  713. * @arg @ref LL_GPIO_PIN_10
  714. * @arg @ref LL_GPIO_PIN_11
  715. * @arg @ref LL_GPIO_PIN_12
  716. * @arg @ref LL_GPIO_PIN_13
  717. * @arg @ref LL_GPIO_PIN_14
  718. * @arg @ref LL_GPIO_PIN_15
  719. * @arg @ref LL_GPIO_PIN_ALL
  720. * @retval State of bit (1 or 0).
  721. */
  722. __STATIC_INLINE uint32_t LL_GPIO_IsInputPinSet(GPIO_TypeDef *GPIOx, uint32_t PinMask)
  723. {
  724. return (READ_BIT(GPIOx->IDR, PinMask) == (PinMask));
  725. }
  726. /**
  727. * @brief Write output data register for the port.
  728. * @rmtoll ODR ODy LL_GPIO_WriteOutputPort
  729. * @param GPIOx GPIO Port
  730. * @param PortValue Level value for each pin of the port
  731. * @retval None
  732. */
  733. __STATIC_INLINE void LL_GPIO_WriteOutputPort(GPIO_TypeDef *GPIOx, uint32_t PortValue)
  734. {
  735. WRITE_REG(GPIOx->ODR, PortValue);
  736. }
  737. /**
  738. * @brief Return full output data register value for a dedicated port.
  739. * @rmtoll ODR ODy LL_GPIO_ReadOutputPort
  740. * @param GPIOx GPIO Port
  741. * @retval Output data register value of port
  742. */
  743. __STATIC_INLINE uint32_t LL_GPIO_ReadOutputPort(GPIO_TypeDef *GPIOx)
  744. {
  745. return (uint32_t)(READ_REG(GPIOx->ODR));
  746. }
  747. /**
  748. * @brief Return if input data level for several pins of dedicated port is high or low.
  749. * @rmtoll ODR ODy LL_GPIO_IsOutputPinSet
  750. * @param GPIOx GPIO Port
  751. * @param PinMask This parameter can be a combination of the following values:
  752. * @arg @ref LL_GPIO_PIN_0
  753. * @arg @ref LL_GPIO_PIN_1
  754. * @arg @ref LL_GPIO_PIN_2
  755. * @arg @ref LL_GPIO_PIN_3
  756. * @arg @ref LL_GPIO_PIN_4
  757. * @arg @ref LL_GPIO_PIN_5
  758. * @arg @ref LL_GPIO_PIN_6
  759. * @arg @ref LL_GPIO_PIN_7
  760. * @arg @ref LL_GPIO_PIN_8
  761. * @arg @ref LL_GPIO_PIN_9
  762. * @arg @ref LL_GPIO_PIN_10
  763. * @arg @ref LL_GPIO_PIN_11
  764. * @arg @ref LL_GPIO_PIN_12
  765. * @arg @ref LL_GPIO_PIN_13
  766. * @arg @ref LL_GPIO_PIN_14
  767. * @arg @ref LL_GPIO_PIN_15
  768. * @arg @ref LL_GPIO_PIN_ALL
  769. * @retval State of bit (1 or 0).
  770. */
  771. __STATIC_INLINE uint32_t LL_GPIO_IsOutputPinSet(GPIO_TypeDef *GPIOx, uint32_t PinMask)
  772. {
  773. return (READ_BIT(GPIOx->ODR, PinMask) == (PinMask));
  774. }
  775. /**
  776. * @brief Set several pins to high level on dedicated gpio port.
  777. * @rmtoll BSRR BSy LL_GPIO_SetOutputPin
  778. * @param GPIOx GPIO Port
  779. * @param PinMask This parameter can be a combination of the following values:
  780. * @arg @ref LL_GPIO_PIN_0
  781. * @arg @ref LL_GPIO_PIN_1
  782. * @arg @ref LL_GPIO_PIN_2
  783. * @arg @ref LL_GPIO_PIN_3
  784. * @arg @ref LL_GPIO_PIN_4
  785. * @arg @ref LL_GPIO_PIN_5
  786. * @arg @ref LL_GPIO_PIN_6
  787. * @arg @ref LL_GPIO_PIN_7
  788. * @arg @ref LL_GPIO_PIN_8
  789. * @arg @ref LL_GPIO_PIN_9
  790. * @arg @ref LL_GPIO_PIN_10
  791. * @arg @ref LL_GPIO_PIN_11
  792. * @arg @ref LL_GPIO_PIN_12
  793. * @arg @ref LL_GPIO_PIN_13
  794. * @arg @ref LL_GPIO_PIN_14
  795. * @arg @ref LL_GPIO_PIN_15
  796. * @arg @ref LL_GPIO_PIN_ALL
  797. * @retval None
  798. */
  799. __STATIC_INLINE void LL_GPIO_SetOutputPin(GPIO_TypeDef *GPIOx, uint32_t PinMask)
  800. {
  801. WRITE_REG(GPIOx->BSRR, PinMask);
  802. }
  803. /**
  804. * @brief Set several pins to low level on dedicated gpio port.
  805. * @rmtoll BRR BRy LL_GPIO_ResetOutputPin
  806. * @param GPIOx GPIO Port
  807. * @param PinMask This parameter can be a combination of the following values:
  808. * @arg @ref LL_GPIO_PIN_0
  809. * @arg @ref LL_GPIO_PIN_1
  810. * @arg @ref LL_GPIO_PIN_2
  811. * @arg @ref LL_GPIO_PIN_3
  812. * @arg @ref LL_GPIO_PIN_4
  813. * @arg @ref LL_GPIO_PIN_5
  814. * @arg @ref LL_GPIO_PIN_6
  815. * @arg @ref LL_GPIO_PIN_7
  816. * @arg @ref LL_GPIO_PIN_8
  817. * @arg @ref LL_GPIO_PIN_9
  818. * @arg @ref LL_GPIO_PIN_10
  819. * @arg @ref LL_GPIO_PIN_11
  820. * @arg @ref LL_GPIO_PIN_12
  821. * @arg @ref LL_GPIO_PIN_13
  822. * @arg @ref LL_GPIO_PIN_14
  823. * @arg @ref LL_GPIO_PIN_15
  824. * @arg @ref LL_GPIO_PIN_ALL
  825. * @retval None
  826. */
  827. __STATIC_INLINE void LL_GPIO_ResetOutputPin(GPIO_TypeDef *GPIOx, uint32_t PinMask)
  828. {
  829. WRITE_REG(GPIOx->BRR, PinMask);
  830. }
  831. /**
  832. * @brief Toggle data value for several pin of dedicated port.
  833. * @rmtoll ODR ODy LL_GPIO_TogglePin
  834. * @param GPIOx GPIO Port
  835. * @param PinMask This parameter can be a combination of the following values:
  836. * @arg @ref LL_GPIO_PIN_0
  837. * @arg @ref LL_GPIO_PIN_1
  838. * @arg @ref LL_GPIO_PIN_2
  839. * @arg @ref LL_GPIO_PIN_3
  840. * @arg @ref LL_GPIO_PIN_4
  841. * @arg @ref LL_GPIO_PIN_5
  842. * @arg @ref LL_GPIO_PIN_6
  843. * @arg @ref LL_GPIO_PIN_7
  844. * @arg @ref LL_GPIO_PIN_8
  845. * @arg @ref LL_GPIO_PIN_9
  846. * @arg @ref LL_GPIO_PIN_10
  847. * @arg @ref LL_GPIO_PIN_11
  848. * @arg @ref LL_GPIO_PIN_12
  849. * @arg @ref LL_GPIO_PIN_13
  850. * @arg @ref LL_GPIO_PIN_14
  851. * @arg @ref LL_GPIO_PIN_15
  852. * @arg @ref LL_GPIO_PIN_ALL
  853. * @retval None
  854. */
  855. __STATIC_INLINE void LL_GPIO_TogglePin(GPIO_TypeDef *GPIOx, uint32_t PinMask)
  856. {
  857. WRITE_REG(GPIOx->ODR, READ_REG(GPIOx->ODR) ^ PinMask);
  858. }
  859. /**
  860. * @}
  861. */
  862. #if defined(USE_FULL_LL_DRIVER)
  863. /** @defgroup GPIO_LL_EF_Init Initialization and de-initialization functions
  864. * @{
  865. */
  866. ErrorStatus LL_GPIO_DeInit(GPIO_TypeDef *GPIOx);
  867. ErrorStatus LL_GPIO_Init(GPIO_TypeDef *GPIOx, LL_GPIO_InitTypeDef *GPIO_InitStruct);
  868. void LL_GPIO_StructInit(LL_GPIO_InitTypeDef *GPIO_InitStruct);
  869. /**
  870. * @}
  871. */
  872. #endif /* USE_FULL_LL_DRIVER */
  873. /**
  874. * @}
  875. */
  876. /**
  877. * @}
  878. */
  879. #endif /* defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOH) */
  880. /**
  881. * @}
  882. */
  883. #ifdef __cplusplus
  884. }
  885. #endif
  886. #endif /* __STM32L0xx_LL_GPIO_H */
  887. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/