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