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