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