xref: /btstack/port/stm32-wb55xx-nucleo-freertos/Drivers/STM32WBxx_HAL_Driver/Inc/stm32wbxx_ll_gpio.h (revision 0561b2d8d5dba972c7daa57d5e677f7a1327edfd)
1 /**
2   ******************************************************************************
3   * @file    stm32wbxx_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) 2019 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 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef STM32WBxx_LL_GPIO_H
22 #define STM32WBxx_LL_GPIO_H
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32wbxx.h"
30 
31 /** @addtogroup STM32WBxx_LL_Driver
32   * @{
33   */
34 
35 #if defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOH)
36 
37 /** @defgroup GPIO_LL GPIO
38   * @{
39   */
40 /** MISRA C:2012 deviation rule has been granted for following rules:
41   * Rule-18.1_d - Medium: Array pointer `GPIOx' is accessed with index [..,..]
42   * which may be out of array bounds [..,UNKNOWN] in following APIs:
43   * LL_GPIO_GetAFPin_0_7
44   * LL_GPIO_SetAFPin_0_7
45   * LL_GPIO_SetAFPin_8_15
46   * LL_GPIO_GetAFPin_8_15
47   */
48 
49 /* Private types -------------------------------------------------------------*/
50 /* Private variables ---------------------------------------------------------*/
51 /* Private constants ---------------------------------------------------------*/
52 /* Private macros ------------------------------------------------------------*/
53 #if defined(USE_FULL_LL_DRIVER)
54 /** @defgroup GPIO_LL_Private_Macros GPIO Private Macros
55   * @{
56   */
57 
58 /**
59   * @}
60   */
61 #endif /*USE_FULL_LL_DRIVER*/
62 
63 /* Exported types ------------------------------------------------------------*/
64 #if defined(USE_FULL_LL_DRIVER)
65 /** @defgroup GPIO_LL_ES_INIT GPIO Exported Init structures
66   * @{
67   */
68 
69 /**
70   * @brief LL GPIO Init Structure definition
71   */
72 typedef struct
73 {
74   uint32_t Pin;          /*!< Specifies the GPIO pins to be configured.
75                               This parameter can be any value of @ref GPIO_LL_EC_PIN */
76 
77   uint32_t Mode;         /*!< Specifies the operating mode for the selected pins.
78                               This parameter can be a value of @ref GPIO_LL_EC_MODE.
79 
80                               GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinMode().*/
81 
82   uint32_t Speed;        /*!< Specifies the speed for the selected pins.
83                               This parameter can be a value of @ref GPIO_LL_EC_SPEED.
84 
85                               GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinSpeed().*/
86 
87   uint32_t OutputType;   /*!< Specifies the operating output type for the selected pins.
88                               This parameter can be a value of @ref GPIO_LL_EC_OUTPUT.
89 
90                               GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinOutputType().*/
91 
92   uint32_t Pull;         /*!< Specifies the operating Pull-up/Pull down for the selected pins.
93                               This parameter can be a value of @ref GPIO_LL_EC_PULL.
94 
95                               GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinPull().*/
96 
97   uint32_t Alternate;    /*!< Specifies the Peripheral to be connected to the selected pins.
98                               This parameter can be a value of @ref GPIO_LL_EC_AF.
99 
100                               GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetAFPin_0_7() and LL_GPIO_SetAFPin_8_15().*/
101 } LL_GPIO_InitTypeDef;
102 
103 /**
104   * @}
105   */
106 #endif /* USE_FULL_LL_DRIVER */
107 
108 /* Exported constants --------------------------------------------------------*/
109 /** @defgroup GPIO_LL_Exported_Constants GPIO Exported Constants
110   * @{
111   */
112 
113 /** @defgroup GPIO_LL_EC_PIN PIN
114   * @{
115   */
116 #define LL_GPIO_PIN_0                      GPIO_BSRR_BS0 /*!< Select pin 0 */
117 #define LL_GPIO_PIN_1                      GPIO_BSRR_BS1 /*!< Select pin 1 */
118 #define LL_GPIO_PIN_2                      GPIO_BSRR_BS2 /*!< Select pin 2 */
119 #define LL_GPIO_PIN_3                      GPIO_BSRR_BS3 /*!< Select pin 3 */
120 #define LL_GPIO_PIN_4                      GPIO_BSRR_BS4 /*!< Select pin 4 */
121 #define LL_GPIO_PIN_5                      GPIO_BSRR_BS5 /*!< Select pin 5 */
122 #define LL_GPIO_PIN_6                      GPIO_BSRR_BS6 /*!< Select pin 6 */
123 #define LL_GPIO_PIN_7                      GPIO_BSRR_BS7 /*!< Select pin 7 */
124 #define LL_GPIO_PIN_8                      GPIO_BSRR_BS8 /*!< Select pin 8 */
125 #define LL_GPIO_PIN_9                      GPIO_BSRR_BS9 /*!< Select pin 9 */
126 #define LL_GPIO_PIN_10                     GPIO_BSRR_BS10 /*!< Select pin 10 */
127 #define LL_GPIO_PIN_11                     GPIO_BSRR_BS11 /*!< Select pin 11 */
128 #define LL_GPIO_PIN_12                     GPIO_BSRR_BS12 /*!< Select pin 12 */
129 #define LL_GPIO_PIN_13                     GPIO_BSRR_BS13 /*!< Select pin 13 */
130 #define LL_GPIO_PIN_14                     GPIO_BSRR_BS14 /*!< Select pin 14 */
131 #define LL_GPIO_PIN_15                     GPIO_BSRR_BS15 /*!< Select pin 15 */
132 #define LL_GPIO_PIN_ALL                    (GPIO_BSRR_BS0 | GPIO_BSRR_BS1  | GPIO_BSRR_BS2  | \
133                                            GPIO_BSRR_BS3  | GPIO_BSRR_BS4  | GPIO_BSRR_BS5  | \
134                                            GPIO_BSRR_BS6  | GPIO_BSRR_BS7  | GPIO_BSRR_BS8  | \
135                                            GPIO_BSRR_BS9  | GPIO_BSRR_BS10 | GPIO_BSRR_BS11 | \
136                                            GPIO_BSRR_BS12 | GPIO_BSRR_BS13 | GPIO_BSRR_BS14 | \
137                                            GPIO_BSRR_BS15) /*!< Select all pins */
138 /**
139   * @}
140   */
141 
142 /** @defgroup GPIO_LL_EC_MODE Mode
143   * @{
144   */
145 #define LL_GPIO_MODE_INPUT                 (0x00000000U) /*!< Select input mode */
146 #define LL_GPIO_MODE_OUTPUT                GPIO_MODER_MODE0_0  /*!< Select output mode */
147 #define LL_GPIO_MODE_ALTERNATE             GPIO_MODER_MODE0_1  /*!< Select alternate function mode */
148 #define LL_GPIO_MODE_ANALOG                GPIO_MODER_MODE0    /*!< Select analog mode */
149 /**
150   * @}
151   */
152 
153 /** @defgroup GPIO_LL_EC_OUTPUT Output Type
154   * @{
155   */
156 #define LL_GPIO_OUTPUT_PUSHPULL            (0x00000000U) /*!< Select push-pull as output type */
157 #define LL_GPIO_OUTPUT_OPENDRAIN           GPIO_OTYPER_OT0 /*!< Select open-drain as output type */
158 /**
159   * @}
160   */
161 
162 /** @defgroup GPIO_LL_EC_SPEED Output Speed
163   * @{
164   */
165 #define LL_GPIO_SPEED_FREQ_LOW             (0x00000000U) /*!< Select I/O low output speed    */
166 #define LL_GPIO_SPEED_FREQ_MEDIUM          GPIO_OSPEEDR_OSPEED0_0 /*!< Select I/O medium output speed */
167 #define LL_GPIO_SPEED_FREQ_HIGH            GPIO_OSPEEDR_OSPEED0_1 /*!< Select I/O fast output speed   */
168 #define LL_GPIO_SPEED_FREQ_VERY_HIGH       GPIO_OSPEEDR_OSPEED0   /*!< Select I/O high output speed   */
169 /**
170   * @}
171   */
172 
173 /** @defgroup GPIO_LL_EC_PULL Pull Up Pull Down
174   * @{
175   */
176 #define LL_GPIO_PULL_NO                    (0x00000000U) /*!< Select I/O no pull */
177 #define LL_GPIO_PULL_UP                    GPIO_PUPDR_PUPD0_0 /*!< Select I/O pull up */
178 #define LL_GPIO_PULL_DOWN                  GPIO_PUPDR_PUPD0_1 /*!< Select I/O pull down */
179 /**
180   * @}
181   */
182 
183 /** @defgroup GPIO_LL_EC_AF Alternate Function
184   * @{
185   */
186 #define LL_GPIO_AF_0                       (0x0000000U) /*!< Select alternate function 0 */
187 #define LL_GPIO_AF_1                       (0x0000001U) /*!< Select alternate function 1 */
188 #define LL_GPIO_AF_2                       (0x0000002U) /*!< Select alternate function 2 */
189 #define LL_GPIO_AF_3                       (0x0000003U) /*!< Select alternate function 3 */
190 #define LL_GPIO_AF_4                       (0x0000004U) /*!< Select alternate function 4 */
191 #define LL_GPIO_AF_5                       (0x0000005U) /*!< Select alternate function 5 */
192 #define LL_GPIO_AF_6                       (0x0000006U) /*!< Select alternate function 6 */
193 #define LL_GPIO_AF_7                       (0x0000007U) /*!< Select alternate function 7 */
194 #define LL_GPIO_AF_8                       (0x0000008U) /*!< Select alternate function 8 */
195 #define LL_GPIO_AF_9                       (0x0000009U) /*!< Select alternate function 9 */
196 #define LL_GPIO_AF_10                      (0x000000AU) /*!< Select alternate function 10 */
197 #define LL_GPIO_AF_11                      (0x000000BU) /*!< Select alternate function 11 */
198 #define LL_GPIO_AF_12                      (0x000000CU) /*!< Select alternate function 12 */
199 #define LL_GPIO_AF_13                      (0x000000DU) /*!< Select alternate function 13 */
200 #define LL_GPIO_AF_14                      (0x000000EU) /*!< Select alternate function 14 */
201 #define LL_GPIO_AF_15                      (0x000000FU) /*!< Select alternate function 15 */
202 /**
203   * @}
204   */
205 
206 /**
207   * @}
208   */
209 
210 /* Exported macro ------------------------------------------------------------*/
211 /** @defgroup GPIO_LL_Exported_Macros GPIO Exported Macros
212   * @{
213   */
214 
215 /** @defgroup GPIO_LL_EM_WRITE_READ Common Write and read registers Macros
216   * @{
217   */
218 
219 /**
220   * @brief  Write a value in GPIO register
221   * @param  __INSTANCE__ GPIO Instance
222   * @param  __REG__ Register to be written
223   * @param  __VALUE__ Value to be written in the register
224   * @retval None
225   */
226 #define LL_GPIO_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
227 
228 /**
229   * @brief  Read a value in GPIO register
230   * @param  __INSTANCE__ GPIO Instance
231   * @param  __REG__ Register to be read
232   * @retval Register value
233   */
234 #define LL_GPIO_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
235 /**
236   * @}
237   */
238 
239 /**
240   * @}
241   */
242 
243 /* Exported functions --------------------------------------------------------*/
244 /** @defgroup GPIO_LL_Exported_Functions GPIO Exported Functions
245   * @{
246   */
247 
248 /** @defgroup GPIO_LL_EF_Port_Configuration Port Configuration
249   * @{
250   */
251 
252 /**
253   * @brief  Configure gpio mode for a dedicated pin on dedicated port.
254   * @note   I/O mode can be Input mode, General purpose output, Alternate function mode or Analog.
255   * @note   Warning: only one pin can be passed as parameter.
256   * @rmtoll MODER        MODEy         LL_GPIO_SetPinMode
257   * @param  GPIOx GPIO Port
258   * @param  Pin This parameter can be one of the following values:
259   *         @arg @ref LL_GPIO_PIN_0
260   *         @arg @ref LL_GPIO_PIN_1
261   *         @arg @ref LL_GPIO_PIN_2
262   *         @arg @ref LL_GPIO_PIN_3
263   *         @arg @ref LL_GPIO_PIN_4
264   *         @arg @ref LL_GPIO_PIN_5
265   *         @arg @ref LL_GPIO_PIN_6
266   *         @arg @ref LL_GPIO_PIN_7
267   *         @arg @ref LL_GPIO_PIN_8
268   *         @arg @ref LL_GPIO_PIN_9
269   *         @arg @ref LL_GPIO_PIN_10
270   *         @arg @ref LL_GPIO_PIN_11
271   *         @arg @ref LL_GPIO_PIN_12
272   *         @arg @ref LL_GPIO_PIN_13
273   *         @arg @ref LL_GPIO_PIN_14
274   *         @arg @ref LL_GPIO_PIN_15
275   * @param  Mode This parameter can be one of the following values:
276   *         @arg @ref LL_GPIO_MODE_INPUT
277   *         @arg @ref LL_GPIO_MODE_OUTPUT
278   *         @arg @ref LL_GPIO_MODE_ALTERNATE
279   *         @arg @ref LL_GPIO_MODE_ANALOG
280   * @retval None
281   */
LL_GPIO_SetPinMode(GPIO_TypeDef * GPIOx,uint32_t Pin,uint32_t Mode)282 __STATIC_INLINE void LL_GPIO_SetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Mode)
283 {
284   MODIFY_REG(GPIOx->MODER, (GPIO_MODER_MODE0 << (POSITION_VAL(Pin) * 2U)), (Mode << (POSITION_VAL(Pin) * 2U)));
285 }
286 
287 /**
288   * @brief  Return gpio mode for a dedicated pin on dedicated port.
289   * @note   I/O mode can be Input mode, General purpose output, Alternate function mode or Analog.
290   * @note   Warning: only one pin can be passed as parameter.
291   * @rmtoll MODER        MODEy         LL_GPIO_GetPinMode
292   * @param  GPIOx GPIO Port
293   * @param  Pin This parameter can be one of the following values:
294   *         @arg @ref LL_GPIO_PIN_0
295   *         @arg @ref LL_GPIO_PIN_1
296   *         @arg @ref LL_GPIO_PIN_2
297   *         @arg @ref LL_GPIO_PIN_3
298   *         @arg @ref LL_GPIO_PIN_4
299   *         @arg @ref LL_GPIO_PIN_5
300   *         @arg @ref LL_GPIO_PIN_6
301   *         @arg @ref LL_GPIO_PIN_7
302   *         @arg @ref LL_GPIO_PIN_8
303   *         @arg @ref LL_GPIO_PIN_9
304   *         @arg @ref LL_GPIO_PIN_10
305   *         @arg @ref LL_GPIO_PIN_11
306   *         @arg @ref LL_GPIO_PIN_12
307   *         @arg @ref LL_GPIO_PIN_13
308   *         @arg @ref LL_GPIO_PIN_14
309   *         @arg @ref LL_GPIO_PIN_15
310   * @retval Returned value can be one of the following values:
311   *         @arg @ref LL_GPIO_MODE_INPUT
312   *         @arg @ref LL_GPIO_MODE_OUTPUT
313   *         @arg @ref LL_GPIO_MODE_ALTERNATE
314   *         @arg @ref LL_GPIO_MODE_ANALOG
315   */
LL_GPIO_GetPinMode(GPIO_TypeDef * GPIOx,uint32_t Pin)316 __STATIC_INLINE uint32_t LL_GPIO_GetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin)
317 {
318   return (uint32_t)(READ_BIT(GPIOx->MODER,
319                              (GPIO_MODER_MODE0 << (POSITION_VAL(Pin) * 2U))) >> (POSITION_VAL(Pin) * 2U));
320 }
321 
322 /**
323   * @brief  Configure gpio output type for several pins on dedicated port.
324   * @note   Output type as to be set when gpio pin is in output or
325   *         alternate modes. Possible type are Push-pull or Open-drain.
326   * @rmtoll OTYPER       OTy           LL_GPIO_SetPinOutputType
327   * @param  GPIOx GPIO Port
328   * @param  PinMask This parameter can be a combination of the following values:
329   *         @arg @ref LL_GPIO_PIN_0
330   *         @arg @ref LL_GPIO_PIN_1
331   *         @arg @ref LL_GPIO_PIN_2
332   *         @arg @ref LL_GPIO_PIN_3
333   *         @arg @ref LL_GPIO_PIN_4
334   *         @arg @ref LL_GPIO_PIN_5
335   *         @arg @ref LL_GPIO_PIN_6
336   *         @arg @ref LL_GPIO_PIN_7
337   *         @arg @ref LL_GPIO_PIN_8
338   *         @arg @ref LL_GPIO_PIN_9
339   *         @arg @ref LL_GPIO_PIN_10
340   *         @arg @ref LL_GPIO_PIN_11
341   *         @arg @ref LL_GPIO_PIN_12
342   *         @arg @ref LL_GPIO_PIN_13
343   *         @arg @ref LL_GPIO_PIN_14
344   *         @arg @ref LL_GPIO_PIN_15
345   *         @arg @ref LL_GPIO_PIN_ALL
346   * @param  OutputType This parameter can be one of the following values:
347   *         @arg @ref LL_GPIO_OUTPUT_PUSHPULL
348   *         @arg @ref LL_GPIO_OUTPUT_OPENDRAIN
349   * @retval None
350   */
LL_GPIO_SetPinOutputType(GPIO_TypeDef * GPIOx,uint32_t PinMask,uint32_t OutputType)351 __STATIC_INLINE void LL_GPIO_SetPinOutputType(GPIO_TypeDef *GPIOx, uint32_t PinMask, uint32_t OutputType)
352 {
353   MODIFY_REG(GPIOx->OTYPER, PinMask, (PinMask * OutputType));
354 }
355 
356 /**
357   * @brief  Return gpio output type for several pins on dedicated port.
358   * @note   Output type as to be set when gpio pin is in output or
359   *         alternate modes. Possible type are Push-pull or Open-drain.
360   * @note   Warning: only one pin can be passed as parameter.
361   * @rmtoll OTYPER       OTy           LL_GPIO_GetPinOutputType
362   * @param  GPIOx GPIO Port
363   * @param  Pin This parameter can be one of the following values:
364   *         @arg @ref LL_GPIO_PIN_0
365   *         @arg @ref LL_GPIO_PIN_1
366   *         @arg @ref LL_GPIO_PIN_2
367   *         @arg @ref LL_GPIO_PIN_3
368   *         @arg @ref LL_GPIO_PIN_4
369   *         @arg @ref LL_GPIO_PIN_5
370   *         @arg @ref LL_GPIO_PIN_6
371   *         @arg @ref LL_GPIO_PIN_7
372   *         @arg @ref LL_GPIO_PIN_8
373   *         @arg @ref LL_GPIO_PIN_9
374   *         @arg @ref LL_GPIO_PIN_10
375   *         @arg @ref LL_GPIO_PIN_11
376   *         @arg @ref LL_GPIO_PIN_12
377   *         @arg @ref LL_GPIO_PIN_13
378   *         @arg @ref LL_GPIO_PIN_14
379   *         @arg @ref LL_GPIO_PIN_15
380   *         @arg @ref LL_GPIO_PIN_ALL
381   * @retval Returned value can be one of the following values:
382   *         @arg @ref LL_GPIO_OUTPUT_PUSHPULL
383   *         @arg @ref LL_GPIO_OUTPUT_OPENDRAIN
384   */
LL_GPIO_GetPinOutputType(GPIO_TypeDef * GPIOx,uint32_t Pin)385 __STATIC_INLINE uint32_t LL_GPIO_GetPinOutputType(GPIO_TypeDef *GPIOx, uint32_t Pin)
386 {
387   return (uint32_t)(READ_BIT(GPIOx->OTYPER, Pin) >> POSITION_VAL(Pin));
388 }
389 
390 /**
391   * @brief  Configure gpio speed for a dedicated pin on dedicated port.
392   * @note   I/O speed can be Low, Medium, Fast or High speed.
393   * @note   Warning: only one pin can be passed as parameter.
394   * @note   Refer to datasheet for frequency specifications and the power
395   *         supply and load conditions for each speed.
396   * @rmtoll OSPEEDR      OSPEEDy       LL_GPIO_SetPinSpeed
397   * @param  GPIOx GPIO Port
398   * @param  Pin This parameter can be one of the following values:
399   *         @arg @ref LL_GPIO_PIN_0
400   *         @arg @ref LL_GPIO_PIN_1
401   *         @arg @ref LL_GPIO_PIN_2
402   *         @arg @ref LL_GPIO_PIN_3
403   *         @arg @ref LL_GPIO_PIN_4
404   *         @arg @ref LL_GPIO_PIN_5
405   *         @arg @ref LL_GPIO_PIN_6
406   *         @arg @ref LL_GPIO_PIN_7
407   *         @arg @ref LL_GPIO_PIN_8
408   *         @arg @ref LL_GPIO_PIN_9
409   *         @arg @ref LL_GPIO_PIN_10
410   *         @arg @ref LL_GPIO_PIN_11
411   *         @arg @ref LL_GPIO_PIN_12
412   *         @arg @ref LL_GPIO_PIN_13
413   *         @arg @ref LL_GPIO_PIN_14
414   *         @arg @ref LL_GPIO_PIN_15
415   * @param  Speed This parameter can be one of the following values:
416   *         @arg @ref LL_GPIO_SPEED_FREQ_LOW
417   *         @arg @ref LL_GPIO_SPEED_FREQ_MEDIUM
418   *         @arg @ref LL_GPIO_SPEED_FREQ_HIGH
419   *         @arg @ref LL_GPIO_SPEED_FREQ_VERY_HIGH
420   * @retval None
421   */
LL_GPIO_SetPinSpeed(GPIO_TypeDef * GPIOx,uint32_t Pin,uint32_t Speed)422 __STATIC_INLINE void LL_GPIO_SetPinSpeed(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t  Speed)
423 {
424   MODIFY_REG(GPIOx->OSPEEDR, (GPIO_OSPEEDR_OSPEED0 << (POSITION_VAL(Pin) * 2U)),
425              (Speed << (POSITION_VAL(Pin) * 2U)));
426 }
427 
428 /**
429   * @brief  Return gpio speed for a dedicated pin on dedicated port.
430   * @note   I/O speed can be Low, Medium, Fast or High speed.
431   * @note   Warning: only one pin can be passed as parameter.
432   * @note   Refer to datasheet for frequency specifications and the power
433   *         supply and load conditions for each speed.
434   * @rmtoll OSPEEDR      OSPEEDy       LL_GPIO_GetPinSpeed
435   * @param  GPIOx GPIO Port
436   * @param  Pin This parameter can be one of the following values:
437   *         @arg @ref LL_GPIO_PIN_0
438   *         @arg @ref LL_GPIO_PIN_1
439   *         @arg @ref LL_GPIO_PIN_2
440   *         @arg @ref LL_GPIO_PIN_3
441   *         @arg @ref LL_GPIO_PIN_4
442   *         @arg @ref LL_GPIO_PIN_5
443   *         @arg @ref LL_GPIO_PIN_6
444   *         @arg @ref LL_GPIO_PIN_7
445   *         @arg @ref LL_GPIO_PIN_8
446   *         @arg @ref LL_GPIO_PIN_9
447   *         @arg @ref LL_GPIO_PIN_10
448   *         @arg @ref LL_GPIO_PIN_11
449   *         @arg @ref LL_GPIO_PIN_12
450   *         @arg @ref LL_GPIO_PIN_13
451   *         @arg @ref LL_GPIO_PIN_14
452   *         @arg @ref LL_GPIO_PIN_15
453   * @retval Returned value can be one of the following values:
454   *         @arg @ref LL_GPIO_SPEED_FREQ_LOW
455   *         @arg @ref LL_GPIO_SPEED_FREQ_MEDIUM
456   *         @arg @ref LL_GPIO_SPEED_FREQ_HIGH
457   *         @arg @ref LL_GPIO_SPEED_FREQ_VERY_HIGH
458   */
LL_GPIO_GetPinSpeed(GPIO_TypeDef * GPIOx,uint32_t Pin)459 __STATIC_INLINE uint32_t LL_GPIO_GetPinSpeed(GPIO_TypeDef *GPIOx, uint32_t Pin)
460 {
461   return (uint32_t)(READ_BIT(GPIOx->OSPEEDR,
462                              (GPIO_OSPEEDR_OSPEED0 << (POSITION_VAL(Pin) * 2U))) >> (POSITION_VAL(Pin) * 2U));
463 }
464 
465 /**
466   * @brief  Configure gpio pull-up or pull-down for a dedicated pin on a dedicated port.
467   * @note   Warning: only one pin can be passed as parameter.
468   * @rmtoll PUPDR        PUPDy         LL_GPIO_SetPinPull
469   * @param  GPIOx GPIO Port
470   * @param  Pin This parameter can be one of the following values:
471   *         @arg @ref LL_GPIO_PIN_0
472   *         @arg @ref LL_GPIO_PIN_1
473   *         @arg @ref LL_GPIO_PIN_2
474   *         @arg @ref LL_GPIO_PIN_3
475   *         @arg @ref LL_GPIO_PIN_4
476   *         @arg @ref LL_GPIO_PIN_5
477   *         @arg @ref LL_GPIO_PIN_6
478   *         @arg @ref LL_GPIO_PIN_7
479   *         @arg @ref LL_GPIO_PIN_8
480   *         @arg @ref LL_GPIO_PIN_9
481   *         @arg @ref LL_GPIO_PIN_10
482   *         @arg @ref LL_GPIO_PIN_11
483   *         @arg @ref LL_GPIO_PIN_12
484   *         @arg @ref LL_GPIO_PIN_13
485   *         @arg @ref LL_GPIO_PIN_14
486   *         @arg @ref LL_GPIO_PIN_15
487   * @param  Pull This parameter can be one of the following values:
488   *         @arg @ref LL_GPIO_PULL_NO
489   *         @arg @ref LL_GPIO_PULL_UP
490   *         @arg @ref LL_GPIO_PULL_DOWN
491   * @retval None
492   */
LL_GPIO_SetPinPull(GPIO_TypeDef * GPIOx,uint32_t Pin,uint32_t Pull)493 __STATIC_INLINE void LL_GPIO_SetPinPull(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Pull)
494 {
495   MODIFY_REG(GPIOx->PUPDR, (GPIO_PUPDR_PUPD0 << (POSITION_VAL(Pin) * 2U)), (Pull << (POSITION_VAL(Pin) * 2U)));
496 }
497 
498 /**
499   * @brief  Return gpio pull-up or pull-down for a dedicated pin on a dedicated port
500   * @note   Warning: only one pin can be passed as parameter.
501   * @rmtoll PUPDR        PUPDy         LL_GPIO_GetPinPull
502   * @param  GPIOx GPIO Port
503   * @param  Pin This parameter can be one of the following values:
504   *         @arg @ref LL_GPIO_PIN_0
505   *         @arg @ref LL_GPIO_PIN_1
506   *         @arg @ref LL_GPIO_PIN_2
507   *         @arg @ref LL_GPIO_PIN_3
508   *         @arg @ref LL_GPIO_PIN_4
509   *         @arg @ref LL_GPIO_PIN_5
510   *         @arg @ref LL_GPIO_PIN_6
511   *         @arg @ref LL_GPIO_PIN_7
512   *         @arg @ref LL_GPIO_PIN_8
513   *         @arg @ref LL_GPIO_PIN_9
514   *         @arg @ref LL_GPIO_PIN_10
515   *         @arg @ref LL_GPIO_PIN_11
516   *         @arg @ref LL_GPIO_PIN_12
517   *         @arg @ref LL_GPIO_PIN_13
518   *         @arg @ref LL_GPIO_PIN_14
519   *         @arg @ref LL_GPIO_PIN_15
520   * @retval Returned value can be one of the following values:
521   *         @arg @ref LL_GPIO_PULL_NO
522   *         @arg @ref LL_GPIO_PULL_UP
523   *         @arg @ref LL_GPIO_PULL_DOWN
524   */
LL_GPIO_GetPinPull(GPIO_TypeDef * GPIOx,uint32_t Pin)525 __STATIC_INLINE uint32_t LL_GPIO_GetPinPull(GPIO_TypeDef *GPIOx, uint32_t Pin)
526 {
527   return (uint32_t)(READ_BIT(GPIOx->PUPDR,
528                              (GPIO_PUPDR_PUPD0 << (POSITION_VAL(Pin) * 2U))) >> (POSITION_VAL(Pin) * 2U));
529 }
530 
531 /**
532   * @brief  Configure gpio alternate function of a dedicated pin from 0 to 7 for a dedicated port.
533   * @note   Possible values are from AF0 to AF15 depending on target.
534   * @note   Warning: only one pin can be passed as parameter.
535   * @rmtoll AFRL         AFSELy        LL_GPIO_SetAFPin_0_7
536   * @param  GPIOx GPIO Port
537   * @param  Pin This parameter can be one of the following values:
538   *         @arg @ref LL_GPIO_PIN_0
539   *         @arg @ref LL_GPIO_PIN_1
540   *         @arg @ref LL_GPIO_PIN_2
541   *         @arg @ref LL_GPIO_PIN_3
542   *         @arg @ref LL_GPIO_PIN_4
543   *         @arg @ref LL_GPIO_PIN_5
544   *         @arg @ref LL_GPIO_PIN_6
545   *         @arg @ref LL_GPIO_PIN_7
546   * @param  Alternate This parameter can be one of the following values:
547   *         @arg @ref LL_GPIO_AF_0
548   *         @arg @ref LL_GPIO_AF_1
549   *         @arg @ref LL_GPIO_AF_2
550   *         @arg @ref LL_GPIO_AF_3
551   *         @arg @ref LL_GPIO_AF_4
552   *         @arg @ref LL_GPIO_AF_5
553   *         @arg @ref LL_GPIO_AF_6
554   *         @arg @ref LL_GPIO_AF_7
555   *         @arg @ref LL_GPIO_AF_8
556   *         @arg @ref LL_GPIO_AF_9
557   *         @arg @ref LL_GPIO_AF_10
558   *         @arg @ref LL_GPIO_AF_11
559   *         @arg @ref LL_GPIO_AF_12
560   *         @arg @ref LL_GPIO_AF_13
561   *         @arg @ref LL_GPIO_AF_14
562   *         @arg @ref LL_GPIO_AF_15
563   * @retval None
564   */
LL_GPIO_SetAFPin_0_7(GPIO_TypeDef * GPIOx,uint32_t Pin,uint32_t Alternate)565 __STATIC_INLINE void LL_GPIO_SetAFPin_0_7(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate)
566 {
567   MODIFY_REG(GPIOx->AFR[0], (GPIO_AFRL_AFSEL0 << (POSITION_VAL(Pin) * 4U)),
568              (Alternate << (POSITION_VAL(Pin) * 4U)));
569 }
570 
571 /**
572   * @brief  Return gpio alternate function of a dedicated pin from 0 to 7 for a dedicated port.
573   * @rmtoll AFRL         AFSELy        LL_GPIO_GetAFPin_0_7
574   * @param  GPIOx GPIO Port
575   * @param  Pin This parameter can be one of the following values:
576   *         @arg @ref LL_GPIO_PIN_0
577   *         @arg @ref LL_GPIO_PIN_1
578   *         @arg @ref LL_GPIO_PIN_2
579   *         @arg @ref LL_GPIO_PIN_3
580   *         @arg @ref LL_GPIO_PIN_4
581   *         @arg @ref LL_GPIO_PIN_5
582   *         @arg @ref LL_GPIO_PIN_6
583   *         @arg @ref LL_GPIO_PIN_7
584   * @retval Returned value can be one of the following values:
585   *         @arg @ref LL_GPIO_AF_0
586   *         @arg @ref LL_GPIO_AF_1
587   *         @arg @ref LL_GPIO_AF_2
588   *         @arg @ref LL_GPIO_AF_3
589   *         @arg @ref LL_GPIO_AF_4
590   *         @arg @ref LL_GPIO_AF_5
591   *         @arg @ref LL_GPIO_AF_6
592   *         @arg @ref LL_GPIO_AF_7
593   *         @arg @ref LL_GPIO_AF_8
594   *         @arg @ref LL_GPIO_AF_9
595   *         @arg @ref LL_GPIO_AF_10
596   *         @arg @ref LL_GPIO_AF_11
597   *         @arg @ref LL_GPIO_AF_12
598   *         @arg @ref LL_GPIO_AF_13
599   *         @arg @ref LL_GPIO_AF_14
600   *         @arg @ref LL_GPIO_AF_15
601   */
LL_GPIO_GetAFPin_0_7(GPIO_TypeDef * GPIOx,uint32_t Pin)602 __STATIC_INLINE uint32_t LL_GPIO_GetAFPin_0_7(GPIO_TypeDef *GPIOx, uint32_t Pin)
603 {
604   return (uint32_t)(READ_BIT(GPIOx->AFR[0],
605                              (GPIO_AFRL_AFSEL0 << (POSITION_VAL(Pin) * 4U))) >> (POSITION_VAL(Pin) * 4U));
606 }
607 
608 /**
609   * @brief  Configure gpio alternate function of a dedicated pin from 8 to 15 for a dedicated port.
610   * @note   Possible values are from AF0 to AF15 depending on target.
611   * @note   Warning: only one pin can be passed as parameter.
612   * @rmtoll AFRH         AFSELy        LL_GPIO_SetAFPin_8_15
613   * @param  GPIOx GPIO Port
614   * @param  Pin This parameter can be one of the following values:
615   *         @arg @ref LL_GPIO_PIN_8
616   *         @arg @ref LL_GPIO_PIN_9
617   *         @arg @ref LL_GPIO_PIN_10
618   *         @arg @ref LL_GPIO_PIN_11
619   *         @arg @ref LL_GPIO_PIN_12
620   *         @arg @ref LL_GPIO_PIN_13
621   *         @arg @ref LL_GPIO_PIN_14
622   *         @arg @ref LL_GPIO_PIN_15
623   * @param  Alternate This parameter can be one of the following values:
624   *         @arg @ref LL_GPIO_AF_0
625   *         @arg @ref LL_GPIO_AF_1
626   *         @arg @ref LL_GPIO_AF_2
627   *         @arg @ref LL_GPIO_AF_3
628   *         @arg @ref LL_GPIO_AF_4
629   *         @arg @ref LL_GPIO_AF_5
630   *         @arg @ref LL_GPIO_AF_6
631   *         @arg @ref LL_GPIO_AF_7
632   *         @arg @ref LL_GPIO_AF_8
633   *         @arg @ref LL_GPIO_AF_9
634   *         @arg @ref LL_GPIO_AF_10
635   *         @arg @ref LL_GPIO_AF_11
636   *         @arg @ref LL_GPIO_AF_12
637   *         @arg @ref LL_GPIO_AF_13
638   *         @arg @ref LL_GPIO_AF_14
639   *         @arg @ref LL_GPIO_AF_15
640   * @retval None
641   */
LL_GPIO_SetAFPin_8_15(GPIO_TypeDef * GPIOx,uint32_t Pin,uint32_t Alternate)642 __STATIC_INLINE void LL_GPIO_SetAFPin_8_15(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate)
643 {
644   MODIFY_REG(GPIOx->AFR[1], (GPIO_AFRH_AFSEL8 << (POSITION_VAL(Pin >> 8U) * 4U)),
645              (Alternate << (POSITION_VAL(Pin >> 8U) * 4U)));
646 }
647 
648 /**
649   * @brief  Return gpio alternate function of a dedicated pin from 8 to 15 for a dedicated port.
650   * @note   Possible values are from AF0 to AF15 depending on target.
651   * @rmtoll AFRH         AFSELy        LL_GPIO_GetAFPin_8_15
652   * @param  GPIOx GPIO Port
653   * @param  Pin This parameter can be one of the following values:
654   *         @arg @ref LL_GPIO_PIN_8
655   *         @arg @ref LL_GPIO_PIN_9
656   *         @arg @ref LL_GPIO_PIN_10
657   *         @arg @ref LL_GPIO_PIN_11
658   *         @arg @ref LL_GPIO_PIN_12
659   *         @arg @ref LL_GPIO_PIN_13
660   *         @arg @ref LL_GPIO_PIN_14
661   *         @arg @ref LL_GPIO_PIN_15
662   * @retval Returned value can be one of the following values:
663   *         @arg @ref LL_GPIO_AF_0
664   *         @arg @ref LL_GPIO_AF_1
665   *         @arg @ref LL_GPIO_AF_2
666   *         @arg @ref LL_GPIO_AF_3
667   *         @arg @ref LL_GPIO_AF_4
668   *         @arg @ref LL_GPIO_AF_5
669   *         @arg @ref LL_GPIO_AF_6
670   *         @arg @ref LL_GPIO_AF_7
671   *         @arg @ref LL_GPIO_AF_8
672   *         @arg @ref LL_GPIO_AF_9
673   *         @arg @ref LL_GPIO_AF_10
674   *         @arg @ref LL_GPIO_AF_11
675   *         @arg @ref LL_GPIO_AF_12
676   *         @arg @ref LL_GPIO_AF_13
677   *         @arg @ref LL_GPIO_AF_14
678   *         @arg @ref LL_GPIO_AF_15
679   */
LL_GPIO_GetAFPin_8_15(GPIO_TypeDef * GPIOx,uint32_t Pin)680 __STATIC_INLINE uint32_t LL_GPIO_GetAFPin_8_15(GPIO_TypeDef *GPIOx, uint32_t Pin)
681 {
682   return (uint32_t)(READ_BIT(GPIOx->AFR[1],
683                              (GPIO_AFRH_AFSEL8 << (POSITION_VAL(Pin >> 8U) * 4U))) >> (POSITION_VAL(Pin >> 8U) * 4U));
684 }
685 
686 
687 /**
688   * @brief  Lock configuration of several pins for a dedicated port.
689   * @note   When the lock sequence has been applied on a port bit, the
690   *         value of this port bit can no longer be modified until the
691   *         next reset.
692   * @note   Each lock bit freezes a specific configuration register
693   *         (control and alternate function registers).
694   * @rmtoll LCKR         LCKK          LL_GPIO_LockPin
695   * @param  GPIOx GPIO Port
696   * @param  PinMask This parameter can be a combination of the following values:
697   *         @arg @ref LL_GPIO_PIN_0
698   *         @arg @ref LL_GPIO_PIN_1
699   *         @arg @ref LL_GPIO_PIN_2
700   *         @arg @ref LL_GPIO_PIN_3
701   *         @arg @ref LL_GPIO_PIN_4
702   *         @arg @ref LL_GPIO_PIN_5
703   *         @arg @ref LL_GPIO_PIN_6
704   *         @arg @ref LL_GPIO_PIN_7
705   *         @arg @ref LL_GPIO_PIN_8
706   *         @arg @ref LL_GPIO_PIN_9
707   *         @arg @ref LL_GPIO_PIN_10
708   *         @arg @ref LL_GPIO_PIN_11
709   *         @arg @ref LL_GPIO_PIN_12
710   *         @arg @ref LL_GPIO_PIN_13
711   *         @arg @ref LL_GPIO_PIN_14
712   *         @arg @ref LL_GPIO_PIN_15
713   *         @arg @ref LL_GPIO_PIN_ALL
714   * @retval None
715   */
LL_GPIO_LockPin(GPIO_TypeDef * GPIOx,uint32_t PinMask)716 __STATIC_INLINE void LL_GPIO_LockPin(GPIO_TypeDef *GPIOx, uint32_t PinMask)
717 {
718   __IO uint32_t temp;
719   WRITE_REG(GPIOx->LCKR, GPIO_LCKR_LCKK | PinMask);
720   WRITE_REG(GPIOx->LCKR, PinMask);
721   WRITE_REG(GPIOx->LCKR, GPIO_LCKR_LCKK | PinMask);
722   /* Read LCKK register. This read is mandatory to complete key lock sequence */
723   temp = READ_REG(GPIOx->LCKR);
724   (void) temp;
725 }
726 
727 /**
728   * @brief  Return 1 if all pins passed as parameter, of a dedicated port, are locked. else Return 0.
729   * @rmtoll LCKR         LCKy          LL_GPIO_IsPinLocked
730   * @param  GPIOx GPIO Port
731   * @param  PinMask This parameter can be a combination of the following values:
732   *         @arg @ref LL_GPIO_PIN_0
733   *         @arg @ref LL_GPIO_PIN_1
734   *         @arg @ref LL_GPIO_PIN_2
735   *         @arg @ref LL_GPIO_PIN_3
736   *         @arg @ref LL_GPIO_PIN_4
737   *         @arg @ref LL_GPIO_PIN_5
738   *         @arg @ref LL_GPIO_PIN_6
739   *         @arg @ref LL_GPIO_PIN_7
740   *         @arg @ref LL_GPIO_PIN_8
741   *         @arg @ref LL_GPIO_PIN_9
742   *         @arg @ref LL_GPIO_PIN_10
743   *         @arg @ref LL_GPIO_PIN_11
744   *         @arg @ref LL_GPIO_PIN_12
745   *         @arg @ref LL_GPIO_PIN_13
746   *         @arg @ref LL_GPIO_PIN_14
747   *         @arg @ref LL_GPIO_PIN_15
748   *         @arg @ref LL_GPIO_PIN_ALL
749   * @retval State of bit (1 or 0).
750   */
LL_GPIO_IsPinLocked(GPIO_TypeDef * GPIOx,uint32_t PinMask)751 __STATIC_INLINE uint32_t LL_GPIO_IsPinLocked(GPIO_TypeDef *GPIOx, uint32_t PinMask)
752 {
753   return ((READ_BIT(GPIOx->LCKR, PinMask) == (PinMask)) ? 1UL : 0UL);
754 }
755 
756 /**
757   * @brief  Return 1 if one of the pin of a dedicated port is locked. else return 0.
758   * @rmtoll LCKR         LCKK          LL_GPIO_IsAnyPinLocked
759   * @param  GPIOx GPIO Port
760   * @retval State of bit (1 or 0).
761   */
LL_GPIO_IsAnyPinLocked(GPIO_TypeDef * GPIOx)762 __STATIC_INLINE uint32_t LL_GPIO_IsAnyPinLocked(GPIO_TypeDef *GPIOx)
763 {
764   return ((READ_BIT(GPIOx->LCKR, GPIO_LCKR_LCKK) == (GPIO_LCKR_LCKK)) ? 1UL : 0UL);
765 }
766 
767 /**
768   * @}
769   */
770 
771 /** @defgroup GPIO_LL_EF_Data_Access Data Access
772   * @{
773   */
774 
775 /**
776   * @brief  Return full input data register value for a dedicated port.
777   * @rmtoll IDR          IDy           LL_GPIO_ReadInputPort
778   * @param  GPIOx GPIO Port
779   * @retval Input data register value of port
780   */
LL_GPIO_ReadInputPort(GPIO_TypeDef * GPIOx)781 __STATIC_INLINE uint32_t LL_GPIO_ReadInputPort(GPIO_TypeDef *GPIOx)
782 {
783   return (uint32_t)(READ_REG(GPIOx->IDR));
784 }
785 
786 /**
787   * @brief  Return if input data level for several pins of dedicated port is high or low.
788   * @rmtoll IDR          IDy           LL_GPIO_IsInputPinSet
789   * @param  GPIOx GPIO Port
790   * @param  PinMask This parameter can be a combination of the following values:
791   *         @arg @ref LL_GPIO_PIN_0
792   *         @arg @ref LL_GPIO_PIN_1
793   *         @arg @ref LL_GPIO_PIN_2
794   *         @arg @ref LL_GPIO_PIN_3
795   *         @arg @ref LL_GPIO_PIN_4
796   *         @arg @ref LL_GPIO_PIN_5
797   *         @arg @ref LL_GPIO_PIN_6
798   *         @arg @ref LL_GPIO_PIN_7
799   *         @arg @ref LL_GPIO_PIN_8
800   *         @arg @ref LL_GPIO_PIN_9
801   *         @arg @ref LL_GPIO_PIN_10
802   *         @arg @ref LL_GPIO_PIN_11
803   *         @arg @ref LL_GPIO_PIN_12
804   *         @arg @ref LL_GPIO_PIN_13
805   *         @arg @ref LL_GPIO_PIN_14
806   *         @arg @ref LL_GPIO_PIN_15
807   *         @arg @ref LL_GPIO_PIN_ALL
808   * @retval State of bit (1 or 0).
809   */
LL_GPIO_IsInputPinSet(GPIO_TypeDef * GPIOx,uint32_t PinMask)810 __STATIC_INLINE uint32_t LL_GPIO_IsInputPinSet(GPIO_TypeDef *GPIOx, uint32_t PinMask)
811 {
812   return ((READ_BIT(GPIOx->IDR, PinMask) == (PinMask)) ? 1UL : 0UL);
813 }
814 
815 /**
816   * @brief  Write output data register for the port.
817   * @rmtoll ODR          ODy           LL_GPIO_WriteOutputPort
818   * @param  GPIOx GPIO Port
819   * @param  PortValue Level value for each pin of the port
820   * @retval None
821   */
LL_GPIO_WriteOutputPort(GPIO_TypeDef * GPIOx,uint32_t PortValue)822 __STATIC_INLINE void LL_GPIO_WriteOutputPort(GPIO_TypeDef *GPIOx, uint32_t PortValue)
823 {
824   WRITE_REG(GPIOx->ODR, PortValue);
825 }
826 
827 /**
828   * @brief  Return full output data register value for a dedicated port.
829   * @rmtoll ODR          ODy           LL_GPIO_ReadOutputPort
830   * @param  GPIOx GPIO Port
831   * @retval Output data register value of port
832   */
LL_GPIO_ReadOutputPort(GPIO_TypeDef * GPIOx)833 __STATIC_INLINE uint32_t LL_GPIO_ReadOutputPort(GPIO_TypeDef *GPIOx)
834 {
835   return (uint32_t)(READ_REG(GPIOx->ODR));
836 }
837 
838 /**
839   * @brief  Return if input data level for several pins of dedicated port is high or low.
840   * @rmtoll ODR          ODy           LL_GPIO_IsOutputPinSet
841   * @param  GPIOx GPIO Port
842   * @param  PinMask This parameter can be a combination of the following values:
843   *         @arg @ref LL_GPIO_PIN_0
844   *         @arg @ref LL_GPIO_PIN_1
845   *         @arg @ref LL_GPIO_PIN_2
846   *         @arg @ref LL_GPIO_PIN_3
847   *         @arg @ref LL_GPIO_PIN_4
848   *         @arg @ref LL_GPIO_PIN_5
849   *         @arg @ref LL_GPIO_PIN_6
850   *         @arg @ref LL_GPIO_PIN_7
851   *         @arg @ref LL_GPIO_PIN_8
852   *         @arg @ref LL_GPIO_PIN_9
853   *         @arg @ref LL_GPIO_PIN_10
854   *         @arg @ref LL_GPIO_PIN_11
855   *         @arg @ref LL_GPIO_PIN_12
856   *         @arg @ref LL_GPIO_PIN_13
857   *         @arg @ref LL_GPIO_PIN_14
858   *         @arg @ref LL_GPIO_PIN_15
859   *         @arg @ref LL_GPIO_PIN_ALL
860   * @retval State of bit (1 or 0).
861   */
LL_GPIO_IsOutputPinSet(GPIO_TypeDef * GPIOx,uint32_t PinMask)862 __STATIC_INLINE uint32_t LL_GPIO_IsOutputPinSet(GPIO_TypeDef *GPIOx, uint32_t PinMask)
863 {
864   return ((READ_BIT(GPIOx->ODR, PinMask) == (PinMask)) ? 1UL : 0UL);
865 }
866 
867 /**
868   * @brief  Set several pins to high level on dedicated gpio port.
869   * @rmtoll BSRR         BSy           LL_GPIO_SetOutputPin
870   * @param  GPIOx GPIO Port
871   * @param  PinMask This parameter can be a combination of the following values:
872   *         @arg @ref LL_GPIO_PIN_0
873   *         @arg @ref LL_GPIO_PIN_1
874   *         @arg @ref LL_GPIO_PIN_2
875   *         @arg @ref LL_GPIO_PIN_3
876   *         @arg @ref LL_GPIO_PIN_4
877   *         @arg @ref LL_GPIO_PIN_5
878   *         @arg @ref LL_GPIO_PIN_6
879   *         @arg @ref LL_GPIO_PIN_7
880   *         @arg @ref LL_GPIO_PIN_8
881   *         @arg @ref LL_GPIO_PIN_9
882   *         @arg @ref LL_GPIO_PIN_10
883   *         @arg @ref LL_GPIO_PIN_11
884   *         @arg @ref LL_GPIO_PIN_12
885   *         @arg @ref LL_GPIO_PIN_13
886   *         @arg @ref LL_GPIO_PIN_14
887   *         @arg @ref LL_GPIO_PIN_15
888   *         @arg @ref LL_GPIO_PIN_ALL
889   * @retval None
890   */
LL_GPIO_SetOutputPin(GPIO_TypeDef * GPIOx,uint32_t PinMask)891 __STATIC_INLINE void LL_GPIO_SetOutputPin(GPIO_TypeDef *GPIOx, uint32_t PinMask)
892 {
893   WRITE_REG(GPIOx->BSRR, PinMask);
894 }
895 
896 /**
897   * @brief  Set several pins to low level on dedicated gpio port.
898   * @rmtoll BRR          BRy           LL_GPIO_ResetOutputPin
899   * @param  GPIOx GPIO Port
900   * @param  PinMask This parameter can be a combination of the following values:
901   *         @arg @ref LL_GPIO_PIN_0
902   *         @arg @ref LL_GPIO_PIN_1
903   *         @arg @ref LL_GPIO_PIN_2
904   *         @arg @ref LL_GPIO_PIN_3
905   *         @arg @ref LL_GPIO_PIN_4
906   *         @arg @ref LL_GPIO_PIN_5
907   *         @arg @ref LL_GPIO_PIN_6
908   *         @arg @ref LL_GPIO_PIN_7
909   *         @arg @ref LL_GPIO_PIN_8
910   *         @arg @ref LL_GPIO_PIN_9
911   *         @arg @ref LL_GPIO_PIN_10
912   *         @arg @ref LL_GPIO_PIN_11
913   *         @arg @ref LL_GPIO_PIN_12
914   *         @arg @ref LL_GPIO_PIN_13
915   *         @arg @ref LL_GPIO_PIN_14
916   *         @arg @ref LL_GPIO_PIN_15
917   *         @arg @ref LL_GPIO_PIN_ALL
918   * @retval None
919   */
LL_GPIO_ResetOutputPin(GPIO_TypeDef * GPIOx,uint32_t PinMask)920 __STATIC_INLINE void LL_GPIO_ResetOutputPin(GPIO_TypeDef *GPIOx, uint32_t PinMask)
921 {
922   WRITE_REG(GPIOx->BRR, PinMask);
923 }
924 
925 /**
926   * @brief  Toggle data value for several pin of dedicated port.
927   * @rmtoll ODR          ODy           LL_GPIO_TogglePin
928   * @param  GPIOx GPIO Port
929   * @param  PinMask This parameter can be a combination of the following values:
930   *         @arg @ref LL_GPIO_PIN_0
931   *         @arg @ref LL_GPIO_PIN_1
932   *         @arg @ref LL_GPIO_PIN_2
933   *         @arg @ref LL_GPIO_PIN_3
934   *         @arg @ref LL_GPIO_PIN_4
935   *         @arg @ref LL_GPIO_PIN_5
936   *         @arg @ref LL_GPIO_PIN_6
937   *         @arg @ref LL_GPIO_PIN_7
938   *         @arg @ref LL_GPIO_PIN_8
939   *         @arg @ref LL_GPIO_PIN_9
940   *         @arg @ref LL_GPIO_PIN_10
941   *         @arg @ref LL_GPIO_PIN_11
942   *         @arg @ref LL_GPIO_PIN_12
943   *         @arg @ref LL_GPIO_PIN_13
944   *         @arg @ref LL_GPIO_PIN_14
945   *         @arg @ref LL_GPIO_PIN_15
946   *         @arg @ref LL_GPIO_PIN_ALL
947   * @retval None
948   */
LL_GPIO_TogglePin(GPIO_TypeDef * GPIOx,uint32_t PinMask)949 __STATIC_INLINE void LL_GPIO_TogglePin(GPIO_TypeDef *GPIOx, uint32_t PinMask)
950 {
951   WRITE_REG(GPIOx->ODR, READ_REG(GPIOx->ODR) ^ PinMask);
952 }
953 
954 /**
955   * @}
956   */
957 
958 #if defined(USE_FULL_LL_DRIVER)
959 /** @defgroup GPIO_LL_EF_Init Initialization and de-initialization functions
960   * @{
961   */
962 
963 ErrorStatus LL_GPIO_DeInit(GPIO_TypeDef *GPIOx);
964 ErrorStatus LL_GPIO_Init(GPIO_TypeDef *GPIOx, LL_GPIO_InitTypeDef *GPIO_InitStruct);
965 void        LL_GPIO_StructInit(LL_GPIO_InitTypeDef *GPIO_InitStruct);
966 
967 /**
968   * @}
969   */
970 #endif /* USE_FULL_LL_DRIVER */
971 
972 /**
973   * @}
974   */
975 
976 /**
977   * @}
978   */
979 
980 #endif /* defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOH) */
981 /**
982   * @}
983   */
984 
985 #ifdef __cplusplus
986 }
987 #endif
988 
989 #endif /* STM32WBxx_LL_GPIO_H */
990 
991 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
992