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