]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_gpio_ex.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_STM / TARGET_STM32F3 / stm32f3xx_hal_gpio_ex.h
1 /**
2   ******************************************************************************
3   * @file    stm32f3xx_hal_gpio_ex.h
4   * @author  MCD Application Team
5   * @version V1.1.0
6   * @date    12-Sept-2014
7   * @brief   Header file of GPIO HAL Extended module.
8   ******************************************************************************
9   * @attention
10   *
11   * <h2><center>&copy; COPYRIGHT(c) 2014 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 __STM32F3xx_HAL_GPIO_EX_H
40 #define __STM32F3xx_HAL_GPIO_EX_H
41
42 #ifdef __cplusplus
43  extern "C" {
44 #endif
45
46 /* Includes ------------------------------------------------------------------*/
47 #include "stm32f3xx_hal_def.h"
48
49 /** @addtogroup STM32F3xx_HAL_Driver
50   * @{
51   */
52
53 /** @addtogroup GPIOEx GPIO Extended HAL module driver
54   * @{
55   */ 
56
57 /* Exported types ------------------------------------------------------------*/
58
59 /* Exported constants --------------------------------------------------------*/
60 /** @defgroup GPIOEx_Exported_Constants GPIO Extended Exported Constants
61   * @{
62   */ 
63   
64 /** @defgroup GPIOEx_Alternate_function_selection GPIO Extended Alternate function selection
65   * @{
66   */
67   
68 #if defined (STM32F302xC)
69 /*---------------------------------- STM32F302xC ------------------------------*/
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_TAMPER        ((uint8_t)0x00)  /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
76 #define GPIO_AF0_SWJ           ((uint8_t)0x00)  /* SWJ (SWD and JTAG) Alternate Function mapping             */
77 #define GPIO_AF0_TRACE         ((uint8_t)0x00)  /* TRACE Alternate Function mapping                          */
78
79 /** 
80   * @brief   AF 1 selection  
81   */ 
82 #define GPIO_AF1_TIM2           ((uint8_t)0x01)  /* TIM2 Alternate Function mapping */
83 #define GPIO_AF1_TIM15          ((uint8_t)0x01)  /* TIM15 Alternate Function mapping */
84 #define GPIO_AF1_TIM16          ((uint8_t)0x01)  /* TIM16 Alternate Function mapping */
85 #define GPIO_AF1_TIM17          ((uint8_t)0x01)  /* TIM17 Alternate Function mapping */
86 #define GPIO_AF1_EVENTOUT       ((uint8_t)0x01)  /* EVENTOUT Alternate Function mapping */
87 /** 
88   * @brief   AF 2 selection  
89   */ 
90 #define GPIO_AF2_TIM1           ((uint8_t)0x02)  /* TIM1 Alternate Function mapping */
91 #define GPIO_AF2_TIM2           ((uint8_t)0x02)  /* TIM2 Alternate Function mapping */
92 #define GPIO_AF2_TIM3           ((uint8_t)0x02)  /* TIM3 Alternate Function mapping */
93 #define GPIO_AF2_TIM4           ((uint8_t)0x02)  /* TIM4 Alternate Function mapping */
94 #define GPIO_AF2_TIM15          ((uint8_t)0x02)  /* TIM15 Alternate Function mapping */
95 #define GPIO_AF2_COMP1          ((uint8_t)0x02)  /* COMP1 Alternate Function mapping */
96 /** 
97   * @brief   AF 3 selection  
98   */ 
99 #define GPIO_AF3_TSC           ((uint8_t)0x03)  /* TSC Alternate Function mapping  */
100 #define GPIO_AF3_TIM15         ((uint8_t)0x03)  /* TIM15 Alternate Function mapping */
101
102 /** 
103   * @brief   AF 4 selection  
104   */ 
105 #define GPIO_AF4_TIM1          ((uint8_t)0x04)  /* TIM1 Alternate Function mapping */
106 #define GPIO_AF4_TIM16         ((uint8_t)0x04)  /* TIM16 Alternate Function mapping */
107 #define GPIO_AF4_TIM17         ((uint8_t)0x04)  /* TIM17 Alternate Function mapping */
108 #define GPIO_AF4_I2C1          ((uint8_t)0x04)  /* I2C1 Alternate Function mapping */
109 #define GPIO_AF4_I2C2          ((uint8_t)0x04)  /* I2C2 Alternate Function mapping */
110
111 /** 
112   * @brief   AF 5 selection  
113   */ 
114 #define GPIO_AF5_SPI1          ((uint8_t)0x05)  /* SPI1/I2S1 Alternate Function mapping */
115 #define GPIO_AF5_SPI2          ((uint8_t)0x05)  /* SPI2/I2S2 Alternate Function mapping */
116 #define GPIO_AF5_SPI3          ((uint8_t)0x05)  /* SPI3/I2S3 Alternate Function mapping */
117 #define GPIO_AF5_I2S           ((uint8_t)0x05)  /* I2S Alternate Function mapping */
118 #define GPIO_AF5_I2S2ext       ((uint8_t)0x05)  /* I2S2ext Alternate Function mapping */
119 #define GPIO_AF5_IR            ((uint8_t)0x05)  /* IR Alternate Function mapping */
120 #define GPIO_AF5_UART4         ((uint8_t)0x05)  /* UART4 Alternate Function mapping */
121 #define GPIO_AF5_UART5         ((uint8_t)0x05)  /* UART5 Alternate Function mapping */
122 /** 
123   * @brief   AF 6 selection  
124   */ 
125 #define GPIO_AF6_SPI2          ((uint8_t)0x06)  /* SPI2/I2S2 Alternate Function mapping */
126 #define GPIO_AF6_SPI3          ((uint8_t)0x06)  /* SPI3/I2S3 Alternate Function mapping */
127 #define GPIO_AF6_I2S3ext       ((uint8_t)0x06)  /* I2S3ext Alternate Function mapping */
128 #define GPIO_AF6_TIM1          ((uint8_t)0x06)  /* TIM1 Alternate Function mapping */
129 #define GPIO_AF6_IR            ((uint8_t)0x06)  /* IR Alternate Function mapping */
130
131 /** 
132   * @brief   AF 7 selection  
133   */ 
134 #define GPIO_AF7_USART1        ((uint8_t)0x07)  /* USART1 Alternate Function mapping  */
135 #define GPIO_AF7_USART2        ((uint8_t)0x07)  /* USART2 Alternate Function mapping  */
136 #define GPIO_AF7_USART3        ((uint8_t)0x07)  /* USART3 Alternate Function mapping  */
137 #define GPIO_AF7_COMP6         ((uint8_t)0x07)  /* COMP6 Alternate Function mapping  */
138 #define GPIO_AF7_CAN           ((uint8_t)0x07)  /* CAN Alternate Function mapping  */
139
140 /** 
141   * @brief   AF 8 selection  
142   */ 
143 #define GPIO_AF8_COMP1         ((uint8_t)0x08)  /* COMP1 Alternate Function mapping  */
144 #define GPIO_AF8_COMP2         ((uint8_t)0x08)  /* COMP2 Alternate Function mapping  */
145 #define GPIO_AF8_COMP4         ((uint8_t)0x08)  /* COMP4 Alternate Function mapping  */
146 #define GPIO_AF8_COMP6         ((uint8_t)0x08)  /* COMP6 Alternate Function mapping  */
147
148 /** 
149   * @brief   AF 9 selection 
150   */ 
151 #define GPIO_AF9_CAN           ((uint8_t)0x09)  /* CAN Alternate Function mapping  */
152 #define GPIO_AF9_TIM1          ((uint8_t)0x09)  /* TIM1 Alternate Function mapping */
153 #define GPIO_AF9_TIM15         ((uint8_t)0x09)  /* TIM15 Alternate Function mapping */
154
155 /** 
156   * @brief   AF 10 selection  
157   */ 
158 #define GPIO_AF10_TIM2           ((uint8_t)0xA)  /* TIM2 Alternate Function mapping */
159 #define GPIO_AF10_TIM3           ((uint8_t)0xA)  /* TIM3 Alternate Function mapping */
160 #define GPIO_AF10_TIM4           ((uint8_t)0xA)  /* TIM4 Alternate Function mapping */
161 #define GPIO_AF10_TIM17          ((uint8_t)0xA)  /* TIM17 Alternate Function mapping */
162 /** 
163   * @brief   AF 11 selection  
164   */ 
165 #define GPIO_AF11_TIM1           ((uint8_t)0x0B)  /* TIM1 Alternate Function mapping */
166
167 /** 
168   * @brief   AF 12 selection  
169   */ 
170 #define GPIO_AF12_TIM1            ((uint8_t)0xC)  /* TIM1 Alternate Function mapping */
171
172 /** 
173   * @brief   AF 14 selection  
174   */
175
176 #define GPIO_AF14_USB           ((uint8_t)0x0E)  /* USB Alternate Function mapping */
177 /** 
178   * @brief   AF 15 selection  
179   */ 
180 #define GPIO_AF15_EVENTOUT      ((uint8_t)0x0F)  /* EVENTOUT Alternate Function mapping */
181
182 #define IS_GPIO_AF(AF)          (((AF) <= (uint8_t)0x0C) || ((AF) == (uint8_t)0x0E) || ((AF) == (uint8_t)0x0F))
183 /*------------------------------------------------------------------------------------------*/
184 #endif /* STM32F302xC */
185    
186 #if defined (STM32F303xC)
187 /*---------------------------------- STM32F303xC ------------------------------*/
188 /** 
189   * @brief   AF 0 selection  
190   */ 
191 #define GPIO_AF0_RTC_50Hz      ((uint8_t)0x00)  /* RTC_50Hz Alternate Function mapping                       */
192 #define GPIO_AF0_MCO           ((uint8_t)0x00)  /* MCO (MCO1 and MCO2) Alternate Function mapping            */
193 #define GPIO_AF0_TAMPER        ((uint8_t)0x00)  /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
194 #define GPIO_AF0_SWJ           ((uint8_t)0x00)  /* SWJ (SWD and JTAG) Alternate Function mapping             */
195 #define GPIO_AF0_TRACE         ((uint8_t)0x00)  /* TRACE Alternate Function mapping                          */
196
197 /** 
198   * @brief   AF 1 selection  
199   */ 
200 #define GPIO_AF1_TIM2           ((uint8_t)0x01)  /* TIM2 Alternate Function mapping */
201 #define GPIO_AF1_TIM15          ((uint8_t)0x01)  /* TIM15 Alternate Function mapping */
202 #define GPIO_AF1_TIM16          ((uint8_t)0x01)  /* TIM16 Alternate Function mapping */
203 #define GPIO_AF1_TIM17          ((uint8_t)0x01)  /* TIM17 Alternate Function mapping */
204 #define GPIO_AF1_EVENTOUT       ((uint8_t)0x01)  /* EVENTOUT Alternate Function mapping */
205 /** 
206   * @brief   AF 2 selection  
207   */ 
208 #define GPIO_AF2_TIM1           ((uint8_t)0x02)  /* TIM1 Alternate Function mapping */
209 #define GPIO_AF2_TIM2           ((uint8_t)0x02)  /* TIM2 Alternate Function mapping */
210 #define GPIO_AF2_TIM3           ((uint8_t)0x02)  /* TIM3 Alternate Function mapping */
211 #define GPIO_AF2_TIM4           ((uint8_t)0x02)  /* TIM4 Alternate Function mapping */
212 #define GPIO_AF2_TIM8           ((uint8_t)0x02)  /* TIM8 Alternate Function mapping */
213 #define GPIO_AF2_TIM15          ((uint8_t)0x02)  /* TIM15 Alternate Function mapping */
214 #define GPIO_AF2_COMP1          ((uint8_t)0x02)  /* COMP1 Alternate Function mapping */
215 /** 
216   * @brief   AF 3 selection  
217   */ 
218 #define GPIO_AF3_TSC           ((uint8_t)0x03)  /* TSC Alternate Function mapping  */
219 #define GPIO_AF3_TIM8          ((uint8_t)0x03)  /* TIM8 Alternate Function mapping  */
220 #define GPIO_AF3_COMP7         ((uint8_t)0x03)  /* COMP7 Alternate Function mapping */
221 #define GPIO_AF3_TIM15         ((uint8_t)0x03)  /* TIM15 Alternate Function mapping */
222
223 /** 
224   * @brief   AF 4 selection  
225   */ 
226 #define GPIO_AF4_TIM1          ((uint8_t)0x04)  /* TIM1 Alternate Function mapping */
227 #define GPIO_AF4_TIM8          ((uint8_t)0x04)  /* TIM8 Alternate Function mapping */
228 #define GPIO_AF4_TIM16         ((uint8_t)0x04)  /* TIM16 Alternate Function mapping */
229 #define GPIO_AF4_TIM17         ((uint8_t)0x04)  /* TIM17 Alternate Function mapping */
230 #define GPIO_AF4_I2C1          ((uint8_t)0x04)  /* I2C1 Alternate Function mapping */
231 #define GPIO_AF4_I2C2          ((uint8_t)0x04)  /* I2C2 Alternate Function mapping */
232
233 /** 
234   * @brief   AF 5 selection  
235   */ 
236 #define GPIO_AF5_SPI1          ((uint8_t)0x05)  /* SPI1/I2S1 Alternate Function mapping */
237 #define GPIO_AF5_SPI2          ((uint8_t)0x05)  /* SPI2/I2S2 Alternate Function mapping */
238 #define GPIO_AF5_SPI3          ((uint8_t)0x05)  /* SPI3/I2S3 Alternate Function mapping */
239 #define GPIO_AF5_I2S           ((uint8_t)0x05)  /* I2S Alternate Function mapping */
240 #define GPIO_AF5_I2S2ext       ((uint8_t)0x05)  /* I2S2ext Alternate Function mapping */
241 #define GPIO_AF5_TIM8          ((uint8_t)0x05)  /* TIM8 Alternate Function mapping */
242 #define GPIO_AF5_IR            ((uint8_t)0x05)  /* IR Alternate Function mapping */
243 #define GPIO_AF5_UART4         ((uint8_t)0x05)  /* UART4 Alternate Function mapping */
244 #define GPIO_AF5_UART5         ((uint8_t)0x05)  /* UART5 Alternate Function mapping */
245 /** 
246   * @brief   AF 6 selection  
247   */ 
248 #define GPIO_AF6_SPI2          ((uint8_t)0x06)  /* SPI2/I2S2 Alternate Function mapping */
249 #define GPIO_AF6_SPI3          ((uint8_t)0x06)  /* SPI3/I2S3 Alternate Function mapping */
250 #define GPIO_AF6_I2S3ext       ((uint8_t)0x06)  /* I2S3ext Alternate Function mapping */
251 #define GPIO_AF6_TIM1          ((uint8_t)0x06)  /* TIM1 Alternate Function mapping */
252 #define GPIO_AF6_TIM8          ((uint8_t)0x06)  /* TIM8 Alternate Function mapping */
253 #define GPIO_AF6_IR            ((uint8_t)0x06)  /* IR Alternate Function mapping */
254
255 /** 
256   * @brief   AF 7 selection  
257   */ 
258 #define GPIO_AF7_USART1        ((uint8_t)0x07)  /* USART1 Alternate Function mapping  */
259 #define GPIO_AF7_USART2        ((uint8_t)0x07)  /* USART2 Alternate Function mapping  */
260 #define GPIO_AF7_USART3        ((uint8_t)0x07)  /* USART3 Alternate Function mapping  */
261 #define GPIO_AF7_COMP3         ((uint8_t)0x07)  /* COMP3 Alternate Function mapping  */
262 #define GPIO_AF7_COMP5         ((uint8_t)0x07)  /* COMP5 Alternate Function mapping  */
263 #define GPIO_AF7_COMP6         ((uint8_t)0x07)  /* COMP6 Alternate Function mapping  */
264 #define GPIO_AF7_CAN           ((uint8_t)0x07)  /* CAN Alternate Function mapping  */
265
266 /** 
267   * @brief   AF 8 selection  
268   */ 
269 #define GPIO_AF8_COMP1         ((uint8_t)0x08)  /* COMP1 Alternate Function mapping  */
270 #define GPIO_AF8_COMP2         ((uint8_t)0x08)  /* COMP2 Alternate Function mapping  */
271 #define GPIO_AF8_COMP3         ((uint8_t)0x08)  /* COMP3 Alternate Function mapping  */
272 #define GPIO_AF8_COMP4         ((uint8_t)0x08)  /* COMP4 Alternate Function mapping  */
273 #define GPIO_AF8_COMP5         ((uint8_t)0x08)  /* COMP5 Alternate Function mapping  */
274 #define GPIO_AF8_COMP6         ((uint8_t)0x08)  /* COMP6 Alternate Function mapping  */
275
276 /** 
277   * @brief   AF 9 selection 
278   */ 
279 #define GPIO_AF9_CAN           ((uint8_t)0x09)  /* CAN Alternate Function mapping  */
280 #define GPIO_AF9_TIM1          ((uint8_t)0x09)  /* TIM1 Alternate Function mapping */
281 #define GPIO_AF9_TIM8          ((uint8_t)0x09)  /* TIM8 Alternate Function mapping */
282 #define GPIO_AF9_TIM15         ((uint8_t)0x09)  /* TIM15 Alternate Function mapping */
283
284 /** 
285   * @brief   AF 10 selection  
286   */ 
287 #define GPIO_AF10_TIM2           ((uint8_t)0xA)  /* TIM2 Alternate Function mapping */
288 #define GPIO_AF10_TIM3           ((uint8_t)0xA)  /* TIM3 Alternate Function mapping */
289 #define GPIO_AF10_TIM4           ((uint8_t)0xA)  /* TIM4 Alternate Function mapping */
290 #define GPIO_AF10_TIM8           ((uint8_t)0xA)  /* TIM8 Alternate Function mapping */
291 #define GPIO_AF10_TIM17          ((uint8_t)0xA)  /* TIM17 Alternate Function mapping */
292 /** 
293   * @brief   AF 11 selection  
294   */ 
295 #define GPIO_AF11_TIM1           ((uint8_t)0x0B)  /* TIM1 Alternate Function mapping */
296 #define GPIO_AF11_TIM8           ((uint8_t)0x0B)  /* TIM8 Alternate Function mapping */
297
298 /** 
299   * @brief   AF 12 selection  
300   */ 
301 #define GPIO_AF12_TIM1            ((uint8_t)0xC)  /* TIM1 Alternate Function mapping */
302
303 /** 
304   * @brief   AF 14 selection  
305   */
306
307 #define GPIO_AF14_USB           ((uint8_t)0x0E)  /* USB Alternate Function mapping */
308 /** 
309   * @brief   AF 15 selection  
310   */ 
311 #define GPIO_AF15_EVENTOUT      ((uint8_t)0x0F)  /* EVENTOUT Alternate Function mapping */
312
313 #define IS_GPIO_AF(AF)          (((AF) <= (uint8_t)0x0C) || ((AF) == (uint8_t)0x0E) || ((AF) == (uint8_t)0x0F))
314 /*------------------------------------------------------------------------------------------*/
315 #endif /* STM32F303xC */
316
317 #if defined (STM32F303xE)
318 /*---------------------------------- STM32F303xE ------------------------------*/
319 /** 
320   * @brief   AF 0 selection  
321   */ 
322 #define GPIO_AF0_RTC_50Hz      ((uint8_t)0x00)  /* RTC_50Hz Alternate Function mapping                       */
323 #define GPIO_AF0_MCO           ((uint8_t)0x00)  /* MCO (MCO1 and MCO2) Alternate Function mapping            */
324 #define GPIO_AF0_TAMPER        ((uint8_t)0x00)  /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
325 #define GPIO_AF0_SWJ           ((uint8_t)0x00)  /* SWJ (SWD and JTAG) Alternate Function mapping             */
326 #define GPIO_AF0_TRACE         ((uint8_t)0x00)  /* TRACE Alternate Function mapping                          */
327
328 /** 
329   * @brief   AF 1 selection  
330   */ 
331 #define GPIO_AF1_TIM2           ((uint8_t)0x01)  /* TIM2 Alternate Function mapping */
332 #define GPIO_AF1_TIM15          ((uint8_t)0x01)  /* TIM15 Alternate Function mapping */
333 #define GPIO_AF1_TIM16          ((uint8_t)0x01)  /* TIM16 Alternate Function mapping */
334 #define GPIO_AF1_TIM17          ((uint8_t)0x01)  /* TIM17 Alternate Function mapping */
335 #define GPIO_AF1_EVENTOUT       ((uint8_t)0x01)  /* EVENTOUT Alternate Function mapping */
336
337 /** 
338   * @brief   AF 2 selection  
339   */ 
340 #define GPIO_AF2_TIM1           ((uint8_t)0x02)  /* TIM1 Alternate Function mapping */
341 #define GPIO_AF2_TIM2           ((uint8_t)0x02)  /* TIM2 Alternate Function mapping */
342 #define GPIO_AF2_TIM3           ((uint8_t)0x02)  /* TIM3 Alternate Function mapping */
343 #define GPIO_AF2_TIM4           ((uint8_t)0x02)  /* TIM4 Alternate Function mapping */
344 #define GPIO_AF2_TIM8           ((uint8_t)0x02)  /* TIM8 Alternate Function mapping */
345 #define GPIO_AF2_TIM15          ((uint8_t)0x02)  /* TIM15 Alternate Function mapping */
346 #define GPIO_AF2_COMP1          ((uint8_t)0x02)  /* COMP1 Alternate Function mapping */
347 #define GPIO_AF2_I2C3           ((uint8_t)0x02)  /* I2C3 Alternate Function mapping */
348 #define GPIO_AF2_TIM20          ((uint8_t)0x02)  /* TIM20 Alternate Function mapping */
349
350 /** 
351   * @brief   AF 3 selection  
352   */ 
353 #define GPIO_AF3_TSC           ((uint8_t)0x03)  /* TSC Alternate Function mapping  */
354 #define GPIO_AF3_TIM8          ((uint8_t)0x03)  /* TIM8 Alternate Function mapping  */
355 #define GPIO_AF3_COMP7         ((uint8_t)0x03)  /* COMP7 Alternate Function mapping */
356 #define GPIO_AF3_TIM15         ((uint8_t)0x03)  /* TIM15 Alternate Function mapping */
357 #define GPIO_AF3_I2C3          ((uint8_t)0x03)  /* I2C3 Alternate Function mapping */
358 #define GPIO_AF3_TIM20         ((uint8_t)0x03)  /* TIM20 Alternate Function mapping */
359
360 /** 
361   * @brief   AF 4 selection  
362   */ 
363 #define GPIO_AF4_TIM1          ((uint8_t)0x04)  /* TIM1 Alternate Function mapping */
364 #define GPIO_AF4_TIM8          ((uint8_t)0x04)  /* TIM8 Alternate Function mapping */
365 #define GPIO_AF4_TIM16         ((uint8_t)0x04)  /* TIM16 Alternate Function mapping */
366 #define GPIO_AF4_TIM17         ((uint8_t)0x04)  /* TIM17 Alternate Function mapping */
367 #define GPIO_AF4_I2C1          ((uint8_t)0x04)  /* I2C1 Alternate Function mapping */
368 #define GPIO_AF4_I2C2          ((uint8_t)0x04)  /* I2C2 Alternate Function mapping */
369
370 /** 
371   * @brief   AF 5 selection  
372   */ 
373 #define GPIO_AF5_SPI1          ((uint8_t)0x05)  /* SPI1 Alternate Function mapping */
374 #define GPIO_AF5_SPI2          ((uint8_t)0x05)  /* SPI2/I2S2 Alternate Function mapping */
375 #define GPIO_AF5_SPI3          ((uint8_t)0x05)  /* SPI3/I2S3 Alternate Function mapping */
376 #define GPIO_AF5_I2S           ((uint8_t)0x05)  /* I2S Alternate Function mapping */
377 #define GPIO_AF5_I2S2ext       ((uint8_t)0x05)  /* I2S2ext Alternate Function mapping */
378 #define GPIO_AF5_TIM8          ((uint8_t)0x05)  /* TIM8 Alternate Function mapping */
379 #define GPIO_AF5_IR            ((uint8_t)0x05)  /* IR Alternate Function mapping */
380 #define GPIO_AF5_UART4         ((uint8_t)0x05)  /* UART4 Alternate Function mapping */
381 #define GPIO_AF5_UART5         ((uint8_t)0x05)  /* UART5 Alternate Function mapping */
382 #define GPIO_AF5_SPI4          ((uint8_t)0x05)  /* SPI4 Alternate Function mapping */
383
384 /** 
385   * @brief   AF 6 selection  
386   */ 
387 #define GPIO_AF6_SPI2          ((uint8_t)0x06)  /* SPI2/I2S2 Alternate Function mapping */
388 #define GPIO_AF6_SPI3          ((uint8_t)0x06)  /* SPI3/I2S3 Alternate Function mapping */
389 #define GPIO_AF6_I2S3ext       ((uint8_t)0x06)  /* I2S3ext Alternate Function mapping */
390 #define GPIO_AF6_TIM1          ((uint8_t)0x06)  /* TIM1 Alternate Function mapping */
391 #define GPIO_AF6_TIM8          ((uint8_t)0x06)  /* TIM8 Alternate Function mapping */
392 #define GPIO_AF6_IR            ((uint8_t)0x06)  /* IR Alternate Function mapping */
393 #define GPIO_AF6_TIM20         ((uint8_t)0x06)  /* TIM20 Alternate Function mapping */
394
395 /** 
396   * @brief   AF 7 selection  
397   */ 
398 #define GPIO_AF7_USART1        ((uint8_t)0x07)  /* USART1 Alternate Function mapping  */
399 #define GPIO_AF7_USART2        ((uint8_t)0x07)  /* USART2 Alternate Function mapping  */
400 #define GPIO_AF7_USART3        ((uint8_t)0x07)  /* USART3 Alternate Function mapping  */
401 #define GPIO_AF7_COMP3         ((uint8_t)0x07)  /* COMP3 Alternate Function mapping  */
402 #define GPIO_AF7_COMP5         ((uint8_t)0x07)  /* COMP5 Alternate Function mapping  */
403 #define GPIO_AF7_COMP6         ((uint8_t)0x07)  /* COMP6 Alternate Function mapping  */
404 #define GPIO_AF7_CAN           ((uint8_t)0x07)  /* CAN Alternate Function mapping  */
405
406 /** 
407   * @brief   AF 8 selection  
408   */ 
409 #define GPIO_AF8_COMP1         ((uint8_t)0x08)  /* COMP1 Alternate Function mapping  */
410 #define GPIO_AF8_COMP2         ((uint8_t)0x08)  /* COMP2 Alternate Function mapping  */
411 #define GPIO_AF8_COMP3         ((uint8_t)0x08)  /* COMP3 Alternate Function mapping  */
412 #define GPIO_AF8_COMP4         ((uint8_t)0x08)  /* COMP4 Alternate Function mapping  */
413 #define GPIO_AF8_COMP5         ((uint8_t)0x08)  /* COMP5 Alternate Function mapping  */
414 #define GPIO_AF8_COMP6         ((uint8_t)0x08)  /* COMP6 Alternate Function mapping  */
415 #define GPIO_AF8_I2C3          ((uint8_t)0x08)  /* I2C3 Alternate Function mapping */
416
417 /** 
418   * @brief   AF 9 selection 
419   */ 
420 #define GPIO_AF9_CAN           ((uint8_t)0x09)  /* CAN Alternate Function mapping  */
421 #define GPIO_AF9_TIM1          ((uint8_t)0x09)  /* TIM1 Alternate Function mapping */
422 #define GPIO_AF9_TIM8          ((uint8_t)0x09)  /* TIM8 Alternate Function mapping */
423 #define GPIO_AF9_TIM15         ((uint8_t)0x09)  /* TIM15 Alternate Function mapping */
424
425 /** 
426   * @brief   AF 10 selection  
427   */ 
428 #define GPIO_AF10_TIM2           ((uint8_t)0xA)  /* TIM2 Alternate Function mapping */
429 #define GPIO_AF10_TIM3           ((uint8_t)0xA)  /* TIM3 Alternate Function mapping */
430 #define GPIO_AF10_TIM4           ((uint8_t)0xA)  /* TIM4 Alternate Function mapping */
431 #define GPIO_AF10_TIM8           ((uint8_t)0xA)  /* TIM8 Alternate Function mapping */
432 #define GPIO_AF10_TIM17          ((uint8_t)0xA)  /* TIM17 Alternate Function mapping */
433 /** 
434   * @brief   AF 11 selection  
435   */ 
436 #define GPIO_AF11_TIM1           ((uint8_t)0x0B)  /* TIM1 Alternate Function mapping */
437 #define GPIO_AF11_TIM8           ((uint8_t)0x0B)  /* TIM8 Alternate Function mapping */
438
439 /** 
440   * @brief   AF 12 selection  
441   */ 
442 #define GPIO_AF12_TIM1            ((uint8_t)0xC)  /* TIM1 Alternate Function mapping */
443 #define GPIO_AF12_FMC             ((uint8_t)0xC)  /* FMC Alternate Function mapping                      */
444 #define GPIO_AF12_SDIO            ((uint8_t)0xC)  /* SDIO Alternate Function mapping                     */
445
446 /** 
447   * @brief   AF 14 selection  
448   */
449 #define GPIO_AF14_USB           ((uint8_t)0x0E)  /* USB Alternate Function mapping */
450
451 /** 
452   * @brief   AF 15 selection  
453   */ 
454 #define GPIO_AF15_EVENTOUT      ((uint8_t)0x0F)  /* EVENTOUT Alternate Function mapping */
455
456 #define IS_GPIO_AF(AF)          (((AF) <= (uint8_t)0x0C) || ((AF) == (uint8_t)0x0E) || ((AF) == (uint8_t)0x0F))
457 /*------------------------------------------------------------------------------------------*/
458 #endif /* STM32F303xE */
459
460 #if defined (STM32F302xE)
461 /*---------------------------------- STM32F302xE ------------------------------*/
462 /** 
463   * @brief   AF 0 selection  
464   */ 
465 #define GPIO_AF0_RTC_50Hz      ((uint8_t)0x00)  /* RTC_50Hz Alternate Function mapping                       */
466 #define GPIO_AF0_MCO           ((uint8_t)0x00)  /* MCO (MCO1 and MCO2) Alternate Function mapping            */
467 #define GPIO_AF0_TAMPER        ((uint8_t)0x00)  /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
468 #define GPIO_AF0_SWJ           ((uint8_t)0x00)  /* SWJ (SWD and JTAG) Alternate Function mapping             */
469 #define GPIO_AF0_TRACE         ((uint8_t)0x00)  /* TRACE Alternate Function mapping                          */
470
471 /** 
472   * @brief   AF 1 selection  
473   */ 
474 #define GPIO_AF1_TIM2           ((uint8_t)0x01)  /* TIM2 Alternate Function mapping */
475 #define GPIO_AF1_TIM15          ((uint8_t)0x01)  /* TIM15 Alternate Function mapping */
476 #define GPIO_AF1_TIM16          ((uint8_t)0x01)  /* TIM16 Alternate Function mapping */
477 #define GPIO_AF1_TIM17          ((uint8_t)0x01)  /* TIM17 Alternate Function mapping */
478 #define GPIO_AF1_EVENTOUT       ((uint8_t)0x01)  /* EVENTOUT Alternate Function mapping */
479
480 /** 
481   * @brief   AF 2 selection  
482   */ 
483 #define GPIO_AF2_TIM1           ((uint8_t)0x02)  /* TIM1 Alternate Function mapping */
484 #define GPIO_AF2_TIM2           ((uint8_t)0x02)  /* TIM2 Alternate Function mapping */
485 #define GPIO_AF2_TIM3           ((uint8_t)0x02)  /* TIM3 Alternate Function mapping */
486 #define GPIO_AF2_TIM4           ((uint8_t)0x02)  /* TIM4 Alternate Function mapping */
487 #define GPIO_AF2_TIM15          ((uint8_t)0x02)  /* TIM15 Alternate Function mapping */
488 #define GPIO_AF2_COMP1          ((uint8_t)0x02)  /* COMP1 Alternate Function mapping */
489 #define GPIO_AF2_I2C3           ((uint8_t)0x02)  /* I2C3 Alternate Function mapping */
490
491 /** 
492   * @brief   AF 3 selection  
493   */ 
494 #define GPIO_AF3_TSC           ((uint8_t)0x03)  /* TSC Alternate Function mapping  */
495 #define GPIO_AF3_TIM15         ((uint8_t)0x03)  /* TIM15 Alternate Function mapping */
496 #define GPIO_AF3_I2C3          ((uint8_t)0x03)  /* I2C3 Alternate Function mapping */
497
498 /** 
499   * @brief   AF 4 selection  
500   */ 
501 #define GPIO_AF4_TIM1          ((uint8_t)0x04)  /* TIM1 Alternate Function mapping */
502 #define GPIO_AF4_TIM16         ((uint8_t)0x04)  /* TIM16 Alternate Function mapping */
503 #define GPIO_AF4_TIM17         ((uint8_t)0x04)  /* TIM17 Alternate Function mapping */
504 #define GPIO_AF4_I2C1          ((uint8_t)0x04)  /* I2C1 Alternate Function mapping */
505 #define GPIO_AF4_I2C2          ((uint8_t)0x04)  /* I2C2 Alternate Function mapping */
506
507 /** 
508   * @brief   AF 5 selection  
509   */ 
510 #define GPIO_AF5_SPI1          ((uint8_t)0x05)  /* SPI1 Alternate Function mapping */
511 #define GPIO_AF5_SPI2          ((uint8_t)0x05)  /* SPI2/I2S2 Alternate Function mapping */
512 #define GPIO_AF5_SPI3          ((uint8_t)0x05)  /* SPI3/I2S3 Alternate Function mapping */
513 #define GPIO_AF5_I2S           ((uint8_t)0x05)  /* I2S Alternate Function mapping */
514 #define GPIO_AF5_I2S2ext       ((uint8_t)0x05)  /* I2S2ext Alternate Function mapping */
515 #define GPIO_AF5_IR            ((uint8_t)0x05)  /* IR Alternate Function mapping */
516 #define GPIO_AF5_UART4         ((uint8_t)0x05)  /* UART4 Alternate Function mapping */
517 #define GPIO_AF5_UART5         ((uint8_t)0x05)  /* UART5 Alternate Function mapping */
518 #define GPIO_AF5_SPI4          ((uint8_t)0x05)  /* SPI4 Alternate Function mapping */
519
520 /** 
521   * @brief   AF 6 selection  
522   */ 
523 #define GPIO_AF6_SPI2          ((uint8_t)0x06)  /* SPI2/I2S2 Alternate Function mapping */
524 #define GPIO_AF6_SPI3          ((uint8_t)0x06)  /* SPI3/I2S3 Alternate Function mapping */
525 #define GPIO_AF6_I2S3ext       ((uint8_t)0x06)  /* I2S3ext Alternate Function mapping */
526 #define GPIO_AF6_TIM1          ((uint8_t)0x06)  /* TIM1 Alternate Function mapping */
527 #define GPIO_AF6_IR            ((uint8_t)0x06)  /* IR Alternate Function mapping */
528
529 /** 
530   * @brief   AF 7 selection  
531   */ 
532 #define GPIO_AF7_USART1        ((uint8_t)0x07)  /* USART1 Alternate Function mapping  */
533 #define GPIO_AF7_USART2        ((uint8_t)0x07)  /* USART2 Alternate Function mapping  */
534 #define GPIO_AF7_USART3        ((uint8_t)0x07)  /* USART3 Alternate Function mapping  */
535 #define GPIO_AF7_COMP6         ((uint8_t)0x07)  /* COMP6 Alternate Function mapping  */
536 #define GPIO_AF7_CAN           ((uint8_t)0x07)  /* CAN Alternate Function mapping  */
537
538 /** 
539   * @brief   AF 8 selection  
540   */ 
541 #define GPIO_AF8_COMP1         ((uint8_t)0x08)  /* COMP1 Alternate Function mapping  */
542 #define GPIO_AF8_COMP2         ((uint8_t)0x08)  /* COMP2 Alternate Function mapping  */
543 #define GPIO_AF8_COMP4         ((uint8_t)0x08)  /* COMP4 Alternate Function mapping  */
544 #define GPIO_AF8_COMP6         ((uint8_t)0x08)  /* COMP6 Alternate Function mapping  */
545 #define GPIO_AF8_I2C3          ((uint8_t)0x08)  /* I2C3 Alternate Function mapping */
546
547 /** 
548   * @brief   AF 9 selection 
549   */ 
550 #define GPIO_AF9_CAN           ((uint8_t)0x09)  /* CAN Alternate Function mapping  */
551 #define GPIO_AF9_TIM1          ((uint8_t)0x09)  /* TIM1 Alternate Function mapping */
552 #define GPIO_AF9_TIM15         ((uint8_t)0x09)  /* TIM15 Alternate Function mapping */
553
554 /** 
555   * @brief   AF 10 selection  
556   */ 
557 #define GPIO_AF10_TIM2           ((uint8_t)0xA)  /* TIM2 Alternate Function mapping */
558 #define GPIO_AF10_TIM3           ((uint8_t)0xA)  /* TIM3 Alternate Function mapping */
559 #define GPIO_AF10_TIM4           ((uint8_t)0xA)  /* TIM4 Alternate Function mapping */
560 #define GPIO_AF10_TIM17          ((uint8_t)0xA)  /* TIM17 Alternate Function mapping */
561 /** 
562   * @brief   AF 11 selection  
563   */ 
564 #define GPIO_AF11_TIM1           ((uint8_t)0x0B)  /* TIM1 Alternate Function mapping */
565
566 /** 
567   * @brief   AF 12 selection  
568   */ 
569 #define GPIO_AF12_TIM1            ((uint8_t)0xC)  /* TIM1 Alternate Function mapping */
570 #define GPIO_AF12_FMC             ((uint8_t)0xC)  /* FMC Alternate Function mapping                      */
571 #define GPIO_AF12_SDIO            ((uint8_t)0xC)  /* SDIO Alternate Function mapping                     */
572
573 /** 
574   * @brief   AF 14 selection  
575   */
576 #define GPIO_AF14_USB           ((uint8_t)0x0E)  /* USB Alternate Function mapping */
577
578 /** 
579   * @brief   AF 15 selection  
580   */ 
581 #define GPIO_AF15_EVENTOUT      ((uint8_t)0x0F)  /* EVENTOUT Alternate Function mapping */
582
583 #define IS_GPIO_AF(AF)          (((AF) <= (uint8_t)0x0C) || ((AF) == (uint8_t)0x0E) || ((AF) == (uint8_t)0x0F))
584 /*------------------------------------------------------------------------------------------*/
585 #endif /* STM32F302xE */
586
587 #if defined (STM32F398xx)
588 /*---------------------------------- STM32F398xx ------------------------------*/
589 /** 
590   * @brief   AF 0 selection  
591   */ 
592 #define GPIO_AF0_RTC_50Hz      ((uint8_t)0x00)  /* RTC_50Hz Alternate Function mapping                       */
593 #define GPIO_AF0_MCO           ((uint8_t)0x00)  /* MCO (MCO1 and MCO2) Alternate Function mapping            */
594 #define GPIO_AF0_TAMPER        ((uint8_t)0x00)  /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
595 #define GPIO_AF0_SWJ           ((uint8_t)0x00)  /* SWJ (SWD and JTAG) Alternate Function mapping             */
596 #define GPIO_AF0_TRACE         ((uint8_t)0x00)  /* TRACE Alternate Function mapping                          */
597
598 /** 
599   * @brief   AF 1 selection  
600   */ 
601 #define GPIO_AF1_TIM2           ((uint8_t)0x01)  /* TIM2 Alternate Function mapping */
602 #define GPIO_AF1_TIM15          ((uint8_t)0x01)  /* TIM15 Alternate Function mapping */
603 #define GPIO_AF1_TIM16          ((uint8_t)0x01)  /* TIM16 Alternate Function mapping */
604 #define GPIO_AF1_TIM17          ((uint8_t)0x01)  /* TIM17 Alternate Function mapping */
605 #define GPIO_AF1_EVENTOUT       ((uint8_t)0x01)  /* EVENTOUT Alternate Function mapping */
606
607 /** 
608   * @brief   AF 2 selection  
609   */ 
610 #define GPIO_AF2_TIM1           ((uint8_t)0x02)  /* TIM1 Alternate Function mapping */
611 #define GPIO_AF2_TIM2           ((uint8_t)0x02)  /* TIM2 Alternate Function mapping */
612 #define GPIO_AF2_TIM3           ((uint8_t)0x02)  /* TIM3 Alternate Function mapping */
613 #define GPIO_AF2_TIM4           ((uint8_t)0x02)  /* TIM4 Alternate Function mapping */
614 #define GPIO_AF2_TIM8           ((uint8_t)0x02)  /* TIM8 Alternate Function mapping */
615 #define GPIO_AF2_TIM15          ((uint8_t)0x02)  /* TIM15 Alternate Function mapping */
616 #define GPIO_AF2_COMP1          ((uint8_t)0x02)  /* COMP1 Alternate Function mapping */
617 #define GPIO_AF2_I2C3           ((uint8_t)0x02)  /* I2C3 Alternate Function mapping */
618 #define GPIO_AF2_TIM20          ((uint8_t)0x02)  /* TIM20 Alternate Function mapping */
619
620 /** 
621   * @brief   AF 3 selection  
622   */ 
623 #define GPIO_AF3_TSC           ((uint8_t)0x03)  /* TSC Alternate Function mapping  */
624 #define GPIO_AF3_TIM8          ((uint8_t)0x03)  /* TIM8 Alternate Function mapping  */
625 #define GPIO_AF3_COMP7         ((uint8_t)0x03)  /* COMP7 Alternate Function mapping */
626 #define GPIO_AF3_TIM15         ((uint8_t)0x03)  /* TIM15 Alternate Function mapping */
627 #define GPIO_AF3_I2C3          ((uint8_t)0x03)  /* I2C3 Alternate Function mapping */
628 #define GPIO_AF3_TIM20         ((uint8_t)0x03)  /* TIM20 Alternate Function mapping */
629
630 /** 
631   * @brief   AF 4 selection  
632   */ 
633 #define GPIO_AF4_TIM1          ((uint8_t)0x04)  /* TIM1 Alternate Function mapping */
634 #define GPIO_AF4_TIM8          ((uint8_t)0x04)  /* TIM8 Alternate Function mapping */
635 #define GPIO_AF4_TIM16         ((uint8_t)0x04)  /* TIM16 Alternate Function mapping */
636 #define GPIO_AF4_TIM17         ((uint8_t)0x04)  /* TIM17 Alternate Function mapping */
637 #define GPIO_AF4_I2C1          ((uint8_t)0x04)  /* I2C1 Alternate Function mapping */
638 #define GPIO_AF4_I2C2          ((uint8_t)0x04)  /* I2C2 Alternate Function mapping */
639
640 /** 
641   * @brief   AF 5 selection  
642   */ 
643 #define GPIO_AF5_SPI1          ((uint8_t)0x05)  /* SPI1 Alternate Function mapping */
644 #define GPIO_AF5_SPI2          ((uint8_t)0x05)  /* SPI2/I2S2 Alternate Function mapping */
645 #define GPIO_AF5_SPI3          ((uint8_t)0x05)  /* SPI3/I2S3 Alternate Function mapping */
646 #define GPIO_AF5_I2S           ((uint8_t)0x05)  /* I2S Alternate Function mapping */
647 #define GPIO_AF5_I2S2ext       ((uint8_t)0x05)  /* I2S2ext Alternate Function mapping */
648 #define GPIO_AF5_TIM8          ((uint8_t)0x05)  /* TIM8 Alternate Function mapping */
649 #define GPIO_AF5_IR            ((uint8_t)0x05)  /* IR Alternate Function mapping */
650 #define GPIO_AF5_UART4         ((uint8_t)0x05)  /* UART4 Alternate Function mapping */
651 #define GPIO_AF5_UART5         ((uint8_t)0x05)  /* UART5 Alternate Function mapping */
652 #define GPIO_AF5_SPI4          ((uint8_t)0x05)  /* SPI4 Alternate Function mapping */
653
654 /** 
655   * @brief   AF 6 selection  
656   */ 
657 #define GPIO_AF6_SPI2          ((uint8_t)0x06)  /* SPI2/I2S2 Alternate Function mapping */
658 #define GPIO_AF6_SPI3          ((uint8_t)0x06)  /* SPI3/I2S3 Alternate Function mapping */
659 #define GPIO_AF6_I2S3ext       ((uint8_t)0x06)  /* I2S3ext Alternate Function mapping */
660 #define GPIO_AF6_TIM1          ((uint8_t)0x06)  /* TIM1 Alternate Function mapping */
661 #define GPIO_AF6_TIM8          ((uint8_t)0x06)  /* TIM8 Alternate Function mapping */
662 #define GPIO_AF6_IR            ((uint8_t)0x06)  /* IR Alternate Function mapping */
663 #define GPIO_AF6_TIM20         ((uint8_t)0x06)  /* TIM20 Alternate Function mapping */
664
665 /** 
666   * @brief   AF 7 selection  
667   */ 
668 #define GPIO_AF7_USART1        ((uint8_t)0x07)  /* USART1 Alternate Function mapping  */
669 #define GPIO_AF7_USART2        ((uint8_t)0x07)  /* USART2 Alternate Function mapping  */
670 #define GPIO_AF7_USART3        ((uint8_t)0x07)  /* USART3 Alternate Function mapping  */
671 #define GPIO_AF7_COMP3         ((uint8_t)0x07)  /* COMP3 Alternate Function mapping  */
672 #define GPIO_AF7_COMP5         ((uint8_t)0x07)  /* COMP5 Alternate Function mapping  */
673 #define GPIO_AF7_COMP6         ((uint8_t)0x07)  /* COMP6 Alternate Function mapping  */
674 #define GPIO_AF7_CAN           ((uint8_t)0x07)  /* CAN Alternate Function mapping  */
675
676 /** 
677   * @brief   AF 8 selection  
678   */ 
679 #define GPIO_AF8_COMP1         ((uint8_t)0x08)  /* COMP1 Alternate Function mapping  */
680 #define GPIO_AF8_COMP2         ((uint8_t)0x08)  /* COMP2 Alternate Function mapping  */
681 #define GPIO_AF8_COMP3         ((uint8_t)0x08)  /* COMP3 Alternate Function mapping  */
682 #define GPIO_AF8_COMP4         ((uint8_t)0x08)  /* COMP4 Alternate Function mapping  */
683 #define GPIO_AF8_COMP5         ((uint8_t)0x08)  /* COMP5 Alternate Function mapping  */
684 #define GPIO_AF8_COMP6         ((uint8_t)0x08)  /* COMP6 Alternate Function mapping  */
685 #define GPIO_AF8_I2C3          ((uint8_t)0x08)  /* I2C3 Alternate Function mapping */
686
687 /** 
688   * @brief   AF 9 selection 
689   */ 
690 #define GPIO_AF9_CAN           ((uint8_t)0x09)  /* CAN Alternate Function mapping  */
691 #define GPIO_AF9_TIM1          ((uint8_t)0x09)  /* TIM1 Alternate Function mapping */
692 #define GPIO_AF9_TIM8          ((uint8_t)0x09)  /* TIM8 Alternate Function mapping */
693 #define GPIO_AF9_TIM15         ((uint8_t)0x09)  /* TIM15 Alternate Function mapping */
694
695 /** 
696   * @brief   AF 10 selection  
697   */ 
698 #define GPIO_AF10_TIM2           ((uint8_t)0xA)  /* TIM2 Alternate Function mapping */
699 #define GPIO_AF10_TIM3           ((uint8_t)0xA)  /* TIM3 Alternate Function mapping */
700 #define GPIO_AF10_TIM4           ((uint8_t)0xA)  /* TIM4 Alternate Function mapping */
701 #define GPIO_AF10_TIM8           ((uint8_t)0xA)  /* TIM8 Alternate Function mapping */
702 #define GPIO_AF10_TIM17          ((uint8_t)0xA)  /* TIM17 Alternate Function mapping */
703 /** 
704   * @brief   AF 11 selection  
705   */ 
706 #define GPIO_AF11_TIM1           ((uint8_t)0x0B)  /* TIM1 Alternate Function mapping */
707 #define GPIO_AF11_TIM8           ((uint8_t)0x0B)  /* TIM8 Alternate Function mapping */
708
709 /** 
710   * @brief   AF 12 selection  
711   */ 
712 #define GPIO_AF12_TIM1            ((uint8_t)0xC)  /* TIM1 Alternate Function mapping */
713 #define GPIO_AF12_FMC             ((uint8_t)0xC)  /* FMC Alternate Function mapping                      */
714 #define GPIO_AF12_SDIO            ((uint8_t)0xC)  /* SDIO Alternate Function mapping                     */
715
716 /** 
717   * @brief   AF 15 selection  
718   */ 
719 #define GPIO_AF15_EVENTOUT      ((uint8_t)0x0F)  /* EVENTOUT Alternate Function mapping */
720
721 #define IS_GPIO_AF(AF)          (((AF) <= (uint8_t)0x0C) || ((AF) == (uint8_t)0x0F))
722 /*------------------------------------------------------------------------------------------*/
723 #endif /* STM32F398xx */
724
725 #if defined (STM32F358xx)
726 /*---------------------------------- STM32F358xx -------------------------------------------*/
727 /** 
728   * @brief   AF 0 selection  
729   */ 
730 #define GPIO_AF0_RTC_50Hz      ((uint8_t)0x00)  /* RTC_50Hz Alternate Function mapping                       */
731 #define GPIO_AF0_MCO           ((uint8_t)0x00)  /* MCO (MCO1 and MCO2) Alternate Function mapping            */
732 #define GPIO_AF0_TAMPER        ((uint8_t)0x00)  /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
733 #define GPIO_AF0_SWJ           ((uint8_t)0x00)  /* SWJ (SWD and JTAG) Alternate Function mapping             */
734 #define GPIO_AF0_TRACE         ((uint8_t)0x00)  /* TRACE Alternate Function mapping                          */
735
736 /** 
737   * @brief   AF 1 selection  
738   */ 
739 #define GPIO_AF1_TIM2           ((uint8_t)0x01)  /* TIM2 Alternate Function mapping */
740 #define GPIO_AF1_TIM15          ((uint8_t)0x01)  /* TIM15 Alternate Function mapping */
741 #define GPIO_AF1_TIM16          ((uint8_t)0x01)  /* TIM16 Alternate Function mapping */
742 #define GPIO_AF1_TIM17          ((uint8_t)0x01)  /* TIM17 Alternate Function mapping */
743 #define GPIO_AF1_EVENTOUT       ((uint8_t)0x01)  /* EVENTOUT Alternate Function mapping */
744 /** 
745   * @brief   AF 2 selection  
746   */ 
747 #define GPIO_AF2_TIM1           ((uint8_t)0x02)  /* TIM1 Alternate Function mapping */
748 #define GPIO_AF2_TIM2           ((uint8_t)0x02)  /* TIM2 Alternate Function mapping */
749 #define GPIO_AF2_TIM3           ((uint8_t)0x02)  /* TIM3 Alternate Function mapping */
750 #define GPIO_AF2_TIM4           ((uint8_t)0x02)  /* TIM4 Alternate Function mapping */
751 #define GPIO_AF2_TIM8           ((uint8_t)0x02)  /* TIM8 Alternate Function mapping */
752 #define GPIO_AF2_TIM15          ((uint8_t)0x02)  /* TIM15 Alternate Function mapping */
753 #define GPIO_AF2_COMP1          ((uint8_t)0x02)  /* COMP1 Alternate Function mapping */
754 /** 
755   * @brief   AF 3 selection  
756   */ 
757 #define GPIO_AF3_TSC           ((uint8_t)0x03)  /* TSC Alternate Function mapping  */
758 #define GPIO_AF3_TIM8          ((uint8_t)0x03)  /* TIM8 Alternate Function mapping  */
759 #define GPIO_AF3_COMP7         ((uint8_t)0x03)  /* COMP7 Alternate Function mapping */
760 #define GPIO_AF3_TIM15         ((uint8_t)0x03)  /* TIM15 Alternate Function mapping */
761
762 /** 
763   * @brief   AF 4 selection  
764   */ 
765 #define GPIO_AF4_TIM1          ((uint8_t)0x04)  /* TIM1 Alternate Function mapping */
766 #define GPIO_AF4_TIM8          ((uint8_t)0x04)  /* TIM8 Alternate Function mapping */
767 #define GPIO_AF4_TIM16         ((uint8_t)0x04)  /* TIM16 Alternate Function mapping */
768 #define GPIO_AF4_TIM17         ((uint8_t)0x04)  /* TIM17 Alternate Function mapping */
769 #define GPIO_AF4_I2C1          ((uint8_t)0x04)  /* I2C1 Alternate Function mapping */
770 #define GPIO_AF4_I2C2          ((uint8_t)0x04)  /* I2C2 Alternate Function mapping */
771
772 /** 
773   * @brief   AF 5 selection  
774   */ 
775 #define GPIO_AF5_SPI1          ((uint8_t)0x05)  /* SPI1/I2S1 Alternate Function mapping      */
776 #define GPIO_AF5_SPI2          ((uint8_t)0x05)  /* SPI2/I2S2 Alternate Function mapping */
777 #define GPIO_AF5_SPI3          ((uint8_t)0x05)  /* SPI3/I2S3 Alternate Function mapping */
778 #define GPIO_AF5_I2S           ((uint8_t)0x05)  /* I2S Alternate Function mapping */
779 #define GPIO_AF5_I2S2ext       ((uint8_t)0x05)  /* I2S2ext Alternate Function mapping */
780 #define GPIO_AF5_TIM8          ((uint8_t)0x05)  /* TIM8 Alternate Function mapping */
781 #define GPIO_AF5_IR            ((uint8_t)0x05)  /* IR Alternate Function mapping */
782 #define GPIO_AF5_UART4         ((uint8_t)0x05)  /* UART4 Alternate Function mapping */
783 #define GPIO_AF5_UART5         ((uint8_t)0x05)  /* UART5 Alternate Function mapping */
784 /** 
785   * @brief   AF 6 selection  
786   */ 
787 #define GPIO_AF6_SPI2          ((uint8_t)0x06)  /* SPI2/I2S2 Alternate Function mapping */
788 #define GPIO_AF6_SPI3          ((uint8_t)0x06)  /* SPI3/I2S3 Alternate Function mapping */
789 #define GPIO_AF6_I2S3ext       ((uint8_t)0x06)  /* I2S3ext Alternate Function mapping */
790 #define GPIO_AF6_TIM1          ((uint8_t)0x06)  /* TIM1 Alternate Function mapping */
791 #define GPIO_AF6_TIM8          ((uint8_t)0x06)  /* TIM8 Alternate Function mapping */
792 #define GPIO_AF6_IR            ((uint8_t)0x06)  /* IR Alternate Function mapping */
793
794 /** 
795   * @brief   AF 7 selection  
796   */ 
797 #define GPIO_AF7_USART1        ((uint8_t)0x07)  /* USART1 Alternate Function mapping  */
798 #define GPIO_AF7_USART2        ((uint8_t)0x07)  /* USART2 Alternate Function mapping  */
799 #define GPIO_AF7_USART3        ((uint8_t)0x07)  /* USART3 Alternate Function mapping  */
800 #define GPIO_AF7_COMP3         ((uint8_t)0x07)  /* COMP3 Alternate Function mapping  */
801 #define GPIO_AF7_COMP5         ((uint8_t)0x07)  /* COMP5 Alternate Function mapping  */
802 #define GPIO_AF7_COMP6         ((uint8_t)0x07)  /* COMP6 Alternate Function mapping  */
803 #define GPIO_AF7_CAN           ((uint8_t)0x07)  /* CAN Alternate Function mapping  */
804
805 /** 
806   * @brief   AF 8 selection  
807   */ 
808 #define GPIO_AF8_COMP1         ((uint8_t)0x08)  /* COMP1 Alternate Function mapping  */
809 #define GPIO_AF8_COMP2         ((uint8_t)0x08)  /* COMP2 Alternate Function mapping  */
810 #define GPIO_AF8_COMP3         ((uint8_t)0x08)  /* COMP3 Alternate Function mapping  */
811 #define GPIO_AF8_COMP4         ((uint8_t)0x08)  /* COMP4 Alternate Function mapping  */
812 #define GPIO_AF8_COMP5         ((uint8_t)0x08)  /* COMP5 Alternate Function mapping  */
813 #define GPIO_AF8_COMP6         ((uint8_t)0x08)  /* COMP6 Alternate Function mapping  */
814
815 /** 
816   * @brief   AF 9 selection 
817   */ 
818 #define GPIO_AF9_CAN           ((uint8_t)0x09)  /* CAN Alternate Function mapping  */
819 #define GPIO_AF9_TIM1          ((uint8_t)0x09)  /* TIM1 Alternate Function mapping */
820 #define GPIO_AF9_TIM8          ((uint8_t)0x09)  /* TIM8 Alternate Function mapping */
821 #define GPIO_AF9_TIM15         ((uint8_t)0x09)  /* TIM15 Alternate Function mapping */
822
823 /** 
824   * @brief   AF 10 selection  
825   */ 
826 #define GPIO_AF10_TIM2           ((uint8_t)0xA)  /* TIM2 Alternate Function mapping */
827 #define GPIO_AF10_TIM3           ((uint8_t)0xA)  /* TIM3 Alternate Function mapping */
828 #define GPIO_AF10_TIM4           ((uint8_t)0xA)  /* TIM4 Alternate Function mapping */
829 #define GPIO_AF10_TIM8           ((uint8_t)0xA)  /* TIM8 Alternate Function mapping */
830 #define GPIO_AF10_TIM17          ((uint8_t)0xA)  /* TIM17 Alternate Function mapping */
831 /** 
832   * @brief   AF 11 selection  
833   */ 
834 #define GPIO_AF11_TIM1           ((uint8_t)0x0B)  /* TIM1 Alternate Function mapping */
835 #define GPIO_AF11_TIM8           ((uint8_t)0x0B)  /* TIM8 Alternate Function mapping */
836
837 /** 
838   * @brief   AF 12 selection  
839   */ 
840 #define GPIO_AF12_TIM1            ((uint8_t)0xC)  /* TIM1 Alternate Function mapping */
841
842 /** 
843   * @brief   AF 15 selection  
844   */ 
845 #define GPIO_AF15_EVENTOUT      ((uint8_t)0x0F)  /* EVENTOUT Alternate Function mapping */
846
847 #define IS_GPIO_AF(AF)          (((AF) <= (uint8_t)0x0C) || ((AF) == (uint8_t)0x0F))
848 /*------------------------------------------------------------------------------------------*/
849 #endif /* STM32F358xx */
850
851 #if  defined (STM32F373xC)
852 /*---------------------------------- STM32F373xC--------------------------------*/
853 /** 
854   * @brief   AF 0 selection  
855   */ 
856 #define GPIO_AF0_RTC_50Hz      ((uint8_t)0x00)  /* RTC_50Hz Alternate Function mapping                       */
857 #define GPIO_AF0_MCO           ((uint8_t)0x00)  /* MCO (MCO1 and MCO2) Alternate Function mapping            */
858 #define GPIO_AF0_TAMPER        ((uint8_t)0x00)  /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
859 #define GPIO_AF0_SWJ           ((uint8_t)0x00)  /* SWJ (SWD and JTAG) Alternate Function mapping             */
860 #define GPIO_AF0_TRACE         ((uint8_t)0x00)  /* TRACE Alternate Function mapping                          */
861
862 /** 
863   * @brief   AF 1 selection  
864   */ 
865 #define GPIO_AF1_TIM2           ((uint8_t)0x01)  /* TIM2 Alternate Function mapping */
866 #define GPIO_AF1_TIM15          ((uint8_t)0x01)  /* TIM15 Alternate Function mapping */
867 #define GPIO_AF1_TIM16          ((uint8_t)0x01)  /* TIM16 Alternate Function mapping */
868 #define GPIO_AF1_TIM17          ((uint8_t)0x01)  /* TIM17 Alternate Function mapping */
869 #define GPIO_AF1_EVENTOUT       ((uint8_t)0x01)  /* EVENTOUT Alternate Function mapping */
870 /** 
871   * @brief   AF 2 selection  
872   */ 
873 #define GPIO_AF2_TIM3           ((uint8_t)0x02)  /* TIM3 Alternate Function mapping */
874 #define GPIO_AF2_TIM4           ((uint8_t)0x02)  /* TIM4 Alternate Function mapping */
875 #define GPIO_AF2_TIM5           ((uint8_t)0x02)  /* TIM5 Alternate Function mapping */
876 #define GPIO_AF2_TIM13          ((uint8_t)0x02)  /* TIM13 Alternate Function mapping */
877 #define GPIO_AF2_TIM14          ((uint8_t)0x02)  /* TIM14 Alternate Function mapping */
878 #define GPIO_AF2_TIM15          ((uint8_t)0x02)  /* TIM15 Alternate Function mapping */
879 #define GPIO_AF2_TIM19          ((uint8_t)0x02)  /* TIM19 Alternate Function mapping */
880
881 /** 
882   * @brief   AF 3 selection  
883   */ 
884 #define GPIO_AF3_TSC           ((uint8_t)0x03)  /* TSC Alternate Function mapping  */
885 /** 
886   * @brief   AF 4 selection  
887   */ 
888 #define GPIO_AF4_I2C1          ((uint8_t)0x04)  /* I2C1 Alternate Function mapping */
889 #define GPIO_AF4_I2C2          ((uint8_t)0x04)  /* I2C2 Alternate Function mapping */
890
891 /** 
892   * @brief   AF 5 selection  
893   */ 
894 #define GPIO_AF5_SPI1          ((uint8_t)0x05)  /* SPI1/I2S1 Alternate Function mapping */
895 #define GPIO_AF5_SPI2          ((uint8_t)0x05)  /* SPI2/I2S2 Alternate Function mapping */
896 #define GPIO_AF5_IR            ((uint8_t)0x05)  /* IR Alternate Function mapping */
897 /** 
898   * @brief   AF 6 selection  
899   */ 
900 #define GPIO_AF6_SPI1          ((uint8_t)0x06)  /* SPI1/I2S1 Alternate Function mapping */
901 #define GPIO_AF6_SPI3          ((uint8_t)0x06)  /* SPI3/I2S3 Alternate Function mapping */
902 #define GPIO_AF6_IR            ((uint8_t)0x06)  /* IR Alternate Function mapping */
903 #define GPIO_AF6_CEC           ((uint8_t)0x06)  /* CEC Alternate Function mapping */
904 /** 
905   * @brief   AF 7 selection  
906   */ 
907 #define GPIO_AF7_USART1        ((uint8_t)0x07)  /* USART1 Alternate Function mapping  */
908 #define GPIO_AF7_USART2        ((uint8_t)0x07)  /* USART2 Alternate Function mapping  */
909 #define GPIO_AF7_USART3        ((uint8_t)0x07)  /* USART3 Alternate Function mapping  */
910 #define GPIO_AF7_CAN           ((uint8_t)0x07)  /* CAN Alternate Function mapping  */
911 #define GPIO_AF7_CEC           ((uint8_t)0x07)  /* CEC Alternate Function mapping  */
912
913 /** 
914   * @brief   AF 8 selection  
915   */ 
916 #define GPIO_AF8_COMP1         ((uint8_t)0x08)  /* COMP1 Alternate Function mapping  */
917 #define GPIO_AF8_COMP2         ((uint8_t)0x08)  /* COMP2 Alternate Function mapping  */
918
919 /** 
920   * @brief   AF 9 selection 
921   */ 
922 #define GPIO_AF9_CAN           ((uint8_t)0x09)  /* CAN Alternate Function mapping  */
923 #define GPIO_AF9_TIM12         ((uint8_t)0x09)  /* TIM12 Alternate Function mapping */
924 #define GPIO_AF9_TIM13         ((uint8_t)0x09)  /* TIM13 Alternate Function mapping */
925 #define GPIO_AF9_TIM14         ((uint8_t)0x09)  /* TIM14 Alternate Function mapping */
926 #define GPIO_AF9_TIM15         ((uint8_t)0x09)  /* TIM15 Alternate Function mapping */
927 /** 
928   * @brief   AF 10 selection  
929   */ 
930 #define GPIO_AF10_TIM2           ((uint8_t)0xA)  /* TIM2 Alternate Function mapping */
931 #define GPIO_AF10_TIM3           ((uint8_t)0xA)  /* TIM3 Alternate Function mapping */
932 #define GPIO_AF10_TIM4           ((uint8_t)0xA)  /* TIM4 Alternate Function mapping */
933 #define GPIO_AF10_TIM12          ((uint8_t)0xA)  /* TIM12 Alternate Function mapping */
934 #define GPIO_AF10_TIM17          ((uint8_t)0xA)  /* TIM17 Alternate Function mapping */
935 /** 
936   * @brief   AF 11 selection  
937   */ 
938 #define GPIO_AF11_TIM19          ((uint8_t)0x0B)  /* TIM19 Alternate Function mapping */
939
940
941 /** 
942   * @brief   AF 14 selection  
943   */ 
944 #define GPIO_AF14_USB           ((uint8_t)0x0E)  /* USB Alternate Function mapping */
945
946 /** 
947   * @brief   AF 15 selection  
948   */ 
949 #define GPIO_AF15_EVENTOUT      ((uint8_t)0x0F)  /* EVENTOUT Alternate Function mapping */
950
951 #define IS_GPIO_AF(AF)          (((AF) <= (uint8_t)0x0B) || ((AF) == (uint8_t)0x0E) || ((AF) == (uint8_t)0x0F))
952 /*------------------------------------------------------------------------------------------*/
953 #endif /* STM32F373xC */
954
955
956 #if defined (STM32F378xx)
957 /*---------------------------------------- STM32F378xx--------------------------------------*/
958 /** 
959   * @brief   AF 0 selection  
960   */ 
961 #define GPIO_AF0_RTC_50Hz      ((uint8_t)0x00)  /* RTC_50Hz Alternate Function mapping                       */
962 #define GPIO_AF0_MCO           ((uint8_t)0x00)  /* MCO (MCO1 and MCO2) Alternate Function mapping            */
963 #define GPIO_AF0_TAMPER        ((uint8_t)0x00)  /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
964 #define GPIO_AF0_SWJ           ((uint8_t)0x00)  /* SWJ (SWD and JTAG) Alternate Function mapping             */
965 #define GPIO_AF0_TRACE         ((uint8_t)0x00)  /* TRACE Alternate Function mapping                          */
966
967 /** 
968   * @brief   AF 1 selection  
969   */ 
970 #define GPIO_AF1_TIM2           ((uint8_t)0x01)  /* TIM2 Alternate Function mapping */
971 #define GPIO_AF1_TIM15          ((uint8_t)0x01)  /* TIM15 Alternate Function mapping */
972 #define GPIO_AF1_TIM16          ((uint8_t)0x01)  /* TIM16 Alternate Function mapping */
973 #define GPIO_AF1_TIM17          ((uint8_t)0x01)  /* TIM17 Alternate Function mapping */
974 #define GPIO_AF1_EVENTOUT       ((uint8_t)0x01)  /* EVENTOUT Alternate Function mapping */
975 /** 
976   * @brief   AF 2 selection  
977   */ 
978 #define GPIO_AF2_TIM3           ((uint8_t)0x02)  /* TIM3 Alternate Function mapping */
979 #define GPIO_AF2_TIM4           ((uint8_t)0x02)  /* TIM4 Alternate Function mapping */
980 #define GPIO_AF2_TIM5           ((uint8_t)0x02)  /* TIM5 Alternate Function mapping */
981 #define GPIO_AF2_TIM13          ((uint8_t)0x02)  /* TIM13 Alternate Function mapping */
982 #define GPIO_AF2_TIM14          ((uint8_t)0x02)  /* TIM14 Alternate Function mapping */
983 #define GPIO_AF2_TIM15          ((uint8_t)0x02)  /* TIM15 Alternate Function mapping */
984 #define GPIO_AF2_TIM19          ((uint8_t)0x02)  /* TIM19 Alternate Function mapping */
985
986 /** 
987   * @brief   AF 3 selection  
988   */ 
989 #define GPIO_AF3_TSC           ((uint8_t)0x03)  /* TSC Alternate Function mapping  */
990 /** 
991   * @brief   AF 4 selection  
992   */ 
993 #define GPIO_AF4_I2C1          ((uint8_t)0x04)  /* I2C1 Alternate Function mapping */
994 #define GPIO_AF4_I2C2          ((uint8_t)0x04)  /* I2C2 Alternate Function mapping */
995
996 /** 
997   * @brief   AF 5 selection  
998   */ 
999 #define GPIO_AF5_SPI1          ((uint8_t)0x05)  /* SPI1/I2S1 Alternate Function mapping */
1000 #define GPIO_AF5_SPI2          ((uint8_t)0x05)  /* SPI2/I2S2 Alternate Function mapping */
1001 #define GPIO_AF5_IR            ((uint8_t)0x05)  /* IR Alternate Function mapping */
1002
1003 /** 
1004   * @brief   AF 6 selection  
1005   */ 
1006 #define GPIO_AF6_SPI1          ((uint8_t)0x06)  /* SPI1/I2S1 Alternate Function mapping */
1007 #define GPIO_AF6_SPI3          ((uint8_t)0x06)  /* SPI3/I2S3 Alternate Function mapping */
1008 #define GPIO_AF6_IR            ((uint8_t)0x06)  /* IR Alternate Function mapping */
1009 #define GPIO_AF6_CEC           ((uint8_t)0x06)  /* CEC Alternate Function mapping */
1010
1011 /** 
1012   * @brief   AF 7 selection  
1013   */ 
1014 #define GPIO_AF7_USART1        ((uint8_t)0x07)  /* USART1 Alternate Function mapping  */
1015 #define GPIO_AF7_USART2        ((uint8_t)0x07)  /* USART2 Alternate Function mapping  */
1016 #define GPIO_AF7_USART3        ((uint8_t)0x07)  /* USART3 Alternate Function mapping  */
1017 #define GPIO_AF7_CAN           ((uint8_t)0x07)  /* CAN Alternate Function mapping  */
1018 #define GPIO_AF7_CEC           ((uint8_t)0x07)  /* CEC Alternate Function mapping  */
1019
1020 /** 
1021   * @brief   AF 8 selection  
1022   */ 
1023 #define GPIO_AF8_COMP1         ((uint8_t)0x08)  /* COMP1 Alternate Function mapping  */
1024 #define GPIO_AF8_COMP2         ((uint8_t)0x08)  /* COMP2 Alternate Function mapping  */
1025
1026 /** 
1027   * @brief   AF 9 selection  
1028   */
1029 #define GPIO_AF9_CAN           ((uint8_t)0x09)  /* CAN Alternate Function mapping  */
1030 #define GPIO_AF9_TIM12         ((uint8_t)0x09)  /* TIM12 Alternate Function mapping */
1031 #define GPIO_AF9_TIM13         ((uint8_t)0x09)  /* TIM13 Alternate Function mapping */
1032 #define GPIO_AF9_TIM14         ((uint8_t)0x09)  /* TIM14 Alternate Function mapping */
1033 #define GPIO_AF9_TIM15         ((uint8_t)0x09)  /* TIM15 Alternate Function mapping */
1034
1035 /** 
1036   * @brief   AF 10 selection  
1037   */ 
1038 #define GPIO_AF10_TIM2           ((uint8_t)0xA)  /* TIM2 Alternate Function mapping */
1039 #define GPIO_AF10_TIM3           ((uint8_t)0xA)  /* TIM3 Alternate Function mapping */
1040 #define GPIO_AF10_TIM4           ((uint8_t)0xA)  /* TIM4 Alternate Function mapping */
1041 #define GPIO_AF10_TIM12          ((uint8_t)0xA)  /* TIM12 Alternate Function mapping */
1042 #define GPIO_AF10_TIM17          ((uint8_t)0xA)  /* TIM17 Alternate Function mapping */
1043
1044 /** 
1045   * @brief   AF 11 selection  
1046   */ 
1047 #define GPIO_AF11_TIM19          ((uint8_t)0x0B)  /* TIM19 Alternate Function mapping */
1048
1049 /** 
1050   * @brief   AF 15 selection  
1051   */ 
1052 #define GPIO_AF15_EVENTOUT      ((uint8_t)0x0F)  /* EVENTOUT Alternate Function mapping */
1053
1054 #define IS_GPIO_AF(AF)          (((AF) <= (uint8_t)0x0B) || ((AF) == (uint8_t)0x0F))
1055 /*------------------------------------------------------------------------------------------*/
1056 #endif /* STM32F378xx */
1057
1058 #if defined (STM32F303x8)
1059 /*---------------------------------- STM32F303x8--------------------------------*/
1060 /** 
1061   * @brief   AF 0 selection  
1062   */ 
1063 #define GPIO_AF0_MCO           ((uint8_t)0x00)  /* MCO (MCO1 and MCO2) Alternate Function mapping            */
1064 #define GPIO_AF0_TAMPER        ((uint8_t)0x00)  /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
1065 #define GPIO_AF0_SWJ           ((uint8_t)0x00)  /* SWJ (SWD and JTAG) Alternate Function mapping             */
1066 #define GPIO_AF0_TRACE         ((uint8_t)0x00)  /* TRACE Alternate Function mapping                          */
1067
1068 /** 
1069   * @brief   AF 1 selection  
1070   */ 
1071 #define GPIO_AF1_TIM2           ((uint8_t)0x01)  /* TIM2 Alternate Function mapping */
1072 #define GPIO_AF1_TIM15          ((uint8_t)0x01)  /* TIM15 Alternate Function mapping */
1073 #define GPIO_AF1_TIM16          ((uint8_t)0x01)  /* TIM16 Alternate Function mapping */
1074 #define GPIO_AF1_TIM17          ((uint8_t)0x01)  /* TIM17 Alternate Function mapping */
1075 #define GPIO_AF1_EVENTOUT       ((uint8_t)0x01)  /* EVENTOUT Alternate Function mapping */
1076 /** 
1077   * @brief   AF 2 selection  
1078   */ 
1079 #define GPIO_AF2_TIM3           ((uint8_t)0x02)  /* TIM3 Alternate Function mapping */
1080 #define GPIO_AF2_TIM1           ((uint8_t)0x02)  /* TIM1 Alternate Function mapping */
1081 #define GPIO_AF2_TIM15          ((uint8_t)0x02)  /* TIM15 Alternate Function mapping */
1082 #define GPIO_AF2_TIM16          ((uint8_t)0x02)  /* TIM16 Alternate Function mapping */
1083
1084 /** 
1085   * @brief   AF 3 selection  
1086   */ 
1087 #define GPIO_AF3_TSC           ((uint8_t)0x03)  /* TSC Alternate Function mapping  */
1088
1089 /** 
1090   * @brief   AF 4 selection  
1091   */ 
1092 #define GPIO_AF4_I2C1          ((uint8_t)0x04)  /* I2C1 Alternate Function mapping */
1093 #define GPIO_AF4_TIM1          ((uint8_t)0x04)  /* TIM1 Alternate Function mapping */
1094
1095 /** 
1096   * @brief   AF 5 selection  
1097   */ 
1098 #define GPIO_AF5_SPI1          ((uint8_t)0x05)  /* SPI1 Alternate Function mapping */
1099 #define GPIO_AF5_IR            ((uint8_t)0x05)  /* IR Alternate Function mapping */
1100 /** 
1101   * @brief   AF 6 selection  
1102   */ 
1103 #define GPIO_AF6_TIM1          ((uint8_t)0x06)  /* TIM1 Alternate Function mapping */
1104 #define GPIO_AF6_IR            ((uint8_t)0x06)  /* IR Alternate Function mapping */
1105
1106 /** 
1107   * @brief   AF 7 selection  
1108   */ 
1109 #define GPIO_AF7_USART1        ((uint8_t)0x07)  /* USART1 Alternate Function mapping  */
1110 #define GPIO_AF7_USART2        ((uint8_t)0x07)  /* USART2 Alternate Function mapping  */
1111 #define GPIO_AF7_USART3        ((uint8_t)0x07)  /* USART3 Alternate Function mapping  */
1112 #define GPIO_AF7_GPCOMP6       ((uint8_t)0x07)  /* GPCOMP6 Alternate Function mapping  */
1113
1114 /** 
1115   * @brief   AF 8 selection  
1116   */ 
1117 #define GPIO_AF8_GPCOMP2         ((uint8_t)0x08)  /* GPCOMP2 Alternate Function mapping  */
1118 #define GPIO_AF8_GPCOMP4         ((uint8_t)0x08)  /* GPCOMP4 Alternate Function mapping  */
1119 #define GPIO_AF8_GPCOMP6         ((uint8_t)0x08)  /* GPCOMP6 Alternate Function mapping  */
1120
1121 /** 
1122   * @brief   AF 9 selection 
1123   */ 
1124 #define GPIO_AF9_CAN           ((uint8_t)0x09)  /* CAN Alternate Function mapping  */
1125 #define GPIO_AF9_TIM1          ((uint8_t)0x09)  /* TIM1 Alternate Function mapping */
1126 #define GPIO_AF9_TIM15         ((uint8_t)0x09)  /* TIM15 Alternate Function mapping */
1127 /** 
1128   * @brief   AF 10 selection  
1129   */ 
1130 #define GPIO_AF10_TIM2           ((uint8_t)0xA)  /* TIM2 Alternate Function mapping */
1131 #define GPIO_AF10_TIM3           ((uint8_t)0xA)  /* TIM3 Alternate Function mapping */
1132 #define GPIO_AF10_TIM17          ((uint8_t)0xA)  /* TIM17 Alternate Function mapping */
1133
1134 /** 
1135   * @brief   AF 11 selection  
1136   */ 
1137 #define GPIO_AF11_TIM1          ((uint8_t)0x0B)  /* TIM1 Alternate Function mapping */
1138
1139 /** 
1140   * @brief   AF 12 selection  
1141   */ 
1142 #define GPIO_AF12_TIM1          ((uint8_t)0x0C)  /* TIM1 Alternate Function mapping */
1143
1144 /** 
1145   * @brief   AF 13 selection  
1146   */ 
1147 #define GPIO_AF13_OPAMP2        ((uint8_t)0x0D)  /* OPAMP2 Alternate Function mapping */
1148
1149 /** 
1150   * @brief   AF 15 selection  
1151   */ 
1152 #define GPIO_AF15_EVENTOUT      ((uint8_t)0x0F)  /* EVENTOUT Alternate Function mapping */
1153
1154 #define IS_GPIO_AF(AF)          (((AF) <= (uint8_t)0x0D) || ((AF) == (uint8_t)0x0F))
1155 /*------------------------------------------------------------------------------------------*/
1156 #endif /* STM32F303x8 */
1157
1158 #if defined (STM32F334x8) || defined (STM32F328xx)
1159 /*---------------------------------- STM32F334x8/STM32F328xx -------------------------------*/
1160 /** 
1161   * @brief   AF 0 selection  
1162   */ 
1163 #define GPIO_AF0_MCO           ((uint8_t)0x00)  /* MCO (MCO1 and MCO2) Alternate Function mapping            */
1164 #define GPIO_AF0_TAMPER        ((uint8_t)0x00)  /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
1165 #define GPIO_AF0_SWJ           ((uint8_t)0x00)  /* SWJ (SWD and JTAG) Alternate Function mapping             */
1166 #define GPIO_AF0_TRACE         ((uint8_t)0x00)  /* TRACE Alternate Function mapping                          */
1167
1168 /** 
1169   * @brief   AF 1 selection  
1170   */ 
1171 #define GPIO_AF1_TIM2           ((uint8_t)0x01)  /* TIM2 Alternate Function mapping */
1172 #define GPIO_AF1_TIM15          ((uint8_t)0x01)  /* TIM15 Alternate Function mapping */
1173 #define GPIO_AF1_TIM16          ((uint8_t)0x01)  /* TIM16 Alternate Function mapping */
1174 #define GPIO_AF1_TIM17          ((uint8_t)0x01)  /* TIM17 Alternate Function mapping */
1175 #define GPIO_AF1_EVENTOUT       ((uint8_t)0x01)  /* EVENTOUT Alternate Function mapping */
1176 /** 
1177   * @brief   AF 2 selection  
1178   */ 
1179 #define GPIO_AF2_TIM3           ((uint8_t)0x02)  /* TIM3 Alternate Function mapping */
1180 #define GPIO_AF2_TIM1           ((uint8_t)0x02)  /* TIM1 Alternate Function mapping */
1181 #define GPIO_AF2_TIM15          ((uint8_t)0x02)  /* TIM15 Alternate Function mapping */
1182 #define GPIO_AF2_TIM16          ((uint8_t)0x02)  /* TIM16 Alternate Function mapping */
1183
1184 /** 
1185   * @brief   AF 3 selection  
1186   */ 
1187 #define GPIO_AF3_TSC           ((uint8_t)0x03)  /* TSC Alternate Function mapping  */
1188 #define GPIO_AF3_HRTIM1        ((uint8_t)0x03)  /* HRTIM1 Alternate Function mapping  */
1189
1190 /** 
1191   * @brief   AF 4 selection  
1192   */ 
1193 #define GPIO_AF4_I2C1          ((uint8_t)0x04)  /* I2C1 Alternate Function mapping */
1194 #define GPIO_AF4_TIM1          ((uint8_t)0x04)  /* TIM1 Alternate Function mapping */
1195
1196 /** 
1197   * @brief   AF 5 selection  
1198   */ 
1199 #define GPIO_AF5_SPI1          ((uint8_t)0x05)  /* SPI1 Alternate Function mapping */
1200 #define GPIO_AF5_IR            ((uint8_t)0x05)  /* IR Alternate Function mapping */
1201 /** 
1202   * @brief   AF 6 selection  
1203   */ 
1204 #define GPIO_AF6_TIM1          ((uint8_t)0x06)  /* TIM1 Alternate Function mapping */
1205 #define GPIO_AF6_IR            ((uint8_t)0x06)  /* IR Alternate Function mapping */
1206
1207 /** 
1208   * @brief   AF 7 selection  
1209   */ 
1210 #define GPIO_AF7_USART1        ((uint8_t)0x07)  /* USART1 Alternate Function mapping  */
1211 #define GPIO_AF7_USART2        ((uint8_t)0x07)  /* USART2 Alternate Function mapping  */
1212 #define GPIO_AF7_USART3        ((uint8_t)0x07)  /* USART3 Alternate Function mapping  */
1213 #define GPIO_AF7_GPCOMP6       ((uint8_t)0x07)  /* GPCOMP6 Alternate Function mapping  */
1214
1215 /** 
1216   * @brief   AF 8 selection  
1217   */ 
1218 #define GPIO_AF8_GPCOMP2         ((uint8_t)0x08)  /* GPCOMP2 Alternate Function mapping  */
1219 #define GPIO_AF8_GPCOMP4         ((uint8_t)0x08)  /* GPCOMP4 Alternate Function mapping  */
1220 #define GPIO_AF8_GPCOMP6         ((uint8_t)0x08)  /* GPCOMP6 Alternate Function mapping  */
1221
1222 /** 
1223   * @brief   AF 9 selection 
1224   */ 
1225 #define GPIO_AF9_CAN           ((uint8_t)0x09)  /* CAN Alternate Function mapping  */
1226 #define GPIO_AF9_TIM1          ((uint8_t)0x09)  /* TIM1 Alternate Function mapping */
1227 #define GPIO_AF9_TIM15         ((uint8_t)0x09)  /* TIM15 Alternate Function mapping */
1228 /** 
1229   * @brief   AF 10 selection  
1230   */ 
1231 #define GPIO_AF10_TIM2           ((uint8_t)0xA)  /* TIM2 Alternate Function mapping */
1232 #define GPIO_AF10_TIM3           ((uint8_t)0xA)  /* TIM3 Alternate Function mapping */
1233 #define GPIO_AF10_TIM17          ((uint8_t)0xA)  /* TIM17 Alternate Function mapping */
1234
1235 /** 
1236   * @brief   AF 11 selection  
1237   */ 
1238 #define GPIO_AF11_TIM1          ((uint8_t)0x0B)  /* TIM1 Alternate Function mapping */
1239
1240 /** 
1241   * @brief   AF 12 selection  
1242   */ 
1243 #define GPIO_AF12_TIM1          ((uint8_t)0x0C)  /* TIM1 Alternate Function mapping */
1244 #define GPIO_AF12_HRTIM1        ((uint8_t)0x0C)  /* HRTIM1 Alternate Function mapping  */
1245
1246 /** 
1247   * @brief   AF 13 selection  
1248   */ 
1249 #define GPIO_AF13_OPAMP2        ((uint8_t)0x0D)  /* OPAMP2 Alternate Function mapping */
1250 #define GPIO_AF13_HRTIM1        ((uint8_t)0x0D)  /* HRTIM1 Alternate Function mapping  */
1251
1252 /** 
1253   * @brief   AF 15 selection  
1254   */ 
1255 #define GPIO_AF15_EVENTOUT      ((uint8_t)0x0F)  /* EVENTOUT Alternate Function mapping */
1256
1257 #define IS_GPIO_AF(AF)          (((AF) <= (uint8_t)0x0D) || ((AF) == (uint8_t)0x0F))
1258 /*------------------------------------------------------------------------------------------*/
1259 #endif /* STM32F334x8 || STM32F328xx */
1260
1261 #if defined (STM32F301x8) || defined (STM32F318xx)
1262 /*---------------------------------- STM32F301x8 / STM32F318xx ------------------------------------------*/
1263 /** 
1264   * @brief   AF 0 selection  
1265   */ 
1266 #define GPIO_AF0_MCO           ((uint8_t)0x00)  /* MCO (MCO1 and MCO2) Alternate Function mapping            */
1267 #define GPIO_AF0_RTC_50Hz      ((uint8_t)0x00)  /* RTC Alternate Function mapping                                                                      */
1268 #define GPIO_AF0_TAMPER        ((uint8_t)0x00)  /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
1269 #define GPIO_AF0_SWJ           ((uint8_t)0x00)  /* SWJ (SWD and JTAG) Alternate Function mapping             */
1270 #define GPIO_AF0_TRACE         ((uint8_t)0x00)  /* TRACE Alternate Function mapping                          */
1271
1272 /** 
1273   * @brief   AF 1 selection  
1274   */ 
1275 #define GPIO_AF1_TIM2           ((uint8_t)0x01)  /* TIM2 Alternate Function mapping */
1276 #define GPIO_AF1_TIM15          ((uint8_t)0x01)  /* TIM15 Alternate Function mapping */
1277 #define GPIO_AF1_TIM16          ((uint8_t)0x01)  /* TIM16 Alternate Function mapping */
1278 #define GPIO_AF1_TIM17          ((uint8_t)0x01)  /* TIM17 Alternate Function mapping */
1279 #define GPIO_AF1_EVENTOUT       ((uint8_t)0x01)  /* EVENTOUT Alternate Function mapping */
1280 /** 
1281   * @brief   AF 2 selection  
1282   */ 
1283 #define GPIO_AF2_I2C3           ((uint8_t)0x02)  /* I2C3 Alternate Function mapping */
1284 #define GPIO_AF2_TIM1           ((uint8_t)0x02)  /* TIM1 Alternate Function mapping */
1285 #define GPIO_AF2_TIM15          ((uint8_t)0x02)  /* TIM15 Alternate Function mapping */
1286 #define GPIO_AF2_TIM2           ((uint8_t)0x02)  /* TIM2 Alternate Function mapping */
1287
1288 /** 
1289   * @brief   AF 3 selection  
1290   */ 
1291 #define GPIO_AF3_TSC           ((uint8_t)0x03)  /* TSC Alternate Function mapping  */
1292 #define GPIO_AF3_I2C3          ((uint8_t)0x03)  /* I2C3 Alternate Function mapping  */
1293 #define GPIO_AF3_TIM15         ((uint8_t)0x03)  /* TIM15 Alternate Function mapping  */
1294
1295 /** 
1296   * @brief   AF 4 selection  
1297   */ 
1298 #define GPIO_AF4_I2C1          ((uint8_t)0x04)  /* I2C1 Alternate Function mapping */
1299 #define GPIO_AF4_I2C2          ((uint8_t)0x04)  /* I2C2 Alternate Function mapping */
1300 #define GPIO_AF4_TIM1          ((uint8_t)0x04)  /* TIM1 Alternate Function mapping */
1301 #define GPIO_AF4_TIM16         ((uint8_t)0x04)  /* TIM16 Alternate Function mapping */
1302 #define GPIO_AF4_TIM17         ((uint8_t)0x04)  /* TIM17 Alternate Function mapping */
1303
1304 /** 
1305   * @brief   AF 5 selection  
1306   */ 
1307 #define GPIO_AF5_SPI1          ((uint8_t)0x05)  /* SPI1 Alternate Function mapping */
1308 #define GPIO_AF5_SPI2          ((uint8_t)0x05)  /* SPI2/I2S2 Alternate Function mapping */
1309 #define GPIO_AF5_SPI3          ((uint8_t)0x05)  /* SPI3/I2S3 Alternate Function mapping */
1310 #define GPIO_AF5_IR            ((uint8_t)0x05)  /* IR Alternate Function mapping */
1311 /** 
1312   * @brief   AF 6 selection  
1313   */ 
1314 #define GPIO_AF6_TIM1          ((uint8_t)0x06)  /* TIM1 Alternate Function mapping */
1315 #define GPIO_AF6_IR            ((uint8_t)0x06)  /* IR Alternate Function mapping */
1316 #define GPIO_AF6_SPI2          ((uint8_t)0x06)  /* SPI2/I2S2 Alternate Function mapping */
1317 #define GPIO_AF6_SPI3          ((uint8_t)0x06)  /* SPI3/I2S3 Alternate Function mapping */
1318
1319 /** 
1320   * @brief   AF 7 selection  
1321   */ 
1322 #define GPIO_AF7_USART1        ((uint8_t)0x07)  /* USART1 Alternate Function mapping  */
1323 #define GPIO_AF7_USART2        ((uint8_t)0x07)  /* USART2 Alternate Function mapping  */
1324 #define GPIO_AF7_USART3        ((uint8_t)0x07)  /* USART3 Alternate Function mapping  */
1325 #define GPIO_AF7_GPCOMP6       ((uint8_t)0x07)  /* GPCOMP6 Alternate Function mapping  */
1326
1327 /** 
1328   * @brief   AF 8 selection  
1329   */ 
1330 #define GPIO_AF8_I2C3            ((uint8_t)0x08)  /* I2C3 Alternate Function mapping  */
1331 #define GPIO_AF8_GPCOMP2         ((uint8_t)0x08)  /* GPCOMP2 Alternate Function mapping  */
1332 #define GPIO_AF8_GPCOMP4         ((uint8_t)0x08)  /* GPCOMP4 Alternate Function mapping  */
1333 #define GPIO_AF8_GPCOMP6         ((uint8_t)0x08)  /* GPCOMP6 Alternate Function mapping  */
1334
1335 /** 
1336   * @brief   AF 9 selection 
1337   */ 
1338 #define GPIO_AF9_TIM1          ((uint8_t)0x09)  /* TIM1 Alternate Function mapping */
1339 #define GPIO_AF9_TIM15         ((uint8_t)0x09)  /* TIM15 Alternate Function mapping */
1340
1341 /** 
1342   * @brief   AF 10 selection  
1343   */ 
1344 #define GPIO_AF10_TIM2           ((uint8_t)0xA)  /* TIM2 Alternate Function mapping */
1345 #define GPIO_AF10_TIM17          ((uint8_t)0xA)  /* TIM17 Alternate Function mapping */
1346
1347 /** 
1348   * @brief   AF 11 selection  
1349   */ 
1350 #define GPIO_AF11_TIM1          ((uint8_t)0x0B)  /* TIM1 Alternate Function mapping */
1351
1352 /** 
1353   * @brief   AF 12 selection  
1354   */ 
1355 #define GPIO_AF12_TIM1          ((uint8_t)0x0C)  /* TIM1 Alternate Function mapping */
1356
1357 /** 
1358   * @brief   AF 15 selection  
1359   */ 
1360 #define GPIO_AF15_EVENTOUT      ((uint8_t)0x0F)  /* EVENTOUT Alternate Function mapping */
1361
1362 #define IS_GPIO_AF(AF)          (((AF) <= (uint8_t)0x0C) || ((AF) == (uint8_t)0x0F))
1363 /*------------------------------------------------------------------------------------------*/
1364 #endif /* STM32F301x8 || STM32F318xx */
1365
1366 #if defined (STM32F302x8)
1367 /*---------------------------------- STM32F302x8------------------------------------------*/
1368 /** 
1369   * @brief   AF 0 selection  
1370   */ 
1371 #define GPIO_AF0_MCO           ((uint8_t)0x00)  /* MCO (MCO1 and MCO2) Alternate Function mapping            */
1372 #define GPIO_AF0_RTC_50Hz      ((uint8_t)0x00)  /* RTC Alternate Function mapping                                                                      */
1373 #define GPIO_AF0_TAMPER        ((uint8_t)0x00)  /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
1374 #define GPIO_AF0_SWJ           ((uint8_t)0x00)  /* SWJ (SWD and JTAG) Alternate Function mapping             */
1375 #define GPIO_AF0_TRACE         ((uint8_t)0x00)  /* TRACE Alternate Function mapping                          */
1376
1377 /** 
1378   * @brief   AF 1 selection  
1379   */ 
1380 #define GPIO_AF1_TIM2           ((uint8_t)0x01)  /* TIM2 Alternate Function mapping */
1381 #define GPIO_AF1_TIM15          ((uint8_t)0x01)  /* TIM15 Alternate Function mapping */
1382 #define GPIO_AF1_TIM16          ((uint8_t)0x01)  /* TIM16 Alternate Function mapping */
1383 #define GPIO_AF1_TIM17          ((uint8_t)0x01)  /* TIM17 Alternate Function mapping */
1384 #define GPIO_AF1_EVENTOUT       ((uint8_t)0x01)  /* EVENTOUT Alternate Function mapping */
1385 /** 
1386   * @brief   AF 2 selection  
1387   */ 
1388 #define GPIO_AF2_I2C3           ((uint8_t)0x02)  /* I2C3 Alternate Function mapping */
1389 #define GPIO_AF2_TIM1           ((uint8_t)0x02)  /* TIM1 Alternate Function mapping */
1390 #define GPIO_AF2_TIM15          ((uint8_t)0x02)  /* TIM15 Alternate Function mapping */
1391 #define GPIO_AF2_TIM2           ((uint8_t)0x02)  /* TIM2 Alternate Function mapping */
1392
1393 /** 
1394   * @brief   AF 3 selection  
1395   */ 
1396 #define GPIO_AF3_TSC           ((uint8_t)0x03)  /* TSC Alternate Function mapping  */
1397 #define GPIO_AF3_I2C3          ((uint8_t)0x03)  /* I2C3 Alternate Function mapping  */
1398 #define GPIO_AF3_TIM15         ((uint8_t)0x03)  /* TIM15 Alternate Function mapping  */
1399
1400 /** 
1401   * @brief   AF 4 selection  
1402   */ 
1403 #define GPIO_AF4_I2C1          ((uint8_t)0x04)  /* I2C1 Alternate Function mapping */
1404 #define GPIO_AF4_I2C2          ((uint8_t)0x04)  /* I2C2 Alternate Function mapping */
1405 #define GPIO_AF4_TIM1          ((uint8_t)0x04)  /* TIM1 Alternate Function mapping */
1406 #define GPIO_AF4_TIM16         ((uint8_t)0x04)  /* TIM16 Alternate Function mapping */
1407 #define GPIO_AF4_TIM17         ((uint8_t)0x04)  /* TIM17 Alternate Function mapping */
1408
1409 /** 
1410   * @brief   AF 5 selection  
1411   */ 
1412 #define GPIO_AF5_SPI1          ((uint8_t)0x05)  /* SPI1 Alternate Function mapping */
1413 #define GPIO_AF5_SPI2          ((uint8_t)0x05)  /* SPI2/I2S2 Alternate Function mapping */
1414 #define GPIO_AF5_SPI3          ((uint8_t)0x05)  /* SPI3/I2S3 Alternate Function mapping */
1415 #define GPIO_AF5_IR            ((uint8_t)0x05)  /* IR Alternate Function mapping */
1416 /** 
1417   * @brief   AF 6 selection  
1418   */ 
1419 #define GPIO_AF6_TIM1          ((uint8_t)0x06)  /* TIM1 Alternate Function mapping */
1420 #define GPIO_AF6_IR            ((uint8_t)0x06)  /* IR Alternate Function mapping */
1421 #define GPIO_AF6_SPI2          ((uint8_t)0x06)  /* SPI2/I2S2 Alternate Function mapping */
1422 #define GPIO_AF6_SPI3          ((uint8_t)0x06)  /* SPI3/I2S3 Alternate Function mapping */
1423
1424 /** 
1425   * @brief   AF 7 selection  
1426   */ 
1427 #define GPIO_AF7_USART1        ((uint8_t)0x07)  /* USART1 Alternate Function mapping  */
1428 #define GPIO_AF7_USART2        ((uint8_t)0x07)  /* USART2 Alternate Function mapping  */
1429 #define GPIO_AF7_USART3        ((uint8_t)0x07)  /* USART3 Alternate Function mapping  */
1430 #define GPIO_AF7_GPCOMP6       ((uint8_t)0x07)  /* GPCOMP6 Alternate Function mapping */
1431 #define GPIO_AF7_CAN           ((uint8_t)0x07)  /* CAN Alternate Function mapping */
1432
1433 /** 
1434   * @brief   AF 8 selection  
1435   */ 
1436 #define GPIO_AF8_I2C3            ((uint8_t)0x08)  /* I2C3 Alternate Function mapping  */
1437 #define GPIO_AF8_GPCOMP2         ((uint8_t)0x08)  /* GPCOMP2 Alternate Function mapping  */
1438 #define GPIO_AF8_GPCOMP4         ((uint8_t)0x08)  /* GPCOMP4 Alternate Function mapping  */
1439 #define GPIO_AF8_GPCOMP6         ((uint8_t)0x08)  /* GPCOMP6 Alternate Function mapping  */
1440
1441 /** 
1442   * @brief   AF 9 selection 
1443   */ 
1444 #define GPIO_AF9_TIM1          ((uint8_t)0x09)  /* TIM1 Alternate Function mapping */
1445 #define GPIO_AF9_TIM15         ((uint8_t)0x09)  /* TIM15 Alternate Function mapping */
1446 #define GPIO_AF9_CAN           ((uint8_t)0x09)  /* CAN Alternate Function mapping */
1447
1448 /** 
1449   * @brief   AF 10 selection  
1450   */ 
1451 #define GPIO_AF10_TIM2           ((uint8_t)0xA)  /* TIM2 Alternate Function mapping */
1452 #define GPIO_AF10_TIM17          ((uint8_t)0xA)  /* TIM17 Alternate Function mapping */
1453
1454 /** 
1455   * @brief   AF 11 selection  
1456   */ 
1457 #define GPIO_AF11_TIM1          ((uint8_t)0x0B)  /* TIM1 Alternate Function mapping */
1458
1459 /** 
1460   * @brief   AF 12 selection  
1461   */ 
1462 #define GPIO_AF12_TIM1          ((uint8_t)0x0C)  /* TIM1 Alternate Function mapping */
1463
1464 /** 
1465   * @brief   AF 15 selection  
1466   */ 
1467 #define GPIO_AF15_EVENTOUT      ((uint8_t)0x0F)  /* EVENTOUT Alternate Function mapping */
1468
1469 #define IS_GPIO_AF(AF)          (((AF) <= (uint8_t)0x0C) || ((AF) == (uint8_t)0x0F))
1470 /*------------------------------------------------------------------------------------------*/
1471 #endif /* STM32F302x8 */
1472 /**
1473   * @}
1474   */ 
1475
1476 /**
1477   * @}
1478   */
1479
1480 /* Exported macro ------------------------------------------------------------*/
1481 /* Exported functions --------------------------------------------------------*/ 
1482
1483
1484 /**
1485   * @}
1486   */ 
1487
1488 /**
1489   * @}
1490   */ 
1491   
1492 #ifdef __cplusplus
1493 }
1494 #endif
1495
1496 #endif /* __STM32F3xx_HAL_GPIO_EX_H */
1497
1498 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/