0
|
1 /**
|
|
2 ******************************************************************************
|
|
3 * @file stm32l4xx_hal_gpio_ex.h
|
|
4 * @author MCD Application Team
|
|
5 * @version V1.6.0
|
|
6 * @date 28-October-2016
|
|
7 * @brief Header file of GPIO HAL Extended module.
|
|
8 ******************************************************************************
|
|
9 * @attention
|
|
10 *
|
|
11 * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
|
|
12 *
|
|
13 * Redistribution and use in source and binary forms, with or without modification,
|
|
14 * are permitted provided that the following conditions are met:
|
|
15 * 1. Redistributions of source code must retain the above copyright notice,
|
|
16 * this list of conditions and the following disclaimer.
|
|
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
18 * this list of conditions and the following disclaimer in the documentation
|
|
19 * and/or other materials provided with the distribution.
|
|
20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
21 * may be used to endorse or promote products derived from this software
|
|
22 * without specific prior written permission.
|
|
23 *
|
|
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34 *
|
|
35 ******************************************************************************
|
|
36 */
|
|
37
|
|
38 /* Define to prevent recursive inclusion -------------------------------------*/
|
|
39 #ifndef __STM32L4xx_HAL_GPIO_EX_H
|
|
40 #define __STM32L4xx_HAL_GPIO_EX_H
|
|
41
|
|
42 #ifdef __cplusplus
|
|
43 extern "C" {
|
|
44 #endif
|
|
45
|
|
46 /* Includes ------------------------------------------------------------------*/
|
|
47 #include "stm32l4xx_hal_def.h"
|
|
48
|
|
49 /** @addtogroup STM32L4xx_HAL_Driver
|
|
50 * @{
|
|
51 */
|
|
52
|
|
53 /** @defgroup GPIOEx GPIOEx
|
|
54 * @brief GPIO Extended HAL module driver
|
|
55 * @{
|
|
56 */
|
|
57
|
|
58 /* Exported types ------------------------------------------------------------*/
|
|
59 /* Exported constants --------------------------------------------------------*/
|
|
60 /** @defgroup GPIOEx_Exported_Constants GPIOEx Exported Constants
|
|
61 * @{
|
|
62 */
|
|
63
|
|
64 /** @defgroup GPIOEx_Alternate_function_selection GPIOEx Alternate function selection
|
|
65 * @{
|
|
66 */
|
|
67
|
|
68 #if defined(STM32L431xx) || defined(STM32L432xx) || defined(STM32L433xx) || defined(STM32L442xx) || defined(STM32L443xx)
|
|
69 /*--------------STM32L431xx/STM32L432xx/STM32L433xx/STM32L442xx/STM32L443xx---*/
|
|
70 /**
|
|
71 * @brief AF 0 selection
|
|
72 */
|
|
73 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
|
|
74 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
|
|
75 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
|
|
76 #if defined(STM32L433xx) || defined(STM32L443xx)
|
|
77 #define GPIO_AF0_LCDBIAS ((uint8_t)0x00) /* LCDBIAS Alternate Function mapping */
|
|
78 #endif /* STM32L433xx || STM32L443xx */
|
|
79 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
|
|
80
|
|
81 /**
|
|
82 * @brief AF 1 selection
|
|
83 */
|
|
84 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
|
|
85 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
|
|
86 #define GPIO_AF1_LPTIM1 ((uint8_t)0x01) /* LPTIM1 Alternate Function mapping */
|
|
87 #define GPIO_AF1_IR ((uint8_t)0x01) /* IR Alternate Function mapping */
|
|
88
|
|
89 /**
|
|
90 * @brief AF 2 selection
|
|
91 */
|
|
92 #define GPIO_AF2_TIM1 ((uint8_t)0x02) /* TIM1 Alternate Function mapping */
|
|
93 #define GPIO_AF2_TIM2 ((uint8_t)0x02) /* TIM2 Alternate Function mapping */
|
|
94
|
|
95 /**
|
|
96 * @brief AF 3 selection
|
|
97 */
|
|
98 #define GPIO_AF3_USART2 ((uint8_t)0x03) /* USART1 Alternate Function mapping */
|
|
99 #define GPIO_AF3_TIM1_COMP2 ((uint8_t)0x03) /* TIM1/COMP2 Break in Alternate Function mapping */
|
|
100 #define GPIO_AF3_TIM1_COMP1 ((uint8_t)0x03) /* TIM1/COMP1 Break in Alternate Function mapping */
|
|
101
|
|
102 /**
|
|
103 * @brief AF 4 selection
|
|
104 */
|
|
105 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
|
|
106 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
|
|
107 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */
|
|
108
|
|
109 /**
|
|
110 * @brief AF 5 selection
|
|
111 */
|
|
112 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */
|
|
113 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2 Alternate Function mapping */
|
|
114
|
|
115 /**
|
|
116 * @brief AF 6 selection
|
|
117 */
|
|
118 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3 Alternate Function mapping */
|
|
119 #define GPIO_AF6_COMP1 ((uint8_t)0x06) /* COMP1 Alternate Function mapping */
|
|
120
|
|
121 /**
|
|
122 * @brief AF 7 selection
|
|
123 */
|
|
124 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
|
|
125 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
|
|
126 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */
|
|
127
|
|
128 /**
|
|
129 * @brief AF 8 selection
|
|
130 */
|
|
131 #define GPIO_AF8_LPUART1 ((uint8_t)0x08) /* LPUART1 Alternate Function mapping */
|
|
132
|
|
133 /**
|
|
134 * @brief AF 9 selection
|
|
135 */
|
|
136 #define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */
|
|
137 #define GPIO_AF9_TSC ((uint8_t)0x09) /* TSC Alternate Function mapping */
|
|
138
|
|
139 /**
|
|
140 * @brief AF 10 selection
|
|
141 */
|
|
142 #if defined(STM32L432xx) || defined(STM32L433xx) || defined(STM32L442xx) || defined(STM32L443xx)
|
|
143 #define GPIO_AF10_USB_FS ((uint8_t)0x0A) /* USB_FS Alternate Function mapping */
|
|
144 #endif /* STM32L432xx || STM32L433xx || STM32L442xx || STM32L443xx */
|
|
145 #define GPIO_AF10_QUADSPI ((uint8_t)0x0A) /* QUADSPI Alternate Function mapping */
|
|
146
|
|
147 #if defined(STM32L433xx) || defined(STM32L443xx)
|
|
148 /**
|
|
149 * @brief AF 11 selection
|
|
150 */
|
|
151 #define GPIO_AF11_LCD ((uint8_t)0x0B) /* LCD Alternate Function mapping */
|
|
152 #endif /* STM32L433xx || STM32L443xx */
|
|
153
|
|
154 /**
|
|
155 * @brief AF 12 selection
|
|
156 */
|
|
157 #define GPIO_AF12_SWPMI1 ((uint8_t)0x0C) /* SWPMI1 Alternate Function mapping */
|
|
158 #define GPIO_AF12_COMP1 ((uint8_t)0x0C) /* COMP1 Alternate Function mapping */
|
|
159 #define GPIO_AF12_COMP2 ((uint8_t)0x0C) /* COMP2 Alternate Function mapping */
|
|
160 #define GPIO_AF12_SDMMC1 ((uint8_t)0x0C) /* SDMMC1 Alternate Function mapping */
|
|
161
|
|
162 /**
|
|
163 * @brief AF 13 selection
|
|
164 */
|
|
165 #define GPIO_AF13_SAI1 ((uint8_t)0x0D) /* SAI1 Alternate Function mapping */
|
|
166
|
|
167 /**
|
|
168 * @brief AF 14 selection
|
|
169 */
|
|
170 #define GPIO_AF14_TIM2 ((uint8_t)0x0E) /* TIM2 Alternate Function mapping */
|
|
171 #define GPIO_AF14_TIM15 ((uint8_t)0x0E) /* TIM15 Alternate Function mapping */
|
|
172 #define GPIO_AF14_TIM16 ((uint8_t)0x0E) /* TIM16 Alternate Function mapping */
|
|
173 #define GPIO_AF14_LPTIM2 ((uint8_t)0x0E) /* LPTIM2 Alternate Function mapping */
|
|
174
|
|
175 /**
|
|
176 * @brief AF 15 selection
|
|
177 */
|
|
178 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
|
|
179
|
|
180 #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x0F)
|
|
181
|
|
182 #endif /* STM32L431xx || STM32L432xx || STM32L433xx || STM32L442xx || STM32L443xx */
|
|
183
|
|
184 #if defined(STM32L451xx) || defined(STM32L452xx) || defined(STM32L462xx)
|
|
185 /*--------------STM32L451xx/STM32L452xx/STM32L462xx---------------------------*/
|
|
186 /**
|
|
187 * @brief AF 0 selection
|
|
188 */
|
|
189 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
|
|
190 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
|
|
191 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
|
|
192 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
|
|
193
|
|
194 /**
|
|
195 * @brief AF 1 selection
|
|
196 */
|
|
197 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
|
|
198 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
|
|
199 #define GPIO_AF1_LPTIM1 ((uint8_t)0x01) /* LPTIM1 Alternate Function mapping */
|
|
200 #define GPIO_AF1_IR ((uint8_t)0x01) /* IR Alternate Function mapping */
|
|
201
|
|
202 /**
|
|
203 * @brief AF 2 selection
|
|
204 */
|
|
205 #define GPIO_AF2_TIM1 ((uint8_t)0x02) /* TIM1 Alternate Function mapping */
|
|
206 #define GPIO_AF2_TIM2 ((uint8_t)0x02) /* TIM2 Alternate Function mapping */
|
|
207 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
|
|
208 #define GPIO_AF2_I2C4 ((uint8_t)0x02) /* I2C4 Alternate Function mapping */
|
|
209
|
|
210 /**
|
|
211 * @brief AF 3 selection
|
|
212 */
|
|
213 #define GPIO_AF3_TIM1_COMP2 ((uint8_t)0x03) /* TIM1/COMP2 Break in Alternate Function mapping */
|
|
214 #define GPIO_AF3_TIM1_COMP1 ((uint8_t)0x03) /* TIM1/COMP1 Break in Alternate Function mapping */
|
|
215 #define GPIO_AF3_USART2 ((uint8_t)0x03) /* USART2 Alternate Function mapping */
|
|
216 #define GPIO_AF3_CAN1 ((uint8_t)0x03) /* CAN1 Alternate Function mapping */
|
|
217 #define GPIO_AF3_I2C4 ((uint8_t)0x03) /* I2C4 Alternate Function mapping */
|
|
218
|
|
219 /**
|
|
220 * @brief AF 4 selection
|
|
221 */
|
|
222 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
|
|
223 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
|
|
224 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */
|
|
225 #define GPIO_AF4_I2C4 ((uint8_t)0x04) /* I2C4 Alternate Function mapping */
|
|
226
|
|
227 /**
|
|
228 * @brief AF 5 selection
|
|
229 */
|
|
230 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */
|
|
231 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2 Alternate Function mapping */
|
|
232 #define GPIO_AF5_I2C4 ((uint8_t)0x05) /* I2C4 Alternate Function mapping */
|
|
233
|
|
234 /**
|
|
235 * @brief AF 6 selection
|
|
236 */
|
|
237 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3 Alternate Function mapping */
|
|
238 #define GPIO_AF6_DFSDM1 ((uint8_t)0x06) /* DFSDM1 Alternate Function mapping */
|
|
239 #define GPIO_AF6_COMP1 ((uint8_t)0x06) /* COMP1 Alternate Function mapping */
|
|
240
|
|
241 /**
|
|
242 * @brief AF 7 selection
|
|
243 */
|
|
244 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
|
|
245 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
|
|
246 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */
|
|
247
|
|
248 /**
|
|
249 * @brief AF 8 selection
|
|
250 */
|
|
251 #define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */
|
|
252 #define GPIO_AF8_LPUART1 ((uint8_t)0x08) /* LPUART1 Alternate Function mapping */
|
|
253 #define GPIO_AF8_CAN1 ((uint8_t)0x08) /* CAN1 Alternate Function mapping */
|
|
254
|
|
255
|
|
256 /**
|
|
257 * @brief AF 9 selection
|
|
258 */
|
|
259 #define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */
|
|
260 #define GPIO_AF9_TSC ((uint8_t)0x09) /* TSC Alternate Function mapping */
|
|
261
|
|
262 /**
|
|
263 * @brief AF 10 selection
|
|
264 */
|
|
265 #if defined(STM32L452xx) || defined(STM32L462xx)
|
|
266 #define GPIO_AF10_USB_FS ((uint8_t)0x0A) /* USB_FS Alternate Function mapping */
|
|
267 #endif /* STM32L452xx || STM32L462xx */
|
|
268 #define GPIO_AF10_QUADSPI ((uint8_t)0x0A) /* QUADSPI Alternate Function mapping */
|
|
269 #define GPIO_AF10_CAN1 ((uint8_t)0x0A) /* CAN1 Alternate Function mapping */
|
|
270
|
|
271 /**
|
|
272 * @brief AF 11 selection
|
|
273 */
|
|
274
|
|
275 /**
|
|
276 * @brief AF 12 selection
|
|
277 */
|
|
278 #define GPIO_AF12_COMP1 ((uint8_t)0x0C) /* COMP1 Alternate Function mapping */
|
|
279 #define GPIO_AF12_COMP2 ((uint8_t)0x0C) /* COMP2 Alternate Function mapping */
|
|
280 #define GPIO_AF12_SDMMC1 ((uint8_t)0x0C) /* SDMMC1 Alternate Function mapping */
|
|
281
|
|
282 /**
|
|
283 * @brief AF 13 selection
|
|
284 */
|
|
285 #define GPIO_AF13_SAI1 ((uint8_t)0x0D) /* SAI1 Alternate Function mapping */
|
|
286
|
|
287 /**
|
|
288 * @brief AF 14 selection
|
|
289 */
|
|
290 #define GPIO_AF14_TIM2 ((uint8_t)0x0E) /* TIM2 Alternate Function mapping */
|
|
291 #define GPIO_AF14_TIM15 ((uint8_t)0x0E) /* TIM15 Alternate Function mapping */
|
|
292 #define GPIO_AF14_TIM16 ((uint8_t)0x0E) /* TIM16 Alternate Function mapping */
|
|
293 #define GPIO_AF14_TIM17 ((uint8_t)0x0E) /* TIM17 Alternate Function mapping */
|
|
294 #define GPIO_AF14_LPTIM2 ((uint8_t)0x0E) /* LPTIM2 Alternate Function mapping */
|
|
295
|
|
296 /**
|
|
297 * @brief AF 15 selection
|
|
298 */
|
|
299 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
|
|
300
|
|
301 #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x0F)
|
|
302
|
|
303 #endif /* STM32L451xx || STM32L452xx || STM32L462xx */
|
|
304
|
|
305 #if defined(STM32L471xx) || defined(STM32L475xx) || defined(STM32L476xx) || defined(STM32L485xx) || defined(STM32L486xx)
|
|
306 /*--------------STM32L471xx/STM32L475xx/STM32L476xx/STM32L485xx/STM32L486xx---*/
|
|
307 /**
|
|
308 * @brief AF 0 selection
|
|
309 */
|
|
310 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
|
|
311 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
|
|
312 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
|
|
313 #if defined(STM32L476xx) || defined(STM32L486xx)
|
|
314 #define GPIO_AF0_LCDBIAS ((uint8_t)0x00) /* LCDBIAS Alternate Function mapping */
|
|
315 #endif /* STM32L476xx || STM32L486xx */
|
|
316 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
|
|
317
|
|
318 /**
|
|
319 * @brief AF 1 selection
|
|
320 */
|
|
321 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
|
|
322 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
|
|
323 #define GPIO_AF1_TIM5 ((uint8_t)0x01) /* TIM5 Alternate Function mapping */
|
|
324 #define GPIO_AF1_TIM8 ((uint8_t)0x01) /* TIM8 Alternate Function mapping */
|
|
325 #define GPIO_AF1_LPTIM1 ((uint8_t)0x01) /* LPTIM1 Alternate Function mapping */
|
|
326 #define GPIO_AF1_IR ((uint8_t)0x01) /* IR Alternate Function mapping */
|
|
327
|
|
328 /**
|
|
329 * @brief AF 2 selection
|
|
330 */
|
|
331 #define GPIO_AF2_TIM1 ((uint8_t)0x02) /* TIM1 Alternate Function mapping */
|
|
332 #define GPIO_AF2_TIM2 ((uint8_t)0x02) /* TIM2 Alternate Function mapping */
|
|
333 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
|
|
334 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
|
|
335 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
|
|
336
|
|
337 /**
|
|
338 * @brief AF 3 selection
|
|
339 */
|
|
340 #define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */
|
|
341 #define GPIO_AF3_TIM1_COMP2 ((uint8_t)0x03) /* TIM1/COMP2 Break in Alternate Function mapping */
|
|
342 #define GPIO_AF3_TIM1_COMP1 ((uint8_t)0x03) /* TIM1/COMP1 Break in Alternate Function mapping */
|
|
343
|
|
344 /**
|
|
345 * @brief AF 4 selection
|
|
346 */
|
|
347 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
|
|
348 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
|
|
349 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */
|
|
350
|
|
351 /**
|
|
352 * @brief AF 5 selection
|
|
353 */
|
|
354 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */
|
|
355 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2 Alternate Function mapping */
|
|
356
|
|
357 /**
|
|
358 * @brief AF 6 selection
|
|
359 */
|
|
360 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3 Alternate Function mapping */
|
|
361 #define GPIO_AF6_DFSDM1 ((uint8_t)0x06) /* DFSDM1 Alternate Function mapping */
|
|
362
|
|
363 /**
|
|
364 * @brief AF 7 selection
|
|
365 */
|
|
366 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
|
|
367 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
|
|
368 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */
|
|
369
|
|
370 /**
|
|
371 * @brief AF 8 selection
|
|
372 */
|
|
373 #define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */
|
|
374 #define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */
|
|
375 #define GPIO_AF8_LPUART1 ((uint8_t)0x08) /* LPUART1 Alternate Function mapping */
|
|
376
|
|
377
|
|
378 /**
|
|
379 * @brief AF 9 selection
|
|
380 */
|
|
381 #define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */
|
|
382 #define GPIO_AF9_TSC ((uint8_t)0x09) /* TSC Alternate Function mapping */
|
|
383
|
|
384 /**
|
|
385 * @brief AF 10 selection
|
|
386 */
|
|
387 #if defined(STM32L475xx) || defined(STM32L476xx) || defined(STM32L485xx) || defined(STM32L486xx)
|
|
388 #define GPIO_AF10_OTG_FS ((uint8_t)0x0A) /* OTG_FS Alternate Function mapping */
|
|
389 #endif /* STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx */
|
|
390 #define GPIO_AF10_QUADSPI ((uint8_t)0x0A) /* QUADSPI Alternate Function mapping */
|
|
391
|
|
392 #if defined(STM32L476xx) || defined(STM32L486xx)
|
|
393 /**
|
|
394 * @brief AF 11 selection
|
|
395 */
|
|
396 #define GPIO_AF11_LCD ((uint8_t)0x0B) /* LCD Alternate Function mapping */
|
|
397 #endif /* STM32L476xx || STM32L486xx */
|
|
398
|
|
399 /**
|
|
400 * @brief AF 12 selection
|
|
401 */
|
|
402 #define GPIO_AF12_FMC ((uint8_t)0x0C) /* FMC Alternate Function mapping */
|
|
403 #define GPIO_AF12_SWPMI1 ((uint8_t)0x0C) /* SWPMI1 Alternate Function mapping */
|
|
404 #define GPIO_AF12_COMP1 ((uint8_t)0x0C) /* COMP1 Alternate Function mapping */
|
|
405 #define GPIO_AF12_COMP2 ((uint8_t)0x0C) /* COMP2 Alternate Function mapping */
|
|
406 #define GPIO_AF12_SDMMC1 ((uint8_t)0x0C) /* SDMMC1 Alternate Function mapping */
|
|
407
|
|
408 /**
|
|
409 * @brief AF 13 selection
|
|
410 */
|
|
411 #define GPIO_AF13_SAI1 ((uint8_t)0x0D) /* SAI1 Alternate Function mapping */
|
|
412 #define GPIO_AF13_SAI2 ((uint8_t)0x0D) /* SAI2 Alternate Function mapping */
|
|
413 #define GPIO_AF13_TIM8_COMP2 ((uint8_t)0x0D) /* TIM8/COMP2 Break in Alternate Function mapping */
|
|
414 #define GPIO_AF13_TIM8_COMP1 ((uint8_t)0x0D) /* TIM8/COMP1 Break in Alternate Function mapping */
|
|
415
|
|
416 /**
|
|
417 * @brief AF 14 selection
|
|
418 */
|
|
419 #define GPIO_AF14_TIM2 ((uint8_t)0x0E) /* TIM2 Alternate Function mapping */
|
|
420 #define GPIO_AF14_TIM15 ((uint8_t)0x0E) /* TIM15 Alternate Function mapping */
|
|
421 #define GPIO_AF14_TIM16 ((uint8_t)0x0E) /* TIM16 Alternate Function mapping */
|
|
422 #define GPIO_AF14_TIM17 ((uint8_t)0x0E) /* TIM17 Alternate Function mapping */
|
|
423 #define GPIO_AF14_LPTIM2 ((uint8_t)0x0E) /* LPTIM2 Alternate Function mapping */
|
|
424 #define GPIO_AF14_TIM8_COMP1 ((uint8_t)0x0E) /* TIM8/COMP1 Break in Alternate Function mapping */
|
|
425
|
|
426 /**
|
|
427 * @brief AF 15 selection
|
|
428 */
|
|
429 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
|
|
430
|
|
431 #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x0F)
|
|
432
|
|
433 #endif /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx */
|
|
434
|
|
435 /**
|
|
436 * @}
|
|
437 */
|
|
438
|
|
439 /**
|
|
440 * @}
|
|
441 */
|
|
442
|
|
443 /* Exported macro ------------------------------------------------------------*/
|
|
444 /** @defgroup GPIOEx_Exported_Macros GPIOEx Exported Macros
|
|
445 * @{
|
|
446 */
|
|
447
|
|
448 /** @defgroup GPIOEx_Get_Port_Index GPIOEx_Get Port Index
|
|
449 * @{
|
|
450 */
|
|
451 #if defined(STM32L431xx) || defined(STM32L433xx) || defined(STM32L443xx)
|
|
452
|
|
453 #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
|
|
454 ((__GPIOx__) == (GPIOB))? 1U :\
|
|
455 ((__GPIOx__) == (GPIOC))? 2U :\
|
|
456 ((__GPIOx__) == (GPIOD))? 3U :\
|
|
457 ((__GPIOx__) == (GPIOE))? 4U : 7U)
|
|
458
|
|
459 #endif /* STM32L431xx || STM32L433xx || STM32L443xx */
|
|
460
|
|
461 #if defined(STM32L432xx) || defined(STM32L442xx)
|
|
462
|
|
463 #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
|
|
464 ((__GPIOx__) == (GPIOB))? 1U :\
|
|
465 ((__GPIOx__) == (GPIOC))? 2U : 7U)
|
|
466
|
|
467 #endif /* STM32L432xx || STM32L442xx */
|
|
468
|
|
469 #if defined(STM32L451xx) || defined(STM32L452xx) || defined(STM32L462xx)
|
|
470
|
|
471 #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
|
|
472 ((__GPIOx__) == (GPIOB))? 1U :\
|
|
473 ((__GPIOx__) == (GPIOC))? 2U :\
|
|
474 ((__GPIOx__) == (GPIOD))? 3U :\
|
|
475 ((__GPIOx__) == (GPIOE))? 4U : 7U)
|
|
476
|
|
477 #endif /* STM32L451xx || STM32L452xx || STM32L462xx */
|
|
478
|
|
479 #if defined(STM32L471xx) || defined(STM32L475xx) || defined(STM32L476xx) || defined(STM32L485xx) || defined(STM32L486xx)
|
|
480
|
|
481 #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
|
|
482 ((__GPIOx__) == (GPIOB))? 1U :\
|
|
483 ((__GPIOx__) == (GPIOC))? 2U :\
|
|
484 ((__GPIOx__) == (GPIOD))? 3U :\
|
|
485 ((__GPIOx__) == (GPIOE))? 4U :\
|
|
486 ((__GPIOx__) == (GPIOF))? 5U :\
|
|
487 ((__GPIOx__) == (GPIOG))? 6U : 7U)
|
|
488
|
|
489 #endif /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx */
|
|
490
|
|
491 /**
|
|
492 * @}
|
|
493 */
|
|
494
|
|
495 /**
|
|
496 * @}
|
|
497 */
|
|
498
|
|
499 /* Exported functions --------------------------------------------------------*/
|
|
500 /**
|
|
501 * @}
|
|
502 */
|
|
503
|
|
504 /**
|
|
505 * @}
|
|
506 */
|
|
507
|
|
508 #ifdef __cplusplus
|
|
509 }
|
|
510 #endif
|
|
511
|
|
512 #endif /* __STM32L4xx_HAL_GPIO_EX_H */
|
|
513
|
|
514 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|