1 /**
2 ******************************************************************************
3 * @file stm32h7rsxx_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 __STM32H7RSxx_LL_GPIO_H
21 #define __STM32H7RSxx_LL_GPIO_H
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32h7rsxx.h"
29
30 /** @addtogroup STM32H7RSxx_LL_Driver
31 * @{
32 */
33 #if defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || \
34 defined (GPIOE) || defined (GPIOF) || defined (GPIOG) || defined (GPIOH) || \
35 defined (GPIOM) || defined (GPION) || defined (GPIOO) || defined (GPIOP)
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) * GPIO_MODER_MODE1_Pos)),
285 (Mode << (POSITION_VAL(Pin) * GPIO_MODER_MODE1_Pos)));
286 }
287
288 /**
289 * @brief Return gpio mode for a dedicated pin on dedicated port.
290 * @note I/O mode can be Input mode, General purpose output, Alternate function mode or Analog.
291 * @note Warning: only one pin can be passed as parameter.
292 * @rmtoll MODER MODEy LL_GPIO_GetPinMode
293 * @param GPIOx GPIO Port
294 * @param Pin This parameter can be one of the following values:
295 * @arg @ref LL_GPIO_PIN_0
296 * @arg @ref LL_GPIO_PIN_1
297 * @arg @ref LL_GPIO_PIN_2
298 * @arg @ref LL_GPIO_PIN_3
299 * @arg @ref LL_GPIO_PIN_4
300 * @arg @ref LL_GPIO_PIN_5
301 * @arg @ref LL_GPIO_PIN_6
302 * @arg @ref LL_GPIO_PIN_7
303 * @arg @ref LL_GPIO_PIN_8
304 * @arg @ref LL_GPIO_PIN_9
305 * @arg @ref LL_GPIO_PIN_10
306 * @arg @ref LL_GPIO_PIN_11
307 * @arg @ref LL_GPIO_PIN_12
308 * @arg @ref LL_GPIO_PIN_13
309 * @arg @ref LL_GPIO_PIN_14
310 * @arg @ref LL_GPIO_PIN_15
311 * @retval Returned value can be one of the following values:
312 * @arg @ref LL_GPIO_MODE_INPUT
313 * @arg @ref LL_GPIO_MODE_OUTPUT
314 * @arg @ref LL_GPIO_MODE_ALTERNATE
315 * @arg @ref LL_GPIO_MODE_ANALOG
316 */
LL_GPIO_GetPinMode(const GPIO_TypeDef * GPIOx,uint32_t Pin)317 __STATIC_INLINE uint32_t LL_GPIO_GetPinMode(const GPIO_TypeDef *GPIOx, uint32_t Pin)
318 {
319 return (uint32_t)(READ_BIT(GPIOx->MODER, (GPIO_MODER_MODE0 << (POSITION_VAL(Pin) * GPIO_MODER_MODE1_Pos)))
320 >> (POSITION_VAL(Pin) * GPIO_MODER_MODE1_Pos));
321 }
322
323 /**
324 * @brief Configure gpio output type for several pins on dedicated port.
325 * @note Output type as to be set when gpio pin is in output or
326 * alternate modes. Possible type are Push-pull or Open-drain.
327 * @rmtoll OTYPER OTy LL_GPIO_SetPinOutputType
328 * @param GPIOx GPIO Port
329 * @param PinMask This parameter can be a combination of the following values:
330 * @arg @ref LL_GPIO_PIN_0
331 * @arg @ref LL_GPIO_PIN_1
332 * @arg @ref LL_GPIO_PIN_2
333 * @arg @ref LL_GPIO_PIN_3
334 * @arg @ref LL_GPIO_PIN_4
335 * @arg @ref LL_GPIO_PIN_5
336 * @arg @ref LL_GPIO_PIN_6
337 * @arg @ref LL_GPIO_PIN_7
338 * @arg @ref LL_GPIO_PIN_8
339 * @arg @ref LL_GPIO_PIN_9
340 * @arg @ref LL_GPIO_PIN_10
341 * @arg @ref LL_GPIO_PIN_11
342 * @arg @ref LL_GPIO_PIN_12
343 * @arg @ref LL_GPIO_PIN_13
344 * @arg @ref LL_GPIO_PIN_14
345 * @arg @ref LL_GPIO_PIN_15
346 * @arg @ref LL_GPIO_PIN_ALL
347 * @param OutputType This parameter can be one of the following values:
348 * @arg @ref LL_GPIO_OUTPUT_PUSHPULL
349 * @arg @ref LL_GPIO_OUTPUT_OPENDRAIN
350 * @retval None
351 */
LL_GPIO_SetPinOutputType(GPIO_TypeDef * GPIOx,uint32_t PinMask,uint32_t OutputType)352 __STATIC_INLINE void LL_GPIO_SetPinOutputType(GPIO_TypeDef *GPIOx, uint32_t PinMask, uint32_t OutputType)
353 {
354 MODIFY_REG(GPIOx->OTYPER, PinMask, (PinMask * OutputType));
355 }
356
357 /**
358 * @brief Return gpio output type for several pins on dedicated port.
359 * @note Output type as to be set when gpio pin is in output or
360 * alternate modes. Possible type are Push-pull or Open-drain.
361 * @note Warning: only one pin can be passed as parameter.
362 * @rmtoll OTYPER OTy LL_GPIO_GetPinOutputType
363 * @param GPIOx GPIO Port
364 * @param Pin This parameter can be one of the following values:
365 * @arg @ref LL_GPIO_PIN_0
366 * @arg @ref LL_GPIO_PIN_1
367 * @arg @ref LL_GPIO_PIN_2
368 * @arg @ref LL_GPIO_PIN_3
369 * @arg @ref LL_GPIO_PIN_4
370 * @arg @ref LL_GPIO_PIN_5
371 * @arg @ref LL_GPIO_PIN_6
372 * @arg @ref LL_GPIO_PIN_7
373 * @arg @ref LL_GPIO_PIN_8
374 * @arg @ref LL_GPIO_PIN_9
375 * @arg @ref LL_GPIO_PIN_10
376 * @arg @ref LL_GPIO_PIN_11
377 * @arg @ref LL_GPIO_PIN_12
378 * @arg @ref LL_GPIO_PIN_13
379 * @arg @ref LL_GPIO_PIN_14
380 * @arg @ref LL_GPIO_PIN_15
381 * @arg @ref LL_GPIO_PIN_ALL
382 * @retval Returned value can be one of the following values:
383 * @arg @ref LL_GPIO_OUTPUT_PUSHPULL
384 * @arg @ref LL_GPIO_OUTPUT_OPENDRAIN
385 */
LL_GPIO_GetPinOutputType(const GPIO_TypeDef * GPIOx,uint32_t Pin)386 __STATIC_INLINE uint32_t LL_GPIO_GetPinOutputType(const GPIO_TypeDef *GPIOx, uint32_t Pin)
387 {
388 return (uint32_t)(READ_BIT(GPIOx->OTYPER, Pin) >> POSITION_VAL(Pin));
389 }
390
391 /**
392 * @brief Configure gpio speed for a dedicated pin on dedicated port.
393 * @note I/O speed can be Low, Medium, Fast or High speed.
394 * @note Warning: only one pin can be passed as parameter.
395 * @note Refer to datasheet for frequency specifications and the power
396 * supply and load conditions for each speed.
397 * @rmtoll OSPEEDR OSPEEDy LL_GPIO_SetPinSpeed
398 * @param GPIOx GPIO Port
399 * @param Pin This parameter can be one of the following values:
400 * @arg @ref LL_GPIO_PIN_0
401 * @arg @ref LL_GPIO_PIN_1
402 * @arg @ref LL_GPIO_PIN_2
403 * @arg @ref LL_GPIO_PIN_3
404 * @arg @ref LL_GPIO_PIN_4
405 * @arg @ref LL_GPIO_PIN_5
406 * @arg @ref LL_GPIO_PIN_6
407 * @arg @ref LL_GPIO_PIN_7
408 * @arg @ref LL_GPIO_PIN_8
409 * @arg @ref LL_GPIO_PIN_9
410 * @arg @ref LL_GPIO_PIN_10
411 * @arg @ref LL_GPIO_PIN_11
412 * @arg @ref LL_GPIO_PIN_12
413 * @arg @ref LL_GPIO_PIN_13
414 * @arg @ref LL_GPIO_PIN_14
415 * @arg @ref LL_GPIO_PIN_15
416 * @param Speed This parameter can be one of the following values:
417 * @arg @ref LL_GPIO_SPEED_FREQ_LOW
418 * @arg @ref LL_GPIO_SPEED_FREQ_MEDIUM
419 * @arg @ref LL_GPIO_SPEED_FREQ_HIGH
420 * @arg @ref LL_GPIO_SPEED_FREQ_VERY_HIGH
421 * @retval None
422 */
LL_GPIO_SetPinSpeed(GPIO_TypeDef * GPIOx,uint32_t Pin,uint32_t Speed)423 __STATIC_INLINE void LL_GPIO_SetPinSpeed(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Speed)
424 {
425 MODIFY_REG(GPIOx->OSPEEDR, (GPIO_OSPEEDR_OSPEED0 << (POSITION_VAL(Pin) * GPIO_OSPEEDR_OSPEED1_Pos)),
426 (Speed << (POSITION_VAL(Pin) * GPIO_OSPEEDR_OSPEED1_Pos)));
427 }
428
429 /**
430 * @brief Return gpio speed for a dedicated pin on dedicated port.
431 * @note I/O speed can be Low, Medium, Fast or High speed.
432 * @note Warning: only one pin can be passed as parameter.
433 * @note Refer to datasheet for frequency specifications and the power
434 * supply and load conditions for each speed.
435 * @rmtoll OSPEEDR OSPEEDy LL_GPIO_GetPinSpeed
436 * @param GPIOx GPIO Port
437 * @param Pin This parameter can be one of the following values:
438 * @arg @ref LL_GPIO_PIN_0
439 * @arg @ref LL_GPIO_PIN_1
440 * @arg @ref LL_GPIO_PIN_2
441 * @arg @ref LL_GPIO_PIN_3
442 * @arg @ref LL_GPIO_PIN_4
443 * @arg @ref LL_GPIO_PIN_5
444 * @arg @ref LL_GPIO_PIN_6
445 * @arg @ref LL_GPIO_PIN_7
446 * @arg @ref LL_GPIO_PIN_8
447 * @arg @ref LL_GPIO_PIN_9
448 * @arg @ref LL_GPIO_PIN_10
449 * @arg @ref LL_GPIO_PIN_11
450 * @arg @ref LL_GPIO_PIN_12
451 * @arg @ref LL_GPIO_PIN_13
452 * @arg @ref LL_GPIO_PIN_14
453 * @arg @ref LL_GPIO_PIN_15
454 * @retval Returned value can be one of the following values:
455 * @arg @ref LL_GPIO_SPEED_FREQ_LOW
456 * @arg @ref LL_GPIO_SPEED_FREQ_MEDIUM
457 * @arg @ref LL_GPIO_SPEED_FREQ_HIGH
458 * @arg @ref LL_GPIO_SPEED_FREQ_VERY_HIGH
459 */
LL_GPIO_GetPinSpeed(const GPIO_TypeDef * GPIOx,uint32_t Pin)460 __STATIC_INLINE uint32_t LL_GPIO_GetPinSpeed(const GPIO_TypeDef *GPIOx, uint32_t Pin)
461 {
462 return (uint32_t)(READ_BIT(GPIOx->OSPEEDR, (GPIO_OSPEEDR_OSPEED0 << (POSITION_VAL(Pin) * GPIO_OSPEEDR_OSPEED1_Pos)))
463 >> (POSITION_VAL(Pin) * GPIO_OSPEEDR_OSPEED1_Pos));
464 }
465
466 /**
467 * @brief Configure gpio pull-up or pull-down for a dedicated pin on a dedicated port.
468 * @note Warning: only one pin can be passed as parameter.
469 * @rmtoll PUPDR PUPDy LL_GPIO_SetPinPull
470 * @param GPIOx GPIO Port
471 * @param Pin This parameter can be one of the following values:
472 * @arg @ref LL_GPIO_PIN_0
473 * @arg @ref LL_GPIO_PIN_1
474 * @arg @ref LL_GPIO_PIN_2
475 * @arg @ref LL_GPIO_PIN_3
476 * @arg @ref LL_GPIO_PIN_4
477 * @arg @ref LL_GPIO_PIN_5
478 * @arg @ref LL_GPIO_PIN_6
479 * @arg @ref LL_GPIO_PIN_7
480 * @arg @ref LL_GPIO_PIN_8
481 * @arg @ref LL_GPIO_PIN_9
482 * @arg @ref LL_GPIO_PIN_10
483 * @arg @ref LL_GPIO_PIN_11
484 * @arg @ref LL_GPIO_PIN_12
485 * @arg @ref LL_GPIO_PIN_13
486 * @arg @ref LL_GPIO_PIN_14
487 * @arg @ref LL_GPIO_PIN_15
488 * @param Pull This parameter can be one of the following values:
489 * @arg @ref LL_GPIO_PULL_NO
490 * @arg @ref LL_GPIO_PULL_UP
491 * @arg @ref LL_GPIO_PULL_DOWN
492 * @retval None
493 */
LL_GPIO_SetPinPull(GPIO_TypeDef * GPIOx,uint32_t Pin,uint32_t Pull)494 __STATIC_INLINE void LL_GPIO_SetPinPull(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Pull)
495 {
496 MODIFY_REG(GPIOx->PUPDR, (GPIO_PUPDR_PUPD0 << (POSITION_VAL(Pin) * GPIO_PUPDR_PUPD1_Pos)),
497 (Pull << (POSITION_VAL(Pin) * GPIO_PUPDR_PUPD1_Pos)));
498 }
499
500 /**
501 * @brief Return gpio pull-up or pull-down for a dedicated pin on a dedicated port
502 * @note Warning: only one pin can be passed as parameter.
503 * @rmtoll PUPDR PUPDy LL_GPIO_GetPinPull
504 * @param GPIOx GPIO Port
505 * @param Pin This parameter can be one of the following values:
506 * @arg @ref LL_GPIO_PIN_0
507 * @arg @ref LL_GPIO_PIN_1
508 * @arg @ref LL_GPIO_PIN_2
509 * @arg @ref LL_GPIO_PIN_3
510 * @arg @ref LL_GPIO_PIN_4
511 * @arg @ref LL_GPIO_PIN_5
512 * @arg @ref LL_GPIO_PIN_6
513 * @arg @ref LL_GPIO_PIN_7
514 * @arg @ref LL_GPIO_PIN_8
515 * @arg @ref LL_GPIO_PIN_9
516 * @arg @ref LL_GPIO_PIN_10
517 * @arg @ref LL_GPIO_PIN_11
518 * @arg @ref LL_GPIO_PIN_12
519 * @arg @ref LL_GPIO_PIN_13
520 * @arg @ref LL_GPIO_PIN_14
521 * @arg @ref LL_GPIO_PIN_15
522 * @retval Returned value can be one of the following values:
523 * @arg @ref LL_GPIO_PULL_NO
524 * @arg @ref LL_GPIO_PULL_UP
525 * @arg @ref LL_GPIO_PULL_DOWN
526 */
LL_GPIO_GetPinPull(const GPIO_TypeDef * GPIOx,uint32_t Pin)527 __STATIC_INLINE uint32_t LL_GPIO_GetPinPull(const GPIO_TypeDef *GPIOx, uint32_t Pin)
528 {
529 return (uint32_t)(READ_BIT(GPIOx->PUPDR, (GPIO_PUPDR_PUPD0 << (POSITION_VAL(Pin) * GPIO_PUPDR_PUPD1_Pos)))
530 >> (POSITION_VAL(Pin) * GPIO_PUPDR_PUPD1_Pos));
531 }
532
533 /**
534 * @brief Configure gpio alternate function of a dedicated pin from 0 to 7 for a dedicated port.
535 * @note Possible values are from AF0 to AF15 depending on target.
536 * @note Warning: only one pin can be passed as parameter.
537 * @rmtoll AFRL AFSELy LL_GPIO_SetAFPin_0_7
538 * @param GPIOx GPIO Port
539 * @param Pin This parameter can be one of the following values:
540 * @arg @ref LL_GPIO_PIN_0
541 * @arg @ref LL_GPIO_PIN_1
542 * @arg @ref LL_GPIO_PIN_2
543 * @arg @ref LL_GPIO_PIN_3
544 * @arg @ref LL_GPIO_PIN_4
545 * @arg @ref LL_GPIO_PIN_5
546 * @arg @ref LL_GPIO_PIN_6
547 * @arg @ref LL_GPIO_PIN_7
548 * @param Alternate This parameter can be one of the following values:
549 * @arg @ref LL_GPIO_AF_0
550 * @arg @ref LL_GPIO_AF_1
551 * @arg @ref LL_GPIO_AF_2
552 * @arg @ref LL_GPIO_AF_3
553 * @arg @ref LL_GPIO_AF_4
554 * @arg @ref LL_GPIO_AF_5
555 * @arg @ref LL_GPIO_AF_6
556 * @arg @ref LL_GPIO_AF_7
557 * @arg @ref LL_GPIO_AF_8
558 * @arg @ref LL_GPIO_AF_9
559 * @arg @ref LL_GPIO_AF_10
560 * @arg @ref LL_GPIO_AF_11
561 * @arg @ref LL_GPIO_AF_12
562 * @arg @ref LL_GPIO_AF_13
563 * @arg @ref LL_GPIO_AF_14
564 * @arg @ref LL_GPIO_AF_15
565 * @retval None
566 */
LL_GPIO_SetAFPin_0_7(GPIO_TypeDef * GPIOx,uint32_t Pin,uint32_t Alternate)567 __STATIC_INLINE void LL_GPIO_SetAFPin_0_7(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate)
568 {
569 MODIFY_REG(GPIOx->AFR[0], (GPIO_AFRL_AFSEL0 << (POSITION_VAL(Pin) * GPIO_AFRL_AFSEL1_Pos)),
570 (Alternate << (POSITION_VAL(Pin) * GPIO_AFRL_AFSEL1_Pos)));
571 }
572
573 /**
574 * @brief Return gpio alternate function of a dedicated pin from 0 to 7 for a dedicated port.
575 * @rmtoll AFRL AFSELy LL_GPIO_GetAFPin_0_7
576 * @param GPIOx GPIO Port
577 * @param Pin This parameter can be one of the following values:
578 * @arg @ref LL_GPIO_PIN_0
579 * @arg @ref LL_GPIO_PIN_1
580 * @arg @ref LL_GPIO_PIN_2
581 * @arg @ref LL_GPIO_PIN_3
582 * @arg @ref LL_GPIO_PIN_4
583 * @arg @ref LL_GPIO_PIN_5
584 * @arg @ref LL_GPIO_PIN_6
585 * @arg @ref LL_GPIO_PIN_7
586 * @retval Returned value can be one of the following values:
587 * @arg @ref LL_GPIO_AF_0
588 * @arg @ref LL_GPIO_AF_1
589 * @arg @ref LL_GPIO_AF_2
590 * @arg @ref LL_GPIO_AF_3
591 * @arg @ref LL_GPIO_AF_4
592 * @arg @ref LL_GPIO_AF_5
593 * @arg @ref LL_GPIO_AF_6
594 * @arg @ref LL_GPIO_AF_7
595 * @arg @ref LL_GPIO_AF_8
596 * @arg @ref LL_GPIO_AF_9
597 * @arg @ref LL_GPIO_AF_10
598 * @arg @ref LL_GPIO_AF_11
599 * @arg @ref LL_GPIO_AF_12
600 * @arg @ref LL_GPIO_AF_13
601 * @arg @ref LL_GPIO_AF_14
602 * @arg @ref LL_GPIO_AF_15
603 */
LL_GPIO_GetAFPin_0_7(const GPIO_TypeDef * GPIOx,uint32_t Pin)604 __STATIC_INLINE uint32_t LL_GPIO_GetAFPin_0_7(const GPIO_TypeDef *GPIOx, uint32_t Pin)
605 {
606 return (uint32_t)(READ_BIT(GPIOx->AFR[0], (GPIO_AFRL_AFSEL0 << (POSITION_VAL(Pin) * GPIO_AFRL_AFSEL1_Pos)))
607 >> (POSITION_VAL(Pin) * GPIO_AFRL_AFSEL1_Pos));
608 }
609
610 /**
611 * @brief Configure gpio alternate function of a dedicated pin from 8 to 15 for a dedicated port.
612 * @note Possible values are from AF0 to AF15 depending on target.
613 * @note Warning: only one pin can be passed as parameter.
614 * @rmtoll AFRH AFSELy LL_GPIO_SetAFPin_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 * @param Alternate This parameter 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 * @arg @ref LL_GPIO_AF_8
635 * @arg @ref LL_GPIO_AF_9
636 * @arg @ref LL_GPIO_AF_10
637 * @arg @ref LL_GPIO_AF_11
638 * @arg @ref LL_GPIO_AF_12
639 * @arg @ref LL_GPIO_AF_13
640 * @arg @ref LL_GPIO_AF_14
641 * @arg @ref LL_GPIO_AF_15
642 * @retval None
643 */
LL_GPIO_SetAFPin_8_15(GPIO_TypeDef * GPIOx,uint32_t Pin,uint32_t Alternate)644 __STATIC_INLINE void LL_GPIO_SetAFPin_8_15(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate)
645 {
646 MODIFY_REG(GPIOx->AFR[1], (GPIO_AFRH_AFSEL8 << (POSITION_VAL(Pin >> 8U) * GPIO_AFRH_AFSEL9_Pos)),
647 (Alternate << (POSITION_VAL(Pin >> 8U) * GPIO_AFRH_AFSEL9_Pos)));
648 }
649
650 /**
651 * @brief Return gpio alternate function of a dedicated pin from 8 to 15 for a dedicated port.
652 * @note Possible values are from AF0 to AF15 depending on target.
653 * @rmtoll AFRH AFSELy LL_GPIO_GetAFPin_8_15
654 * @param GPIOx GPIO Port
655 * @param Pin This parameter can be one of the following values:
656 * @arg @ref LL_GPIO_PIN_8
657 * @arg @ref LL_GPIO_PIN_9
658 * @arg @ref LL_GPIO_PIN_10
659 * @arg @ref LL_GPIO_PIN_11
660 * @arg @ref LL_GPIO_PIN_12
661 * @arg @ref LL_GPIO_PIN_13
662 * @arg @ref LL_GPIO_PIN_14
663 * @arg @ref LL_GPIO_PIN_15
664 * @retval Returned value can be one of the following values:
665 * @arg @ref LL_GPIO_AF_0
666 * @arg @ref LL_GPIO_AF_1
667 * @arg @ref LL_GPIO_AF_2
668 * @arg @ref LL_GPIO_AF_3
669 * @arg @ref LL_GPIO_AF_4
670 * @arg @ref LL_GPIO_AF_5
671 * @arg @ref LL_GPIO_AF_6
672 * @arg @ref LL_GPIO_AF_7
673 * @arg @ref LL_GPIO_AF_8
674 * @arg @ref LL_GPIO_AF_9
675 * @arg @ref LL_GPIO_AF_10
676 * @arg @ref LL_GPIO_AF_11
677 * @arg @ref LL_GPIO_AF_12
678 * @arg @ref LL_GPIO_AF_13
679 * @arg @ref LL_GPIO_AF_14
680 * @arg @ref LL_GPIO_AF_15
681 */
LL_GPIO_GetAFPin_8_15(const GPIO_TypeDef * GPIOx,uint32_t Pin)682 __STATIC_INLINE uint32_t LL_GPIO_GetAFPin_8_15(const GPIO_TypeDef *GPIOx, uint32_t Pin)
683 {
684 return (uint32_t)(READ_BIT(GPIOx->AFR[1], (GPIO_AFRH_AFSEL8 << (POSITION_VAL(Pin >> 8U) * GPIO_AFRH_AFSEL9_Pos)))
685 >> (POSITION_VAL(Pin >> 8U) * GPIO_AFRH_AFSEL9_Pos));
686 }
687
688 /**
689 * @brief Lock configuration of several pins for a dedicated port.
690 * @note When the lock sequence has been applied on a port bit, the
691 * value of this port bit can no longer be modified until the
692 * next reset.
693 * @note Each lock bit freezes a specific configuration register
694 * (control and alternate function registers).
695 * @rmtoll LCKR LCKK LL_GPIO_LockPin
696 * @param GPIOx GPIO Port
697 * @param PinMask This parameter can be a combination of the following values:
698 * @arg @ref LL_GPIO_PIN_0
699 * @arg @ref LL_GPIO_PIN_1
700 * @arg @ref LL_GPIO_PIN_2
701 * @arg @ref LL_GPIO_PIN_3
702 * @arg @ref LL_GPIO_PIN_4
703 * @arg @ref LL_GPIO_PIN_5
704 * @arg @ref LL_GPIO_PIN_6
705 * @arg @ref LL_GPIO_PIN_7
706 * @arg @ref LL_GPIO_PIN_8
707 * @arg @ref LL_GPIO_PIN_9
708 * @arg @ref LL_GPIO_PIN_10
709 * @arg @ref LL_GPIO_PIN_11
710 * @arg @ref LL_GPIO_PIN_12
711 * @arg @ref LL_GPIO_PIN_13
712 * @arg @ref LL_GPIO_PIN_14
713 * @arg @ref LL_GPIO_PIN_15
714 * @arg @ref LL_GPIO_PIN_ALL
715 * @retval None
716 */
LL_GPIO_LockPin(GPIO_TypeDef * GPIOx,uint32_t PinMask)717 __STATIC_INLINE void LL_GPIO_LockPin(GPIO_TypeDef *GPIOx, uint32_t PinMask)
718 {
719 __IO uint32_t temp;
720 WRITE_REG(GPIOx->LCKR, GPIO_LCKR_LCKK | PinMask);
721 WRITE_REG(GPIOx->LCKR, PinMask);
722 WRITE_REG(GPIOx->LCKR, GPIO_LCKR_LCKK | PinMask);
723 /* Read LCKK register. This read is mandatory to complete key lock sequence */
724 temp = READ_REG(GPIOx->LCKR);
725 (void) temp;
726 }
727
728 /**
729 * @brief Return 1 if all pins passed as parameter, of a dedicated port, are locked. else Return 0.
730 * @rmtoll LCKR LCKy LL_GPIO_IsPinLocked
731 * @param GPIOx GPIO Port
732 * @param PinMask This parameter can be a combination of the following values:
733 * @arg @ref LL_GPIO_PIN_0
734 * @arg @ref LL_GPIO_PIN_1
735 * @arg @ref LL_GPIO_PIN_2
736 * @arg @ref LL_GPIO_PIN_3
737 * @arg @ref LL_GPIO_PIN_4
738 * @arg @ref LL_GPIO_PIN_5
739 * @arg @ref LL_GPIO_PIN_6
740 * @arg @ref LL_GPIO_PIN_7
741 * @arg @ref LL_GPIO_PIN_8
742 * @arg @ref LL_GPIO_PIN_9
743 * @arg @ref LL_GPIO_PIN_10
744 * @arg @ref LL_GPIO_PIN_11
745 * @arg @ref LL_GPIO_PIN_12
746 * @arg @ref LL_GPIO_PIN_13
747 * @arg @ref LL_GPIO_PIN_14
748 * @arg @ref LL_GPIO_PIN_15
749 * @arg @ref LL_GPIO_PIN_ALL
750 * @retval State of bit (1 or 0).
751 */
LL_GPIO_IsPinLocked(const GPIO_TypeDef * GPIOx,uint32_t PinMask)752 __STATIC_INLINE uint32_t LL_GPIO_IsPinLocked(const GPIO_TypeDef *GPIOx, uint32_t PinMask)
753 {
754 return ((READ_BIT(GPIOx->LCKR, PinMask) == (PinMask)) ? 1UL : 0UL);
755 }
756
757 /**
758 * @brief Return 1 if one of the pin of a dedicated port is locked. else return 0.
759 * @rmtoll LCKR LCKK LL_GPIO_IsAnyPinLocked
760 * @param GPIOx GPIO Port
761 * @retval State of bit (1 or 0).
762 */
LL_GPIO_IsAnyPinLocked(const GPIO_TypeDef * GPIOx)763 __STATIC_INLINE uint32_t LL_GPIO_IsAnyPinLocked(const GPIO_TypeDef *GPIOx)
764 {
765 return ((READ_BIT(GPIOx->LCKR, GPIO_LCKR_LCKK) == (GPIO_LCKR_LCKK)) ? 1UL : 0UL);
766 }
767
768 /**
769 * @}
770 */
771
772 /** @defgroup GPIO_LL_EF_Data_Access Data Access
773 * @{
774 */
775
776 /**
777 * @brief Return full input data register value for a dedicated port.
778 * @rmtoll IDR IDy LL_GPIO_ReadInputPort
779 * @param GPIOx GPIO Port
780 * @retval Input data register value of port
781 */
LL_GPIO_ReadInputPort(const GPIO_TypeDef * GPIOx)782 __STATIC_INLINE uint32_t LL_GPIO_ReadInputPort(const GPIO_TypeDef *GPIOx)
783 {
784 return (uint32_t)(READ_REG(GPIOx->IDR));
785 }
786
787 /**
788 * @brief Return if input data level for several pins of dedicated port is high or low.
789 * @rmtoll IDR IDy LL_GPIO_IsInputPinSet
790 * @param GPIOx GPIO Port
791 * @param PinMask This parameter can be a combination of the following values:
792 * @arg @ref LL_GPIO_PIN_0
793 * @arg @ref LL_GPIO_PIN_1
794 * @arg @ref LL_GPIO_PIN_2
795 * @arg @ref LL_GPIO_PIN_3
796 * @arg @ref LL_GPIO_PIN_4
797 * @arg @ref LL_GPIO_PIN_5
798 * @arg @ref LL_GPIO_PIN_6
799 * @arg @ref LL_GPIO_PIN_7
800 * @arg @ref LL_GPIO_PIN_8
801 * @arg @ref LL_GPIO_PIN_9
802 * @arg @ref LL_GPIO_PIN_10
803 * @arg @ref LL_GPIO_PIN_11
804 * @arg @ref LL_GPIO_PIN_12
805 * @arg @ref LL_GPIO_PIN_13
806 * @arg @ref LL_GPIO_PIN_14
807 * @arg @ref LL_GPIO_PIN_15
808 * @arg @ref LL_GPIO_PIN_ALL
809 * @retval State of bit (1 or 0).
810 */
LL_GPIO_IsInputPinSet(const GPIO_TypeDef * GPIOx,uint32_t PinMask)811 __STATIC_INLINE uint32_t LL_GPIO_IsInputPinSet(const GPIO_TypeDef *GPIOx, uint32_t PinMask)
812 {
813 return ((READ_BIT(GPIOx->IDR, PinMask) == (PinMask)) ? 1UL : 0UL);
814 }
815
816 /**
817 * @brief Write output data register for the port.
818 * @rmtoll ODR ODy LL_GPIO_WriteOutputPort
819 * @param GPIOx GPIO Port
820 * @param PortValue Level value for each pin of the port
821 * @retval None
822 */
LL_GPIO_WriteOutputPort(GPIO_TypeDef * GPIOx,uint32_t PortValue)823 __STATIC_INLINE void LL_GPIO_WriteOutputPort(GPIO_TypeDef *GPIOx, uint32_t PortValue)
824 {
825 WRITE_REG(GPIOx->ODR, PortValue);
826 }
827
828 /**
829 * @brief Return full output data register value for a dedicated port.
830 * @rmtoll ODR ODy LL_GPIO_ReadOutputPort
831 * @param GPIOx GPIO Port
832 * @retval Output data register value of port
833 */
LL_GPIO_ReadOutputPort(const GPIO_TypeDef * GPIOx)834 __STATIC_INLINE uint32_t LL_GPIO_ReadOutputPort(const GPIO_TypeDef *GPIOx)
835 {
836 return (uint32_t)(READ_REG(GPIOx->ODR));
837 }
838
839 /**
840 * @brief Return if input data level for several pins of dedicated port is high or low.
841 * @rmtoll ODR ODy LL_GPIO_IsOutputPinSet
842 * @param GPIOx GPIO Port
843 * @param PinMask This parameter can be a combination of the following values:
844 * @arg @ref LL_GPIO_PIN_0
845 * @arg @ref LL_GPIO_PIN_1
846 * @arg @ref LL_GPIO_PIN_2
847 * @arg @ref LL_GPIO_PIN_3
848 * @arg @ref LL_GPIO_PIN_4
849 * @arg @ref LL_GPIO_PIN_5
850 * @arg @ref LL_GPIO_PIN_6
851 * @arg @ref LL_GPIO_PIN_7
852 * @arg @ref LL_GPIO_PIN_8
853 * @arg @ref LL_GPIO_PIN_9
854 * @arg @ref LL_GPIO_PIN_10
855 * @arg @ref LL_GPIO_PIN_11
856 * @arg @ref LL_GPIO_PIN_12
857 * @arg @ref LL_GPIO_PIN_13
858 * @arg @ref LL_GPIO_PIN_14
859 * @arg @ref LL_GPIO_PIN_15
860 * @arg @ref LL_GPIO_PIN_ALL
861 * @retval State of bit (1 or 0).
862 */
LL_GPIO_IsOutputPinSet(const GPIO_TypeDef * GPIOx,uint32_t PinMask)863 __STATIC_INLINE uint32_t LL_GPIO_IsOutputPinSet(const GPIO_TypeDef *GPIOx, uint32_t PinMask)
864 {
865 return ((READ_BIT(GPIOx->ODR, PinMask) == (PinMask)) ? 1UL : 0UL);
866 }
867
868 /**
869 * @brief Set several pins to high level on dedicated gpio port.
870 * @rmtoll BSRR BSy LL_GPIO_SetOutputPin
871 * @param GPIOx GPIO Port
872 * @param PinMask This parameter can be a combination of the following values:
873 * @arg @ref LL_GPIO_PIN_0
874 * @arg @ref LL_GPIO_PIN_1
875 * @arg @ref LL_GPIO_PIN_2
876 * @arg @ref LL_GPIO_PIN_3
877 * @arg @ref LL_GPIO_PIN_4
878 * @arg @ref LL_GPIO_PIN_5
879 * @arg @ref LL_GPIO_PIN_6
880 * @arg @ref LL_GPIO_PIN_7
881 * @arg @ref LL_GPIO_PIN_8
882 * @arg @ref LL_GPIO_PIN_9
883 * @arg @ref LL_GPIO_PIN_10
884 * @arg @ref LL_GPIO_PIN_11
885 * @arg @ref LL_GPIO_PIN_12
886 * @arg @ref LL_GPIO_PIN_13
887 * @arg @ref LL_GPIO_PIN_14
888 * @arg @ref LL_GPIO_PIN_15
889 * @arg @ref LL_GPIO_PIN_ALL
890 * @retval None
891 */
LL_GPIO_SetOutputPin(GPIO_TypeDef * GPIOx,uint32_t PinMask)892 __STATIC_INLINE void LL_GPIO_SetOutputPin(GPIO_TypeDef *GPIOx, uint32_t PinMask)
893 {
894 WRITE_REG(GPIOx->BSRR, PinMask);
895 }
896
897 /**
898 * @brief Set several pins to low level on dedicated gpio port.
899 * @rmtoll BRR BRy LL_GPIO_ResetOutputPin
900 * @param GPIOx GPIO Port
901 * @param PinMask This parameter can be a combination of the following values:
902 * @arg @ref LL_GPIO_PIN_0
903 * @arg @ref LL_GPIO_PIN_1
904 * @arg @ref LL_GPIO_PIN_2
905 * @arg @ref LL_GPIO_PIN_3
906 * @arg @ref LL_GPIO_PIN_4
907 * @arg @ref LL_GPIO_PIN_5
908 * @arg @ref LL_GPIO_PIN_6
909 * @arg @ref LL_GPIO_PIN_7
910 * @arg @ref LL_GPIO_PIN_8
911 * @arg @ref LL_GPIO_PIN_9
912 * @arg @ref LL_GPIO_PIN_10
913 * @arg @ref LL_GPIO_PIN_11
914 * @arg @ref LL_GPIO_PIN_12
915 * @arg @ref LL_GPIO_PIN_13
916 * @arg @ref LL_GPIO_PIN_14
917 * @arg @ref LL_GPIO_PIN_15
918 * @arg @ref LL_GPIO_PIN_ALL
919 * @retval None
920 */
LL_GPIO_ResetOutputPin(GPIO_TypeDef * GPIOx,uint32_t PinMask)921 __STATIC_INLINE void LL_GPIO_ResetOutputPin(GPIO_TypeDef *GPIOx, uint32_t PinMask)
922 {
923 WRITE_REG(GPIOx->BRR, PinMask);
924 }
925
926 /**
927 * @brief Toggle data value for several pin of dedicated port.
928 * @rmtoll ODR ODy LL_GPIO_TogglePin
929 * @param GPIOx GPIO Port
930 * @param PinMask This parameter can be a combination of the following values:
931 * @arg @ref LL_GPIO_PIN_0
932 * @arg @ref LL_GPIO_PIN_1
933 * @arg @ref LL_GPIO_PIN_2
934 * @arg @ref LL_GPIO_PIN_3
935 * @arg @ref LL_GPIO_PIN_4
936 * @arg @ref LL_GPIO_PIN_5
937 * @arg @ref LL_GPIO_PIN_6
938 * @arg @ref LL_GPIO_PIN_7
939 * @arg @ref LL_GPIO_PIN_8
940 * @arg @ref LL_GPIO_PIN_9
941 * @arg @ref LL_GPIO_PIN_10
942 * @arg @ref LL_GPIO_PIN_11
943 * @arg @ref LL_GPIO_PIN_12
944 * @arg @ref LL_GPIO_PIN_13
945 * @arg @ref LL_GPIO_PIN_14
946 * @arg @ref LL_GPIO_PIN_15
947 * @arg @ref LL_GPIO_PIN_ALL
948 * @retval None
949 */
LL_GPIO_TogglePin(GPIO_TypeDef * GPIOx,uint32_t PinMask)950 __STATIC_INLINE void LL_GPIO_TogglePin(GPIO_TypeDef *GPIOx, uint32_t PinMask)
951 {
952 uint32_t odr = READ_REG(GPIOx->ODR);
953 WRITE_REG(GPIOx->BSRR, ((odr & PinMask) << 16u) | (~odr & PinMask));
954 }
955
956 /**
957 * @}
958 */
959
960 #if defined(USE_FULL_LL_DRIVER)
961 /** @defgroup GPIO_LL_EF_Init Initialization and de-initialization functions
962 * @{
963 */
964
965 ErrorStatus LL_GPIO_DeInit(const GPIO_TypeDef *GPIOx);
966 ErrorStatus LL_GPIO_Init(GPIO_TypeDef *GPIOx, const LL_GPIO_InitTypeDef *GPIO_InitStruct);
967 void LL_GPIO_StructInit(LL_GPIO_InitTypeDef *GPIO_InitStruct);
968
969 /**
970 * @}
971 */
972 #endif /* USE_FULL_LL_DRIVER */
973
974 /**
975 * @}
976 */
977
978 /**
979 * @}
980 */
981
982 #endif /* defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || */
983 /* defined (GPIOE) || defined (GPIOF) || defined (GPIOG) || defined (GPIOH) || */
984 /* defined (GPIOM) || defined (GPION) || defined (GPIOO) || defined (GPIOP) */
985
986 /**
987 * @}
988 */
989
990 #ifdef __cplusplus
991 }
992 #endif
993
994 #endif /* STM32H7RSxx_LL_GPIO_H */
995