comparison Common/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_gpio.h @ 160:e3ca52b8e7fa

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