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.c |
3 | * @file stm32l1xx_ll_gpio.c |
4 | * @author MCD Application Team |
4 | * @author MCD Application Team |
5 | * @brief GPIO LL module driver. |
5 | * @brief GPIO LL module driver. |
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 | #if defined(USE_FULL_LL_DRIVER) |
19 | #if defined(USE_FULL_LL_DRIVER) |
19 | |
20 | 20 | /* Includes ------------------------------------------------------------------*/ |
|
21 | /* Includes ------------------------------------------------------------------*/ |
21 | #include "stm32l1xx_ll_gpio.h" |
22 | #include "stm32l1xx_ll_gpio.h" |
22 | #include "stm32l1xx_ll_bus.h" |
23 | #include "stm32l1xx_ll_bus.h" |
23 | #ifdef USE_FULL_ASSERT |
24 | #ifdef USE_FULL_ASSERT |
24 | #include "stm32_assert.h" |
25 | #include "stm32_assert.h" |
25 | #else |
26 | #else |
26 | #define assert_param(expr) ((void)0U) |
27 | #define assert_param(expr) ((void)0U) |
27 | #endif |
28 | #endif |
28 | |
29 | 29 | /** @addtogroup STM32L1xx_LL_Driver |
|
30 | /** @addtogroup STM32L1xx_LL_Driver |
30 | * @{ |
31 | * @{ |
31 | */ |
32 | */ |
32 | |
33 | 33 | #if defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOF) || defined (GPIOG) || defined (GPIOH) |
|
34 | #if defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOF) || defined (GPIOG) || defined (GPIOH) |
34 | |
35 | 35 | /** @addtogroup GPIO_LL |
|
36 | /** @addtogroup GPIO_LL |
36 | * @{ |
37 | * @{ |
37 | */ |
38 | */ |
38 | |
39 | 39 | /* Private types -------------------------------------------------------------*/ |
|
40 | /* Private types -------------------------------------------------------------*/ |
40 | /* Private variables ---------------------------------------------------------*/ |
41 | /* Private variables ---------------------------------------------------------*/ |
41 | /* Private constants ---------------------------------------------------------*/ |
42 | /* Private constants ---------------------------------------------------------*/ |
42 | /* Private macros ------------------------------------------------------------*/ |
43 | /* Private macros ------------------------------------------------------------*/ |
43 | /** @addtogroup GPIO_LL_Private_Macros |
44 | /** @addtogroup GPIO_LL_Private_Macros |
44 | * @{ |
45 | * @{ |
45 | */ |
46 | */ |
46 | #define IS_LL_GPIO_PIN(__VALUE__) (((0x00000000U) < (__VALUE__)) && ((__VALUE__) <= (LL_GPIO_PIN_ALL))) |
47 | #define IS_LL_GPIO_PIN(__VALUE__) (((0x00000000U) < (__VALUE__)) && ((__VALUE__) <= (LL_GPIO_PIN_ALL))) |
47 | |
48 | 48 | #define IS_LL_GPIO_MODE(__VALUE__) (((__VALUE__) == LL_GPIO_MODE_INPUT) ||\ |
|
49 | #define IS_LL_GPIO_MODE(__VALUE__) (((__VALUE__) == LL_GPIO_MODE_INPUT) ||\ |
49 | ((__VALUE__) == LL_GPIO_MODE_OUTPUT) ||\ |
50 | ((__VALUE__) == LL_GPIO_MODE_OUTPUT) ||\ |
50 | ((__VALUE__) == LL_GPIO_MODE_ALTERNATE) ||\ |
51 | ((__VALUE__) == LL_GPIO_MODE_ALTERNATE) ||\ |
51 | ((__VALUE__) == LL_GPIO_MODE_ANALOG)) |
52 | ((__VALUE__) == LL_GPIO_MODE_ANALOG)) |
52 | |
53 | 53 | #define IS_LL_GPIO_OUTPUT_TYPE(__VALUE__) (((__VALUE__) == LL_GPIO_OUTPUT_PUSHPULL) ||\ |
|
54 | #define IS_LL_GPIO_OUTPUT_TYPE(__VALUE__) (((__VALUE__) == LL_GPIO_OUTPUT_PUSHPULL) ||\ |
54 | ((__VALUE__) == LL_GPIO_OUTPUT_OPENDRAIN)) |
55 | ((__VALUE__) == LL_GPIO_OUTPUT_OPENDRAIN)) |
55 | |
56 | 56 | #define IS_LL_GPIO_SPEED(__VALUE__) (((__VALUE__) == LL_GPIO_SPEED_FREQ_LOW) ||\ |
|
57 | #define IS_LL_GPIO_SPEED(__VALUE__) (((__VALUE__) == LL_GPIO_SPEED_FREQ_LOW) ||\ |
57 | ((__VALUE__) == LL_GPIO_SPEED_FREQ_MEDIUM) ||\ |
58 | ((__VALUE__) == LL_GPIO_SPEED_FREQ_MEDIUM) ||\ |
58 | ((__VALUE__) == LL_GPIO_SPEED_FREQ_HIGH) ||\ |
59 | ((__VALUE__) == LL_GPIO_SPEED_FREQ_HIGH) ||\ |
59 | ((__VALUE__) == LL_GPIO_SPEED_FREQ_VERY_HIGH)) |
60 | ((__VALUE__) == LL_GPIO_SPEED_FREQ_VERY_HIGH)) |
60 | |
61 | 61 | #define IS_LL_GPIO_PULL(__VALUE__) (((__VALUE__) == LL_GPIO_PULL_NO) ||\ |
|
62 | #define IS_LL_GPIO_PULL(__VALUE__) (((__VALUE__) == LL_GPIO_PULL_NO) ||\ |
62 | ((__VALUE__) == LL_GPIO_PULL_UP) ||\ |
63 | ((__VALUE__) == LL_GPIO_PULL_UP) ||\ |
63 | ((__VALUE__) == LL_GPIO_PULL_DOWN)) |
64 | ((__VALUE__) == LL_GPIO_PULL_DOWN)) |
64 | |
65 | 65 | #define IS_LL_GPIO_ALTERNATE(__VALUE__) (((__VALUE__) == LL_GPIO_AF_0 ) ||\ |
|
66 | #define IS_LL_GPIO_ALTERNATE(__VALUE__) (((__VALUE__) == LL_GPIO_AF_0 ) ||\ |
66 | ((__VALUE__) == LL_GPIO_AF_1 ) ||\ |
67 | ((__VALUE__) == LL_GPIO_AF_1 ) ||\ |
67 | ((__VALUE__) == LL_GPIO_AF_2 ) ||\ |
68 | ((__VALUE__) == LL_GPIO_AF_2 ) ||\ |
68 | ((__VALUE__) == LL_GPIO_AF_3 ) ||\ |
69 | ((__VALUE__) == LL_GPIO_AF_3 ) ||\ |
69 | ((__VALUE__) == LL_GPIO_AF_4 ) ||\ |
70 | ((__VALUE__) == LL_GPIO_AF_4 ) ||\ |
70 | ((__VALUE__) == LL_GPIO_AF_5 ) ||\ |
71 | ((__VALUE__) == LL_GPIO_AF_5 ) ||\ |
71 | ((__VALUE__) == LL_GPIO_AF_6 ) ||\ |
72 | ((__VALUE__) == LL_GPIO_AF_6 ) ||\ |
72 | ((__VALUE__) == LL_GPIO_AF_7 ) ||\ |
73 | ((__VALUE__) == LL_GPIO_AF_7 ) ||\ |
73 | ((__VALUE__) == LL_GPIO_AF_8 ) ||\ |
74 | ((__VALUE__) == LL_GPIO_AF_8 ) ||\ |
74 | ((__VALUE__) == LL_GPIO_AF_9 ) ||\ |
75 | ((__VALUE__) == LL_GPIO_AF_9 ) ||\ |
75 | ((__VALUE__) == LL_GPIO_AF_10 ) ||\ |
76 | ((__VALUE__) == LL_GPIO_AF_10 ) ||\ |
76 | ((__VALUE__) == LL_GPIO_AF_11 ) ||\ |
77 | ((__VALUE__) == LL_GPIO_AF_11 ) ||\ |
77 | ((__VALUE__) == LL_GPIO_AF_12 ) ||\ |
78 | ((__VALUE__) == LL_GPIO_AF_12 ) ||\ |
78 | ((__VALUE__) == LL_GPIO_AF_13 ) ||\ |
79 | ((__VALUE__) == LL_GPIO_AF_13 ) ||\ |
79 | ((__VALUE__) == LL_GPIO_AF_14 ) ||\ |
80 | ((__VALUE__) == LL_GPIO_AF_14 ) ||\ |
80 | ((__VALUE__) == LL_GPIO_AF_15 )) |
81 | ((__VALUE__) == LL_GPIO_AF_15 )) |
81 | /** |
82 | /** |
82 | * @} |
83 | * @} |
83 | */ |
84 | */ |
84 | |
85 | 85 | /* Private function prototypes -----------------------------------------------*/ |
|
86 | /* Private function prototypes -----------------------------------------------*/ |
86 | |
87 | 87 | /* Exported functions --------------------------------------------------------*/ |
|
88 | /* Exported functions --------------------------------------------------------*/ |
88 | /** @addtogroup GPIO_LL_Exported_Functions |
89 | /** @addtogroup GPIO_LL_Exported_Functions |
89 | * @{ |
90 | * @{ |
90 | */ |
91 | */ |
91 | |
92 | 92 | /** @addtogroup GPIO_LL_EF_Init |
|
93 | /** @addtogroup GPIO_LL_EF_Init |
93 | * @{ |
94 | * @{ |
94 | */ |
95 | */ |
95 | |
96 | 96 | /** |
|
97 | /** |
97 | * @brief De-initialize GPIO registers (Registers restored to their default values). |
98 | * @brief De-initialize GPIO registers (Registers restored to their default values). |
98 | * @param GPIOx GPIO Port |
99 | * @param GPIOx GPIO Port |
99 | * @retval An ErrorStatus enumeration value: |
100 | * @retval An ErrorStatus enumeration value: |
100 | * - SUCCESS: GPIO registers are de-initialized |
101 | * - SUCCESS: GPIO registers are de-initialized |
101 | * - ERROR: Wrong GPIO Port |
102 | * - ERROR: Wrong GPIO Port |
102 | */ |
103 | */ |
103 | ErrorStatus LL_GPIO_DeInit(GPIO_TypeDef *GPIOx) |
104 | ErrorStatus LL_GPIO_DeInit(GPIO_TypeDef *GPIOx) |
104 | { |
105 | { |
105 | ErrorStatus status = SUCCESS; |
106 | ErrorStatus status = SUCCESS; |
106 | |
107 | 107 | /* Check the parameters */ |
|
108 | /* Check the parameters */ |
108 | assert_param(IS_GPIO_ALL_INSTANCE(GPIOx)); |
109 | assert_param(IS_GPIO_ALL_INSTANCE(GPIOx)); |
109 | |
110 | 110 | /* Force and Release reset on clock of GPIOx Port */ |
|
111 | /* Force and Release reset on clock of GPIOx Port */ |
111 | if (GPIOx == GPIOA) |
112 | if (GPIOx == GPIOA) |
112 | { |
113 | { |
113 | LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOA); |
114 | LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOA); |
114 | LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOA); |
115 | LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOA); |
115 | } |
116 | } |
116 | else if (GPIOx == GPIOB) |
117 | else if (GPIOx == GPIOB) |
117 | { |
118 | { |
118 | LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOB); |
119 | LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOB); |
119 | LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOB); |
120 | LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOB); |
120 | } |
121 | } |
121 | else if (GPIOx == GPIOC) |
122 | else if (GPIOx == GPIOC) |
122 | { |
123 | { |
123 | LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOC); |
124 | LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOC); |
124 | LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOC); |
125 | LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOC); |
125 | } |
126 | } |
126 | #if defined(GPIOD) |
127 | #if defined(GPIOD) |
127 | else if (GPIOx == GPIOD) |
128 | else if (GPIOx == GPIOD) |
128 | { |
129 | { |
129 | LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOD); |
130 | LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOD); |
130 | LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOD); |
131 | LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOD); |
131 | } |
132 | } |
132 | #endif /* GPIOD */ |
133 | #endif /* GPIOD */ |
133 | #if defined(GPIOE) |
134 | #if defined(GPIOE) |
134 | else if (GPIOx == GPIOE) |
135 | else if (GPIOx == GPIOE) |
135 | { |
136 | { |
136 | LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOE); |
137 | LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOE); |
137 | LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOE); |
138 | LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOE); |
138 | } |
139 | } |
139 | #endif /* GPIOE */ |
140 | #endif /* GPIOE */ |
140 | #if defined(GPIOF) |
141 | #if defined(GPIOF) |
141 | else if (GPIOx == GPIOF) |
142 | else if (GPIOx == GPIOF) |
142 | { |
143 | { |
143 | LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOF); |
144 | LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOF); |
144 | LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOF); |
145 | LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOF); |
145 | } |
146 | } |
146 | #endif /* GPIOF */ |
147 | #endif /* GPIOF */ |
147 | #if defined(GPIOG) |
148 | #if defined(GPIOG) |
148 | else if (GPIOx == GPIOG) |
149 | else if (GPIOx == GPIOG) |
149 | { |
150 | { |
150 | LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOG); |
151 | LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOG); |
151 | LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOG); |
152 | LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOG); |
152 | } |
153 | } |
153 | #endif /* GPIOG */ |
154 | #endif /* GPIOG */ |
154 | #if defined(GPIOH) |
155 | #if defined(GPIOH) |
155 | else if (GPIOx == GPIOH) |
156 | else if (GPIOx == GPIOH) |
156 | { |
157 | { |
157 | LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOH); |
158 | LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPIOH); |
158 | LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOH); |
159 | LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPIOH); |
159 | } |
160 | } |
160 | #endif /* GPIOH */ |
161 | #endif /* GPIOH */ |
161 | else |
162 | else |
162 | { |
163 | { |
163 | status = ERROR; |
164 | status = ERROR; |
164 | } |
165 | } |
165 | |
166 | 166 | return (status); |
|
167 | return (status); |
167 | } |
168 | } |
168 | |
169 | 169 | /** |
|
170 | /** |
170 | * @brief Initialize GPIO registers according to the specified parameters in GPIO_InitStruct. |
171 | * @brief Initialize GPIO registers according to the specified parameters in GPIO_InitStruct. |
171 | * @param GPIOx GPIO Port |
172 | * @param GPIOx GPIO Port |
172 | * @param GPIO_InitStruct pointer to a @ref LL_GPIO_InitTypeDef structure |
173 | * @param GPIO_InitStruct pointer to a @ref LL_GPIO_InitTypeDef structure |
173 | * that contains the configuration information for the specified GPIO peripheral. |
174 | * that contains the configuration information for the specified GPIO peripheral. |
174 | * @retval An ErrorStatus enumeration value: |
175 | * @retval An ErrorStatus enumeration value: |
175 | * - SUCCESS: GPIO registers are initialized according to GPIO_InitStruct content |
176 | * - SUCCESS: GPIO registers are initialized according to GPIO_InitStruct content |
176 | * - ERROR: Not applicable |
177 | * - ERROR: Not applicable |
177 | */ |
178 | */ |
178 | ErrorStatus LL_GPIO_Init(GPIO_TypeDef *GPIOx, LL_GPIO_InitTypeDef *GPIO_InitStruct) |
179 | ErrorStatus LL_GPIO_Init(GPIO_TypeDef *GPIOx, LL_GPIO_InitTypeDef *GPIO_InitStruct) |
179 | { |
180 | { |
180 | uint32_t pinpos = 0x00000000U; |
181 | uint32_t pinpos = 0x00000000U; |
181 | uint32_t currentpin = 0x00000000U; |
182 | uint32_t currentpin = 0x00000000U; |
182 | |
183 | 183 | /* Check the parameters */ |
|
184 | /* Check the parameters */ |
184 | assert_param(IS_GPIO_ALL_INSTANCE(GPIOx)); |
185 | assert_param(IS_GPIO_ALL_INSTANCE(GPIOx)); |
185 | assert_param(IS_LL_GPIO_PIN(GPIO_InitStruct->Pin)); |
186 | assert_param(IS_LL_GPIO_PIN(GPIO_InitStruct->Pin)); |
186 | assert_param(IS_LL_GPIO_MODE(GPIO_InitStruct->Mode)); |
187 | assert_param(IS_LL_GPIO_MODE(GPIO_InitStruct->Mode)); |
187 | assert_param(IS_LL_GPIO_PULL(GPIO_InitStruct->Pull)); |
188 | assert_param(IS_LL_GPIO_PULL(GPIO_InitStruct->Pull)); |
188 | |
189 | 189 | /* ------------------------- Configure the port pins ---------------- */ |
|
190 | /* ------------------------- Configure the port pins ---------------- */ |
190 | /* Initialize pinpos on first pin set */ |
191 | /* Initialize pinpos on first pin set */ |
191 | pinpos = POSITION_VAL(GPIO_InitStruct->Pin); |
192 | pinpos = POSITION_VAL(GPIO_InitStruct->Pin); |
192 | |
193 | 193 | /* Configure the port pins */ |
|
194 | /* Configure the port pins */ |
194 | while (((GPIO_InitStruct->Pin) >> pinpos) != 0x00000000U) |
195 | while (((GPIO_InitStruct->Pin) >> pinpos) != 0x00000000U) |
195 | { |
196 | { |
196 | /* Get current io position */ |
197 | /* Get current io position */ |
197 | currentpin = (GPIO_InitStruct->Pin) & (0x00000001U << pinpos); |
198 | currentpin = (GPIO_InitStruct->Pin) & (0x00000001U << pinpos); |
198 | |
199 | 199 | if (currentpin) |
|
200 | if (currentpin) |
200 | { |
201 | { |
201 | |
202 | 202 | if ((GPIO_InitStruct->Mode == LL_GPIO_MODE_OUTPUT) || (GPIO_InitStruct->Mode == LL_GPIO_MODE_ALTERNATE)) |
|
203 | if ((GPIO_InitStruct->Mode == LL_GPIO_MODE_OUTPUT) || (GPIO_InitStruct->Mode == LL_GPIO_MODE_ALTERNATE)) |
203 | { |
204 | { |
204 | /* Check Speed mode parameters */ |
205 | /* Check Speed mode parameters */ |
205 | assert_param(IS_LL_GPIO_SPEED(GPIO_InitStruct->Speed)); |
206 | assert_param(IS_LL_GPIO_SPEED(GPIO_InitStruct->Speed)); |
206 | |
207 | 207 | /* Speed mode configuration */ |
|
208 | /* Speed mode configuration */ |
208 | LL_GPIO_SetPinSpeed(GPIOx, currentpin, GPIO_InitStruct->Speed); |
209 | LL_GPIO_SetPinSpeed(GPIOx, currentpin, GPIO_InitStruct->Speed); |
209 | |
210 | 210 | /* Check Output mode parameters */ |
|
211 | /* Check Output mode parameters */ |
211 | assert_param(IS_LL_GPIO_OUTPUT_TYPE(GPIO_InitStruct->OutputType)); |
212 | assert_param(IS_LL_GPIO_OUTPUT_TYPE(GPIO_InitStruct->OutputType)); |
212 | |
213 | 213 | /* Output mode configuration*/ |
|
214 | /* Output mode configuration*/ |
214 | LL_GPIO_SetPinOutputType(GPIOx, currentpin, GPIO_InitStruct->OutputType); |
215 | LL_GPIO_SetPinOutputType(GPIOx, currentpin, GPIO_InitStruct->OutputType); |
215 | } |
216 | } |
216 | |
217 | 217 | /* Pull-up Pull down resistor configuration*/ |
|
218 | /* Pull-up Pull down resistor configuration*/ |
218 | LL_GPIO_SetPinPull(GPIOx, currentpin, GPIO_InitStruct->Pull); |
219 | LL_GPIO_SetPinPull(GPIOx, currentpin, GPIO_InitStruct->Pull); |
219 | |
220 | 220 | if (GPIO_InitStruct->Mode == LL_GPIO_MODE_ALTERNATE) |
|
221 | if (GPIO_InitStruct->Mode == LL_GPIO_MODE_ALTERNATE) |
221 | { |
222 | { |
222 | /* Check Alternate parameter */ |
223 | /* Check Alternate parameter */ |
223 | assert_param(IS_LL_GPIO_ALTERNATE(GPIO_InitStruct->Alternate)); |
224 | assert_param(IS_LL_GPIO_ALTERNATE(GPIO_InitStruct->Alternate)); |
224 | |
225 | 225 | /* Speed mode configuration */ |
|
226 | /* Speed mode configuration */ |
226 | if (POSITION_VAL(currentpin) < 0x00000008U) |
227 | if (POSITION_VAL(currentpin) < 0x00000008U) |
227 | { |
228 | { |
228 | LL_GPIO_SetAFPin_0_7(GPIOx, currentpin, GPIO_InitStruct->Alternate); |
229 | LL_GPIO_SetAFPin_0_7(GPIOx, currentpin, GPIO_InitStruct->Alternate); |
229 | } |
230 | } |
230 | else |
231 | else |
231 | { |
232 | { |
232 | LL_GPIO_SetAFPin_8_15(GPIOx, currentpin, GPIO_InitStruct->Alternate); |
233 | LL_GPIO_SetAFPin_8_15(GPIOx, currentpin, GPIO_InitStruct->Alternate); |
233 | } |
234 | } |
234 | } |
235 | } |
235 | |
236 | 236 | /* Pin Mode configuration */ |
|
237 | /* Pin Mode configuration */ |
237 | LL_GPIO_SetPinMode(GPIOx, currentpin, GPIO_InitStruct->Mode); |
238 | LL_GPIO_SetPinMode(GPIOx, currentpin, GPIO_InitStruct->Mode); |
238 | } |
239 | } |
239 | pinpos++; |
240 | pinpos++; |
240 | } |
241 | } |
241 | |
242 | 242 | return (SUCCESS); |
|
243 | return (SUCCESS); |
243 | } |
244 | } |
244 | |
245 | 245 | /** |
|
246 | /** |
246 | * @brief Set each @ref LL_GPIO_InitTypeDef field to default value. |
247 | * @brief Set each @ref LL_GPIO_InitTypeDef field to default value. |
247 | * @param GPIO_InitStruct: pointer to a @ref LL_GPIO_InitTypeDef structure |
248 | * @param GPIO_InitStruct: pointer to a @ref LL_GPIO_InitTypeDef structure |
248 | * whose fields will be set to default values. |
249 | * whose fields will be set to default values. |
249 | * @retval None |
250 | * @retval None |
250 | */ |
251 | */ |
251 | |
252 | 252 | void LL_GPIO_StructInit(LL_GPIO_InitTypeDef *GPIO_InitStruct) |
|
253 | void LL_GPIO_StructInit(LL_GPIO_InitTypeDef *GPIO_InitStruct) |
253 | { |
254 | { |
254 | /* Reset GPIO init structure parameters values */ |
255 | /* Reset GPIO init structure parameters values */ |
255 | GPIO_InitStruct->Pin = LL_GPIO_PIN_ALL; |
256 | GPIO_InitStruct->Pin = LL_GPIO_PIN_ALL; |
256 | GPIO_InitStruct->Mode = LL_GPIO_MODE_ANALOG; |
257 | GPIO_InitStruct->Mode = LL_GPIO_MODE_ANALOG; |
257 | GPIO_InitStruct->Speed = LL_GPIO_SPEED_FREQ_LOW; |
258 | GPIO_InitStruct->Speed = LL_GPIO_SPEED_FREQ_LOW; |
258 | GPIO_InitStruct->OutputType = LL_GPIO_OUTPUT_PUSHPULL; |
259 | GPIO_InitStruct->OutputType = LL_GPIO_OUTPUT_PUSHPULL; |
259 | GPIO_InitStruct->Pull = LL_GPIO_PULL_NO; |
260 | GPIO_InitStruct->Pull = LL_GPIO_PULL_NO; |
260 | GPIO_InitStruct->Alternate = LL_GPIO_AF_0; |
261 | GPIO_InitStruct->Alternate = LL_GPIO_AF_0; |
261 | } |
262 | } |
262 | |
263 | 263 | /** |
|
264 | /** |
264 | * @} |
265 | * @} |
265 | */ |
266 | */ |
266 | |
267 | 267 | /** |
|
268 | /** |
268 | * @} |
269 | * @} |
269 | */ |
270 | */ |
270 | |
271 | 271 | /** |
|
272 | /** |
272 | * @} |
273 | * @} |
273 | */ |
274 | */ |
274 | |
275 | 275 | #endif /* defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOF) || defined (GPIOG) || defined (GPIOH) */ |
|
276 | #endif /* defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOF) || defined (GPIOG) || defined (GPIOH) */ |
276 | |
277 | 277 | /** |
|
278 | /** |
278 | * @} |
279 | * @} |
279 | */ |
280 | */ |
280 | |
281 | 281 | #endif /* USE_FULL_LL_DRIVER */ |
|
282 | #endif /* USE_FULL_LL_DRIVER */ |
282 | |
283 | - | ||
284 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
- |