The official mbed C/C SDK provides the software platform and libraries to build your applications.

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Wed Jul 02 13:22:23 2014 +0100
Revision:
86:04dd9b1680ae
Release 86 of the mbed library

Main changes:


- bug fixes in various backends
- mbed "error" replaced by assert logic (mbed_assert)
- new ST Nucleo targets

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 86:04dd9b1680ae 1 /**
bogdanm 86:04dd9b1680ae 2 ******************************************************************************
bogdanm 86:04dd9b1680ae 3 * @file stm32f4xx_hal_gpio_ex.h
bogdanm 86:04dd9b1680ae 4 * @author MCD Application Team
bogdanm 86:04dd9b1680ae 5 * @version V1.1.0
bogdanm 86:04dd9b1680ae 6 * @date 19-June-2014
bogdanm 86:04dd9b1680ae 7 * @brief Header file of GPIO HAL Extension module.
bogdanm 86:04dd9b1680ae 8 ******************************************************************************
bogdanm 86:04dd9b1680ae 9 * @attention
bogdanm 86:04dd9b1680ae 10 *
bogdanm 86:04dd9b1680ae 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
bogdanm 86:04dd9b1680ae 12 *
bogdanm 86:04dd9b1680ae 13 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 86:04dd9b1680ae 14 * are permitted provided that the following conditions are met:
bogdanm 86:04dd9b1680ae 15 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 86:04dd9b1680ae 16 * this list of conditions and the following disclaimer.
bogdanm 86:04dd9b1680ae 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 86:04dd9b1680ae 18 * this list of conditions and the following disclaimer in the documentation
bogdanm 86:04dd9b1680ae 19 * and/or other materials provided with the distribution.
bogdanm 86:04dd9b1680ae 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 86:04dd9b1680ae 21 * may be used to endorse or promote products derived from this software
bogdanm 86:04dd9b1680ae 22 * without specific prior written permission.
bogdanm 86:04dd9b1680ae 23 *
bogdanm 86:04dd9b1680ae 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 86:04dd9b1680ae 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 86:04dd9b1680ae 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 86:04dd9b1680ae 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 86:04dd9b1680ae 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 86:04dd9b1680ae 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 86:04dd9b1680ae 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 86:04dd9b1680ae 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 86:04dd9b1680ae 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 86:04dd9b1680ae 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 86:04dd9b1680ae 34 *
bogdanm 86:04dd9b1680ae 35 ******************************************************************************
bogdanm 86:04dd9b1680ae 36 */
bogdanm 86:04dd9b1680ae 37
bogdanm 86:04dd9b1680ae 38 /* Define to prevent recursive inclusion -------------------------------------*/
bogdanm 86:04dd9b1680ae 39 #ifndef __STM32F4xx_HAL_GPIO_EX_H
bogdanm 86:04dd9b1680ae 40 #define __STM32F4xx_HAL_GPIO_EX_H
bogdanm 86:04dd9b1680ae 41
bogdanm 86:04dd9b1680ae 42 #ifdef __cplusplus
bogdanm 86:04dd9b1680ae 43 extern "C" {
bogdanm 86:04dd9b1680ae 44 #endif
bogdanm 86:04dd9b1680ae 45
bogdanm 86:04dd9b1680ae 46 /* Includes ------------------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 47 #include "stm32f4xx_hal_def.h"
bogdanm 86:04dd9b1680ae 48
bogdanm 86:04dd9b1680ae 49 /** @addtogroup STM32F4xx_HAL_Driver
bogdanm 86:04dd9b1680ae 50 * @{
bogdanm 86:04dd9b1680ae 51 */
bogdanm 86:04dd9b1680ae 52
bogdanm 86:04dd9b1680ae 53 /** @addtogroup GPIO
bogdanm 86:04dd9b1680ae 54 * @{
bogdanm 86:04dd9b1680ae 55 */
bogdanm 86:04dd9b1680ae 56
bogdanm 86:04dd9b1680ae 57 /* Exported types ------------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 58
bogdanm 86:04dd9b1680ae 59 /* Exported constants --------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 60
bogdanm 86:04dd9b1680ae 61 /** @defgroup GPIO_Exported_Constants
bogdanm 86:04dd9b1680ae 62 * @{
bogdanm 86:04dd9b1680ae 63 */
bogdanm 86:04dd9b1680ae 64
bogdanm 86:04dd9b1680ae 65 /** @defgroup GPIO_Alternat_function_selection
bogdanm 86:04dd9b1680ae 66 * @{
bogdanm 86:04dd9b1680ae 67 */
bogdanm 86:04dd9b1680ae 68
bogdanm 86:04dd9b1680ae 69 /*------------------------- STM32F429xx/STM32F439xx---------------------------*/
bogdanm 86:04dd9b1680ae 70 #if defined (STM32F429xx) || defined (STM32F439xx)
bogdanm 86:04dd9b1680ae 71 /**
bogdanm 86:04dd9b1680ae 72 * @brief AF 0 selection
bogdanm 86:04dd9b1680ae 73 */
bogdanm 86:04dd9b1680ae 74 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
bogdanm 86:04dd9b1680ae 75 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
bogdanm 86:04dd9b1680ae 76 #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
bogdanm 86:04dd9b1680ae 77 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
bogdanm 86:04dd9b1680ae 78 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
bogdanm 86:04dd9b1680ae 79
bogdanm 86:04dd9b1680ae 80 /**
bogdanm 86:04dd9b1680ae 81 * @brief AF 1 selection
bogdanm 86:04dd9b1680ae 82 */
bogdanm 86:04dd9b1680ae 83 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 84 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 85
bogdanm 86:04dd9b1680ae 86 /**
bogdanm 86:04dd9b1680ae 87 * @brief AF 2 selection
bogdanm 86:04dd9b1680ae 88 */
bogdanm 86:04dd9b1680ae 89 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 90 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 91 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 92
bogdanm 86:04dd9b1680ae 93 /**
bogdanm 86:04dd9b1680ae 94 * @brief AF 3 selection
bogdanm 86:04dd9b1680ae 95 */
bogdanm 86:04dd9b1680ae 96 #define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 97 #define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 98 #define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 99 #define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 100
bogdanm 86:04dd9b1680ae 101 /**
bogdanm 86:04dd9b1680ae 102 * @brief AF 4 selection
bogdanm 86:04dd9b1680ae 103 */
bogdanm 86:04dd9b1680ae 104 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 105 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 106 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 107
bogdanm 86:04dd9b1680ae 108 /**
bogdanm 86:04dd9b1680ae 109 * @brief AF 5 selection
bogdanm 86:04dd9b1680ae 110 */
bogdanm 86:04dd9b1680ae 111 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 112 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 113 #define GPIO_AF5_SPI4 ((uint8_t)0x05) /* SPI4 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 114 #define GPIO_AF5_SPI5 ((uint8_t)0x05) /* SPI5 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 115 #define GPIO_AF5_SPI6 ((uint8_t)0x05) /* SPI6 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 116 #define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */
bogdanm 86:04dd9b1680ae 117
bogdanm 86:04dd9b1680ae 118 /**
bogdanm 86:04dd9b1680ae 119 * @brief AF 6 selection
bogdanm 86:04dd9b1680ae 120 */
bogdanm 86:04dd9b1680ae 121 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 122 #define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */
bogdanm 86:04dd9b1680ae 123 #define GPIO_AF6_SAI1 ((uint8_t)0x06) /* SAI1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 124
bogdanm 86:04dd9b1680ae 125 /**
bogdanm 86:04dd9b1680ae 126 * @brief AF 7 selection
bogdanm 86:04dd9b1680ae 127 */
bogdanm 86:04dd9b1680ae 128 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 129 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 130 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 131 #define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */
bogdanm 86:04dd9b1680ae 132
bogdanm 86:04dd9b1680ae 133 /**
bogdanm 86:04dd9b1680ae 134 * @brief AF 8 selection
bogdanm 86:04dd9b1680ae 135 */
bogdanm 86:04dd9b1680ae 136 #define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 137 #define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 138 #define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 139 #define GPIO_AF8_UART7 ((uint8_t)0x08) /* UART7 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 140 #define GPIO_AF8_UART8 ((uint8_t)0x08) /* UART8 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 141
bogdanm 86:04dd9b1680ae 142 /**
bogdanm 86:04dd9b1680ae 143 * @brief AF 9 selection
bogdanm 86:04dd9b1680ae 144 */
bogdanm 86:04dd9b1680ae 145 #define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 146 #define GPIO_AF9_CAN2 ((uint8_t)0x09) /* CAN2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 147 #define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 148 #define GPIO_AF9_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 149 #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 150 #define GPIO_AF9_LTDC ((uint8_t)0x09) /* LCD-TFT Alternate Function mapping */
bogdanm 86:04dd9b1680ae 151
bogdanm 86:04dd9b1680ae 152 /**
bogdanm 86:04dd9b1680ae 153 * @brief AF 10 selection
bogdanm 86:04dd9b1680ae 154 */
bogdanm 86:04dd9b1680ae 155 #define GPIO_AF10_OTG_FS ((uint8_t)0xA) /* OTG_FS Alternate Function mapping */
bogdanm 86:04dd9b1680ae 156 #define GPIO_AF10_OTG_HS ((uint8_t)0xA) /* OTG_HS Alternate Function mapping */
bogdanm 86:04dd9b1680ae 157
bogdanm 86:04dd9b1680ae 158 /**
bogdanm 86:04dd9b1680ae 159 * @brief AF 11 selection
bogdanm 86:04dd9b1680ae 160 */
bogdanm 86:04dd9b1680ae 161 #define GPIO_AF11_ETH ((uint8_t)0x0B) /* ETHERNET Alternate Function mapping */
bogdanm 86:04dd9b1680ae 162
bogdanm 86:04dd9b1680ae 163 /**
bogdanm 86:04dd9b1680ae 164 * @brief AF 12 selection
bogdanm 86:04dd9b1680ae 165 */
bogdanm 86:04dd9b1680ae 166 #define GPIO_AF12_FMC ((uint8_t)0xC) /* FMC Alternate Function mapping */
bogdanm 86:04dd9b1680ae 167 #define GPIO_AF12_OTG_HS_FS ((uint8_t)0xC) /* OTG HS configured in FS, Alternate Function mapping */
bogdanm 86:04dd9b1680ae 168 #define GPIO_AF12_SDIO ((uint8_t)0xC) /* SDIO Alternate Function mapping */
bogdanm 86:04dd9b1680ae 169
bogdanm 86:04dd9b1680ae 170 /**
bogdanm 86:04dd9b1680ae 171 * @brief AF 13 selection
bogdanm 86:04dd9b1680ae 172 */
bogdanm 86:04dd9b1680ae 173 #define GPIO_AF13_DCMI ((uint8_t)0x0D) /* DCMI Alternate Function mapping */
bogdanm 86:04dd9b1680ae 174
bogdanm 86:04dd9b1680ae 175 /**
bogdanm 86:04dd9b1680ae 176 * @brief AF 14 selection
bogdanm 86:04dd9b1680ae 177 */
bogdanm 86:04dd9b1680ae 178 #define GPIO_AF14_LTDC ((uint8_t)0x0E) /* LCD-TFT Alternate Function mapping */
bogdanm 86:04dd9b1680ae 179
bogdanm 86:04dd9b1680ae 180 /**
bogdanm 86:04dd9b1680ae 181 * @brief AF 15 selection
bogdanm 86:04dd9b1680ae 182 */
bogdanm 86:04dd9b1680ae 183 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
bogdanm 86:04dd9b1680ae 184
bogdanm 86:04dd9b1680ae 185 #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \
bogdanm 86:04dd9b1680ae 186 ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \
bogdanm 86:04dd9b1680ae 187 ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
bogdanm 86:04dd9b1680ae 188 ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \
bogdanm 86:04dd9b1680ae 189 ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
bogdanm 86:04dd9b1680ae 190 ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \
bogdanm 86:04dd9b1680ae 191 ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \
bogdanm 86:04dd9b1680ae 192 ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF5_SPI1) || \
bogdanm 86:04dd9b1680ae 193 ((AF) == GPIO_AF5_SPI2) || ((AF) == GPIO_AF9_TIM13) || \
bogdanm 86:04dd9b1680ae 194 ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF9_TIM12) || \
bogdanm 86:04dd9b1680ae 195 ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
bogdanm 86:04dd9b1680ae 196 ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF8_UART4) || \
bogdanm 86:04dd9b1680ae 197 ((AF) == GPIO_AF8_UART5) || ((AF) == GPIO_AF8_USART6) || \
bogdanm 86:04dd9b1680ae 198 ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \
bogdanm 86:04dd9b1680ae 199 ((AF) == GPIO_AF10_OTG_FS) || ((AF) == GPIO_AF10_OTG_HS) || \
bogdanm 86:04dd9b1680ae 200 ((AF) == GPIO_AF11_ETH) || ((AF) == GPIO_AF12_OTG_HS_FS) || \
bogdanm 86:04dd9b1680ae 201 ((AF) == GPIO_AF12_SDIO) || ((AF) == GPIO_AF13_DCMI) || \
bogdanm 86:04dd9b1680ae 202 ((AF) == GPIO_AF15_EVENTOUT) || ((AF) == GPIO_AF5_SPI4) || \
bogdanm 86:04dd9b1680ae 203 ((AF) == GPIO_AF5_SPI5) || ((AF) == GPIO_AF5_SPI6) || \
bogdanm 86:04dd9b1680ae 204 ((AF) == GPIO_AF8_UART7) || ((AF) == GPIO_AF8_UART8) || \
bogdanm 86:04dd9b1680ae 205 ((AF) == GPIO_AF12_FMC) || ((AF) == GPIO_AF6_SAI1) || \
bogdanm 86:04dd9b1680ae 206 ((AF) == GPIO_AF14_LTDC))
bogdanm 86:04dd9b1680ae 207
bogdanm 86:04dd9b1680ae 208 #endif /* STM32F429xx || STM32F439xx */
bogdanm 86:04dd9b1680ae 209 /*------------------------------------------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 210
bogdanm 86:04dd9b1680ae 211 /*---------------------------------- STM32F427xx/STM32F437xx--------------------------------*/
bogdanm 86:04dd9b1680ae 212 #if defined (STM32F427xx) || defined (STM32F437xx)
bogdanm 86:04dd9b1680ae 213 /**
bogdanm 86:04dd9b1680ae 214 * @brief AF 0 selection
bogdanm 86:04dd9b1680ae 215 */
bogdanm 86:04dd9b1680ae 216 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
bogdanm 86:04dd9b1680ae 217 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
bogdanm 86:04dd9b1680ae 218 #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
bogdanm 86:04dd9b1680ae 219 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
bogdanm 86:04dd9b1680ae 220 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
bogdanm 86:04dd9b1680ae 221
bogdanm 86:04dd9b1680ae 222 /**
bogdanm 86:04dd9b1680ae 223 * @brief AF 1 selection
bogdanm 86:04dd9b1680ae 224 */
bogdanm 86:04dd9b1680ae 225 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 226 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 227
bogdanm 86:04dd9b1680ae 228 /**
bogdanm 86:04dd9b1680ae 229 * @brief AF 2 selection
bogdanm 86:04dd9b1680ae 230 */
bogdanm 86:04dd9b1680ae 231 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 232 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 233 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 234
bogdanm 86:04dd9b1680ae 235 /**
bogdanm 86:04dd9b1680ae 236 * @brief AF 3 selection
bogdanm 86:04dd9b1680ae 237 */
bogdanm 86:04dd9b1680ae 238 #define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 239 #define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 240 #define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 241 #define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 242
bogdanm 86:04dd9b1680ae 243 /**
bogdanm 86:04dd9b1680ae 244 * @brief AF 4 selection
bogdanm 86:04dd9b1680ae 245 */
bogdanm 86:04dd9b1680ae 246 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 247 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 248 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 249
bogdanm 86:04dd9b1680ae 250 /**
bogdanm 86:04dd9b1680ae 251 * @brief AF 5 selection
bogdanm 86:04dd9b1680ae 252 */
bogdanm 86:04dd9b1680ae 253 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 254 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 255 #define GPIO_AF5_SPI4 ((uint8_t)0x05) /* SPI4 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 256 #define GPIO_AF5_SPI5 ((uint8_t)0x05) /* SPI5 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 257 #define GPIO_AF5_SPI6 ((uint8_t)0x05) /* SPI6 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 258 #define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */
bogdanm 86:04dd9b1680ae 259
bogdanm 86:04dd9b1680ae 260 /**
bogdanm 86:04dd9b1680ae 261 * @brief AF 6 selection
bogdanm 86:04dd9b1680ae 262 */
bogdanm 86:04dd9b1680ae 263 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 264 #define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */
bogdanm 86:04dd9b1680ae 265 #define GPIO_AF6_SAI1 ((uint8_t)0x06) /* SAI1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 266
bogdanm 86:04dd9b1680ae 267 /**
bogdanm 86:04dd9b1680ae 268 * @brief AF 7 selection
bogdanm 86:04dd9b1680ae 269 */
bogdanm 86:04dd9b1680ae 270 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 271 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 272 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 273 #define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */
bogdanm 86:04dd9b1680ae 274
bogdanm 86:04dd9b1680ae 275 /**
bogdanm 86:04dd9b1680ae 276 * @brief AF 8 selection
bogdanm 86:04dd9b1680ae 277 */
bogdanm 86:04dd9b1680ae 278 #define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 279 #define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 280 #define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 281 #define GPIO_AF8_UART7 ((uint8_t)0x08) /* UART7 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 282 #define GPIO_AF8_UART8 ((uint8_t)0x08) /* UART8 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 283
bogdanm 86:04dd9b1680ae 284 /**
bogdanm 86:04dd9b1680ae 285 * @brief AF 9 selection
bogdanm 86:04dd9b1680ae 286 */
bogdanm 86:04dd9b1680ae 287 #define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 288 #define GPIO_AF9_CAN2 ((uint8_t)0x09) /* CAN2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 289 #define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 290 #define GPIO_AF9_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 291 #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 292
bogdanm 86:04dd9b1680ae 293 /**
bogdanm 86:04dd9b1680ae 294 * @brief AF 10 selection
bogdanm 86:04dd9b1680ae 295 */
bogdanm 86:04dd9b1680ae 296 #define GPIO_AF10_OTG_FS ((uint8_t)0xA) /* OTG_FS Alternate Function mapping */
bogdanm 86:04dd9b1680ae 297 #define GPIO_AF10_OTG_HS ((uint8_t)0xA) /* OTG_HS Alternate Function mapping */
bogdanm 86:04dd9b1680ae 298
bogdanm 86:04dd9b1680ae 299 /**
bogdanm 86:04dd9b1680ae 300 * @brief AF 11 selection
bogdanm 86:04dd9b1680ae 301 */
bogdanm 86:04dd9b1680ae 302 #define GPIO_AF11_ETH ((uint8_t)0x0B) /* ETHERNET Alternate Function mapping */
bogdanm 86:04dd9b1680ae 303
bogdanm 86:04dd9b1680ae 304 /**
bogdanm 86:04dd9b1680ae 305 * @brief AF 12 selection
bogdanm 86:04dd9b1680ae 306 */
bogdanm 86:04dd9b1680ae 307 #define GPIO_AF12_FMC ((uint8_t)0xC) /* FMC Alternate Function mapping */
bogdanm 86:04dd9b1680ae 308 #define GPIO_AF12_OTG_HS_FS ((uint8_t)0xC) /* OTG HS configured in FS, Alternate Function mapping */
bogdanm 86:04dd9b1680ae 309 #define GPIO_AF12_SDIO ((uint8_t)0xC) /* SDIO Alternate Function mapping */
bogdanm 86:04dd9b1680ae 310
bogdanm 86:04dd9b1680ae 311 /**
bogdanm 86:04dd9b1680ae 312 * @brief AF 13 selection
bogdanm 86:04dd9b1680ae 313 */
bogdanm 86:04dd9b1680ae 314 #define GPIO_AF13_DCMI ((uint8_t)0x0D) /* DCMI Alternate Function mapping */
bogdanm 86:04dd9b1680ae 315
bogdanm 86:04dd9b1680ae 316 /**
bogdanm 86:04dd9b1680ae 317 * @brief AF 15 selection
bogdanm 86:04dd9b1680ae 318 */
bogdanm 86:04dd9b1680ae 319 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
bogdanm 86:04dd9b1680ae 320
bogdanm 86:04dd9b1680ae 321 #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \
bogdanm 86:04dd9b1680ae 322 ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \
bogdanm 86:04dd9b1680ae 323 ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
bogdanm 86:04dd9b1680ae 324 ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \
bogdanm 86:04dd9b1680ae 325 ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
bogdanm 86:04dd9b1680ae 326 ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \
bogdanm 86:04dd9b1680ae 327 ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \
bogdanm 86:04dd9b1680ae 328 ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF5_SPI1) || \
bogdanm 86:04dd9b1680ae 329 ((AF) == GPIO_AF5_SPI2) || ((AF) == GPIO_AF9_TIM13) || \
bogdanm 86:04dd9b1680ae 330 ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF9_TIM12) || \
bogdanm 86:04dd9b1680ae 331 ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
bogdanm 86:04dd9b1680ae 332 ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF8_UART4) || \
bogdanm 86:04dd9b1680ae 333 ((AF) == GPIO_AF8_UART5) || ((AF) == GPIO_AF8_USART6) || \
bogdanm 86:04dd9b1680ae 334 ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \
bogdanm 86:04dd9b1680ae 335 ((AF) == GPIO_AF10_OTG_FS) || ((AF) == GPIO_AF10_OTG_HS) || \
bogdanm 86:04dd9b1680ae 336 ((AF) == GPIO_AF11_ETH) || ((AF) == GPIO_AF12_OTG_HS_FS) || \
bogdanm 86:04dd9b1680ae 337 ((AF) == GPIO_AF12_SDIO) || ((AF) == GPIO_AF13_DCMI) || \
bogdanm 86:04dd9b1680ae 338 ((AF) == GPIO_AF15_EVENTOUT) || ((AF) == GPIO_AF5_SPI4) || \
bogdanm 86:04dd9b1680ae 339 ((AF) == GPIO_AF5_SPI5) || ((AF) == GPIO_AF5_SPI6) || \
bogdanm 86:04dd9b1680ae 340 ((AF) == GPIO_AF8_UART7) || ((AF) == GPIO_AF8_UART8) || \
bogdanm 86:04dd9b1680ae 341 ((AF) == GPIO_AF12_FMC) || ((AF) == GPIO_AF6_SAI1))
bogdanm 86:04dd9b1680ae 342
bogdanm 86:04dd9b1680ae 343 #endif /* STM32F427xx || STM32F437xx */
bogdanm 86:04dd9b1680ae 344 /*------------------------------------------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 345
bogdanm 86:04dd9b1680ae 346 /*---------------------------------- STM32F407xx/STM32F417xx--------------------------------*/
bogdanm 86:04dd9b1680ae 347 #if defined (STM32F407xx) || defined (STM32F417xx)
bogdanm 86:04dd9b1680ae 348 /**
bogdanm 86:04dd9b1680ae 349 * @brief AF 0 selection
bogdanm 86:04dd9b1680ae 350 */
bogdanm 86:04dd9b1680ae 351 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
bogdanm 86:04dd9b1680ae 352 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
bogdanm 86:04dd9b1680ae 353 #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
bogdanm 86:04dd9b1680ae 354 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
bogdanm 86:04dd9b1680ae 355 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
bogdanm 86:04dd9b1680ae 356
bogdanm 86:04dd9b1680ae 357 /**
bogdanm 86:04dd9b1680ae 358 * @brief AF 1 selection
bogdanm 86:04dd9b1680ae 359 */
bogdanm 86:04dd9b1680ae 360 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 361 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 362
bogdanm 86:04dd9b1680ae 363 /**
bogdanm 86:04dd9b1680ae 364 * @brief AF 2 selection
bogdanm 86:04dd9b1680ae 365 */
bogdanm 86:04dd9b1680ae 366 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 367 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 368 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 369
bogdanm 86:04dd9b1680ae 370 /**
bogdanm 86:04dd9b1680ae 371 * @brief AF 3 selection
bogdanm 86:04dd9b1680ae 372 */
bogdanm 86:04dd9b1680ae 373 #define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 374 #define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 375 #define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 376 #define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 377
bogdanm 86:04dd9b1680ae 378 /**
bogdanm 86:04dd9b1680ae 379 * @brief AF 4 selection
bogdanm 86:04dd9b1680ae 380 */
bogdanm 86:04dd9b1680ae 381 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 382 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 383 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 384
bogdanm 86:04dd9b1680ae 385 /**
bogdanm 86:04dd9b1680ae 386 * @brief AF 5 selection
bogdanm 86:04dd9b1680ae 387 */
bogdanm 86:04dd9b1680ae 388 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 389 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 390 #define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */
bogdanm 86:04dd9b1680ae 391
bogdanm 86:04dd9b1680ae 392 /**
bogdanm 86:04dd9b1680ae 393 * @brief AF 6 selection
bogdanm 86:04dd9b1680ae 394 */
bogdanm 86:04dd9b1680ae 395 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 396 #define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */
bogdanm 86:04dd9b1680ae 397
bogdanm 86:04dd9b1680ae 398 /**
bogdanm 86:04dd9b1680ae 399 * @brief AF 7 selection
bogdanm 86:04dd9b1680ae 400 */
bogdanm 86:04dd9b1680ae 401 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 402 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 403 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 404 #define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */
bogdanm 86:04dd9b1680ae 405
bogdanm 86:04dd9b1680ae 406 /**
bogdanm 86:04dd9b1680ae 407 * @brief AF 8 selection
bogdanm 86:04dd9b1680ae 408 */
bogdanm 86:04dd9b1680ae 409 #define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 410 #define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 411 #define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 412
bogdanm 86:04dd9b1680ae 413 /**
bogdanm 86:04dd9b1680ae 414 * @brief AF 9 selection
bogdanm 86:04dd9b1680ae 415 */
bogdanm 86:04dd9b1680ae 416 #define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 417 #define GPIO_AF9_CAN2 ((uint8_t)0x09) /* CAN2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 418 #define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 419 #define GPIO_AF9_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 420 #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 421
bogdanm 86:04dd9b1680ae 422 /**
bogdanm 86:04dd9b1680ae 423 * @brief AF 10 selection
bogdanm 86:04dd9b1680ae 424 */
bogdanm 86:04dd9b1680ae 425 #define GPIO_AF10_OTG_FS ((uint8_t)0xA) /* OTG_FS Alternate Function mapping */
bogdanm 86:04dd9b1680ae 426 #define GPIO_AF10_OTG_HS ((uint8_t)0xA) /* OTG_HS Alternate Function mapping */
bogdanm 86:04dd9b1680ae 427
bogdanm 86:04dd9b1680ae 428 /**
bogdanm 86:04dd9b1680ae 429 * @brief AF 11 selection
bogdanm 86:04dd9b1680ae 430 */
bogdanm 86:04dd9b1680ae 431 #define GPIO_AF11_ETH ((uint8_t)0x0B) /* ETHERNET Alternate Function mapping */
bogdanm 86:04dd9b1680ae 432
bogdanm 86:04dd9b1680ae 433 /**
bogdanm 86:04dd9b1680ae 434 * @brief AF 12 selection
bogdanm 86:04dd9b1680ae 435 */
bogdanm 86:04dd9b1680ae 436 #define GPIO_AF12_FSMC ((uint8_t)0xC) /* FSMC Alternate Function mapping */
bogdanm 86:04dd9b1680ae 437 #define GPIO_AF12_OTG_HS_FS ((uint8_t)0xC) /* OTG HS configured in FS, Alternate Function mapping */
bogdanm 86:04dd9b1680ae 438 #define GPIO_AF12_SDIO ((uint8_t)0xC) /* SDIO Alternate Function mapping */
bogdanm 86:04dd9b1680ae 439
bogdanm 86:04dd9b1680ae 440 /**
bogdanm 86:04dd9b1680ae 441 * @brief AF 13 selection
bogdanm 86:04dd9b1680ae 442 */
bogdanm 86:04dd9b1680ae 443 #define GPIO_AF13_DCMI ((uint8_t)0x0D) /* DCMI Alternate Function mapping */
bogdanm 86:04dd9b1680ae 444
bogdanm 86:04dd9b1680ae 445 /**
bogdanm 86:04dd9b1680ae 446 * @brief AF 15 selection
bogdanm 86:04dd9b1680ae 447 */
bogdanm 86:04dd9b1680ae 448 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
bogdanm 86:04dd9b1680ae 449
bogdanm 86:04dd9b1680ae 450 #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \
bogdanm 86:04dd9b1680ae 451 ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \
bogdanm 86:04dd9b1680ae 452 ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
bogdanm 86:04dd9b1680ae 453 ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \
bogdanm 86:04dd9b1680ae 454 ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
bogdanm 86:04dd9b1680ae 455 ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \
bogdanm 86:04dd9b1680ae 456 ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \
bogdanm 86:04dd9b1680ae 457 ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF5_SPI1) || \
bogdanm 86:04dd9b1680ae 458 ((AF) == GPIO_AF5_SPI2) || ((AF) == GPIO_AF9_TIM13) || \
bogdanm 86:04dd9b1680ae 459 ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF9_TIM12) || \
bogdanm 86:04dd9b1680ae 460 ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
bogdanm 86:04dd9b1680ae 461 ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF8_UART4) || \
bogdanm 86:04dd9b1680ae 462 ((AF) == GPIO_AF8_UART5) || ((AF) == GPIO_AF8_USART6) || \
bogdanm 86:04dd9b1680ae 463 ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \
bogdanm 86:04dd9b1680ae 464 ((AF) == GPIO_AF10_OTG_FS) || ((AF) == GPIO_AF10_OTG_HS) || \
bogdanm 86:04dd9b1680ae 465 ((AF) == GPIO_AF11_ETH) || ((AF) == GPIO_AF12_OTG_HS_FS) || \
bogdanm 86:04dd9b1680ae 466 ((AF) == GPIO_AF12_SDIO) || ((AF) == GPIO_AF13_DCMI) || \
bogdanm 86:04dd9b1680ae 467 ((AF) == GPIO_AF12_FSMC) || ((AF) == GPIO_AF15_EVENTOUT))
bogdanm 86:04dd9b1680ae 468
bogdanm 86:04dd9b1680ae 469 #endif /* STM32F407xx || STM32F417xx */
bogdanm 86:04dd9b1680ae 470 /*------------------------------------------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 471
bogdanm 86:04dd9b1680ae 472 /*---------------------------------- STM32F405xx/STM32F415xx--------------------------------*/
bogdanm 86:04dd9b1680ae 473 #if defined (STM32F405xx) || defined (STM32F415xx)
bogdanm 86:04dd9b1680ae 474 /**
bogdanm 86:04dd9b1680ae 475 * @brief AF 0 selection
bogdanm 86:04dd9b1680ae 476 */
bogdanm 86:04dd9b1680ae 477 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
bogdanm 86:04dd9b1680ae 478 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
bogdanm 86:04dd9b1680ae 479 #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
bogdanm 86:04dd9b1680ae 480 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
bogdanm 86:04dd9b1680ae 481 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
bogdanm 86:04dd9b1680ae 482
bogdanm 86:04dd9b1680ae 483 /**
bogdanm 86:04dd9b1680ae 484 * @brief AF 1 selection
bogdanm 86:04dd9b1680ae 485 */
bogdanm 86:04dd9b1680ae 486 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 487 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 488
bogdanm 86:04dd9b1680ae 489 /**
bogdanm 86:04dd9b1680ae 490 * @brief AF 2 selection
bogdanm 86:04dd9b1680ae 491 */
bogdanm 86:04dd9b1680ae 492 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 493 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 494 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 495
bogdanm 86:04dd9b1680ae 496 /**
bogdanm 86:04dd9b1680ae 497 * @brief AF 3 selection
bogdanm 86:04dd9b1680ae 498 */
bogdanm 86:04dd9b1680ae 499 #define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 500 #define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 501 #define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 502 #define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 503
bogdanm 86:04dd9b1680ae 504 /**
bogdanm 86:04dd9b1680ae 505 * @brief AF 4 selection
bogdanm 86:04dd9b1680ae 506 */
bogdanm 86:04dd9b1680ae 507 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 508 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 509 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 510
bogdanm 86:04dd9b1680ae 511 /**
bogdanm 86:04dd9b1680ae 512 * @brief AF 5 selection
bogdanm 86:04dd9b1680ae 513 */
bogdanm 86:04dd9b1680ae 514 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 515 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 516 #define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */
bogdanm 86:04dd9b1680ae 517
bogdanm 86:04dd9b1680ae 518 /**
bogdanm 86:04dd9b1680ae 519 * @brief AF 6 selection
bogdanm 86:04dd9b1680ae 520 */
bogdanm 86:04dd9b1680ae 521 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 522 #define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */
bogdanm 86:04dd9b1680ae 523
bogdanm 86:04dd9b1680ae 524 /**
bogdanm 86:04dd9b1680ae 525 * @brief AF 7 selection
bogdanm 86:04dd9b1680ae 526 */
bogdanm 86:04dd9b1680ae 527 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 528 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 529 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 530 #define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */
bogdanm 86:04dd9b1680ae 531
bogdanm 86:04dd9b1680ae 532 /**
bogdanm 86:04dd9b1680ae 533 * @brief AF 8 selection
bogdanm 86:04dd9b1680ae 534 */
bogdanm 86:04dd9b1680ae 535 #define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 536 #define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 537 #define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 538
bogdanm 86:04dd9b1680ae 539 /**
bogdanm 86:04dd9b1680ae 540 * @brief AF 9 selection
bogdanm 86:04dd9b1680ae 541 */
bogdanm 86:04dd9b1680ae 542 #define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 543 #define GPIO_AF9_CAN2 ((uint8_t)0x09) /* CAN2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 544 #define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 545 #define GPIO_AF9_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 546 #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 547
bogdanm 86:04dd9b1680ae 548 /**
bogdanm 86:04dd9b1680ae 549 * @brief AF 10 selection
bogdanm 86:04dd9b1680ae 550 */
bogdanm 86:04dd9b1680ae 551 #define GPIO_AF10_OTG_FS ((uint8_t)0xA) /* OTG_FS Alternate Function mapping */
bogdanm 86:04dd9b1680ae 552 #define GPIO_AF10_OTG_HS ((uint8_t)0xA) /* OTG_HS Alternate Function mapping */
bogdanm 86:04dd9b1680ae 553
bogdanm 86:04dd9b1680ae 554 /**
bogdanm 86:04dd9b1680ae 555 * @brief AF 12 selection
bogdanm 86:04dd9b1680ae 556 */
bogdanm 86:04dd9b1680ae 557 #define GPIO_AF12_FSMC ((uint8_t)0xC) /* FSMC Alternate Function mapping */
bogdanm 86:04dd9b1680ae 558 #define GPIO_AF12_OTG_HS_FS ((uint8_t)0xC) /* OTG HS configured in FS, Alternate Function mapping */
bogdanm 86:04dd9b1680ae 559 #define GPIO_AF12_SDIO ((uint8_t)0xC) /* SDIO Alternate Function mapping */
bogdanm 86:04dd9b1680ae 560
bogdanm 86:04dd9b1680ae 561 /**
bogdanm 86:04dd9b1680ae 562 * @brief AF 15 selection
bogdanm 86:04dd9b1680ae 563 */
bogdanm 86:04dd9b1680ae 564 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
bogdanm 86:04dd9b1680ae 565
bogdanm 86:04dd9b1680ae 566 #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \
bogdanm 86:04dd9b1680ae 567 ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \
bogdanm 86:04dd9b1680ae 568 ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
bogdanm 86:04dd9b1680ae 569 ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \
bogdanm 86:04dd9b1680ae 570 ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
bogdanm 86:04dd9b1680ae 571 ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF3_TIM8) || \
bogdanm 86:04dd9b1680ae 572 ((AF) == GPIO_AF4_I2C1) || ((AF) == GPIO_AF4_I2C2) || \
bogdanm 86:04dd9b1680ae 573 ((AF) == GPIO_AF4_I2C3) || ((AF) == GPIO_AF5_SPI1) || \
bogdanm 86:04dd9b1680ae 574 ((AF) == GPIO_AF5_SPI2) || ((AF) == GPIO_AF9_TIM13) || \
bogdanm 86:04dd9b1680ae 575 ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF9_TIM12) || \
bogdanm 86:04dd9b1680ae 576 ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
bogdanm 86:04dd9b1680ae 577 ((AF) == GPIO_AF7_USART3) || ((AF) == GPIO_AF8_UART4) || \
bogdanm 86:04dd9b1680ae 578 ((AF) == GPIO_AF8_UART5) || ((AF) == GPIO_AF8_USART6) || \
bogdanm 86:04dd9b1680ae 579 ((AF) == GPIO_AF9_CAN1) || ((AF) == GPIO_AF9_CAN2) || \
bogdanm 86:04dd9b1680ae 580 ((AF) == GPIO_AF10_OTG_FS) || ((AF) == GPIO_AF10_OTG_HS) || \
bogdanm 86:04dd9b1680ae 581 ((AF) == GPIO_AF12_OTG_HS_FS) || ((AF) == GPIO_AF12_SDIO) || \
bogdanm 86:04dd9b1680ae 582 ((AF) == GPIO_AF12_FSMC) || ((AF) == GPIO_AF15_EVENTOUT))
bogdanm 86:04dd9b1680ae 583
bogdanm 86:04dd9b1680ae 584 #endif /* STM32F405xx || STM32F415xx */
bogdanm 86:04dd9b1680ae 585
bogdanm 86:04dd9b1680ae 586 /*------------------------------------------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 587
bogdanm 86:04dd9b1680ae 588 /*---------------------------------------- STM32F401xx--------------------------------------*/
bogdanm 86:04dd9b1680ae 589 #if defined(STM32F401xC) || defined(STM32F401xE)
bogdanm 86:04dd9b1680ae 590 /**
bogdanm 86:04dd9b1680ae 591 * @brief AF 0 selection
bogdanm 86:04dd9b1680ae 592 */
bogdanm 86:04dd9b1680ae 593 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
bogdanm 86:04dd9b1680ae 594 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
bogdanm 86:04dd9b1680ae 595 #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
bogdanm 86:04dd9b1680ae 596 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
bogdanm 86:04dd9b1680ae 597 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
bogdanm 86:04dd9b1680ae 598
bogdanm 86:04dd9b1680ae 599 /**
bogdanm 86:04dd9b1680ae 600 * @brief AF 1 selection
bogdanm 86:04dd9b1680ae 601 */
bogdanm 86:04dd9b1680ae 602 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 603 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 604
bogdanm 86:04dd9b1680ae 605 /**
bogdanm 86:04dd9b1680ae 606 * @brief AF 2 selection
bogdanm 86:04dd9b1680ae 607 */
bogdanm 86:04dd9b1680ae 608 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 609 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 610 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 611
bogdanm 86:04dd9b1680ae 612 /**
bogdanm 86:04dd9b1680ae 613 * @brief AF 3 selection
bogdanm 86:04dd9b1680ae 614 */
bogdanm 86:04dd9b1680ae 615 #define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 616 #define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 617 #define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 618
bogdanm 86:04dd9b1680ae 619 /**
bogdanm 86:04dd9b1680ae 620 * @brief AF 4 selection
bogdanm 86:04dd9b1680ae 621 */
bogdanm 86:04dd9b1680ae 622 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 623 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 624 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 625
bogdanm 86:04dd9b1680ae 626 /**
bogdanm 86:04dd9b1680ae 627 * @brief AF 5 selection
bogdanm 86:04dd9b1680ae 628 */
bogdanm 86:04dd9b1680ae 629 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 630 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 631 #define GPIO_AF5_SPI4 ((uint8_t)0x05) /* SPI4 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 632 #define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */
bogdanm 86:04dd9b1680ae 633
bogdanm 86:04dd9b1680ae 634 /**
bogdanm 86:04dd9b1680ae 635 * @brief AF 6 selection
bogdanm 86:04dd9b1680ae 636 */
bogdanm 86:04dd9b1680ae 637 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 638 #define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */
bogdanm 86:04dd9b1680ae 639
bogdanm 86:04dd9b1680ae 640 /**
bogdanm 86:04dd9b1680ae 641 * @brief AF 7 selection
bogdanm 86:04dd9b1680ae 642 */
bogdanm 86:04dd9b1680ae 643 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 644 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 645 #define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */
bogdanm 86:04dd9b1680ae 646
bogdanm 86:04dd9b1680ae 647 /**
bogdanm 86:04dd9b1680ae 648 * @brief AF 8 selection
bogdanm 86:04dd9b1680ae 649 */
bogdanm 86:04dd9b1680ae 650 #define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 651
bogdanm 86:04dd9b1680ae 652 /**
bogdanm 86:04dd9b1680ae 653 * @brief AF 9 selection
bogdanm 86:04dd9b1680ae 654 */
bogdanm 86:04dd9b1680ae 655 #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 656 #define GPIO_AF9_I2C2 ((uint8_t)0x09) /* I2C2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 657 #define GPIO_AF9_I2C3 ((uint8_t)0x09) /* I2C3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 658
bogdanm 86:04dd9b1680ae 659
bogdanm 86:04dd9b1680ae 660 /**
bogdanm 86:04dd9b1680ae 661 * @brief AF 10 selection
bogdanm 86:04dd9b1680ae 662 */
bogdanm 86:04dd9b1680ae 663 #define GPIO_AF10_OTG_FS ((uint8_t)0xA) /* OTG_FS Alternate Function mapping */
bogdanm 86:04dd9b1680ae 664
bogdanm 86:04dd9b1680ae 665 /**
bogdanm 86:04dd9b1680ae 666 * @brief AF 12 selection
bogdanm 86:04dd9b1680ae 667 */
bogdanm 86:04dd9b1680ae 668 #define GPIO_AF12_SDIO ((uint8_t)0xC) /* SDIO Alternate Function mapping */
bogdanm 86:04dd9b1680ae 669
bogdanm 86:04dd9b1680ae 670 /**
bogdanm 86:04dd9b1680ae 671 * @brief AF 15 selection
bogdanm 86:04dd9b1680ae 672 */
bogdanm 86:04dd9b1680ae 673 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
bogdanm 86:04dd9b1680ae 674
bogdanm 86:04dd9b1680ae 675 #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \
bogdanm 86:04dd9b1680ae 676 ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \
bogdanm 86:04dd9b1680ae 677 ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
bogdanm 86:04dd9b1680ae 678 ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \
bogdanm 86:04dd9b1680ae 679 ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
bogdanm 86:04dd9b1680ae 680 ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF4_I2C1) || \
bogdanm 86:04dd9b1680ae 681 ((AF) == GPIO_AF4_I2C2) || ((AF) == GPIO_AF4_I2C3) || \
bogdanm 86:04dd9b1680ae 682 ((AF) == GPIO_AF5_SPI1) || ((AF) == GPIO_AF5_SPI2) || \
bogdanm 86:04dd9b1680ae 683 ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF5_SPI4) || \
bogdanm 86:04dd9b1680ae 684 ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
bogdanm 86:04dd9b1680ae 685 ((AF) == GPIO_AF8_USART6) || ((AF) == GPIO_AF10_OTG_FS) || \
bogdanm 86:04dd9b1680ae 686 ((AF) == GPIO_AF9_I2C2) || ((AF) == GPIO_AF9_I2C3) || \
bogdanm 86:04dd9b1680ae 687 ((AF) == GPIO_AF12_SDIO) || ((AF) == GPIO_AF15_EVENTOUT))
bogdanm 86:04dd9b1680ae 688
bogdanm 86:04dd9b1680ae 689 #endif /* STM32F401xC || STM32F401xE */
bogdanm 86:04dd9b1680ae 690 /*------------------------------------------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 691
bogdanm 86:04dd9b1680ae 692 /*---------------------------------------- STM32F411xx--------------------------------------*/
bogdanm 86:04dd9b1680ae 693 #if defined(STM32F411xE)
bogdanm 86:04dd9b1680ae 694 /**
bogdanm 86:04dd9b1680ae 695 * @brief AF 0 selection
bogdanm 86:04dd9b1680ae 696 */
bogdanm 86:04dd9b1680ae 697 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */
bogdanm 86:04dd9b1680ae 698 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */
bogdanm 86:04dd9b1680ae 699 #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */
bogdanm 86:04dd9b1680ae 700 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */
bogdanm 86:04dd9b1680ae 701 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */
bogdanm 86:04dd9b1680ae 702
bogdanm 86:04dd9b1680ae 703 /**
bogdanm 86:04dd9b1680ae 704 * @brief AF 1 selection
bogdanm 86:04dd9b1680ae 705 */
bogdanm 86:04dd9b1680ae 706 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 707 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 708
bogdanm 86:04dd9b1680ae 709 /**
bogdanm 86:04dd9b1680ae 710 * @brief AF 2 selection
bogdanm 86:04dd9b1680ae 711 */
bogdanm 86:04dd9b1680ae 712 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 713 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 714 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 715
bogdanm 86:04dd9b1680ae 716 /**
bogdanm 86:04dd9b1680ae 717 * @brief AF 3 selection
bogdanm 86:04dd9b1680ae 718 */
bogdanm 86:04dd9b1680ae 719 #define GPIO_AF3_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 720 #define GPIO_AF3_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 721 #define GPIO_AF3_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 722
bogdanm 86:04dd9b1680ae 723 /**
bogdanm 86:04dd9b1680ae 724 * @brief AF 4 selection
bogdanm 86:04dd9b1680ae 725 */
bogdanm 86:04dd9b1680ae 726 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 727 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 728 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 729
bogdanm 86:04dd9b1680ae 730 /**
bogdanm 86:04dd9b1680ae 731 * @brief AF 5 selection
bogdanm 86:04dd9b1680ae 732 */
bogdanm 86:04dd9b1680ae 733 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1/I2S1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 734 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 735 #define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3/I2S3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 736 #define GPIO_AF5_SPI4 ((uint8_t)0x05) /* SPI4 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 737 #define GPIO_AF5_I2S3ext ((uint8_t)0x05) /* I2S3ext_SD Alternate Function mapping */
bogdanm 86:04dd9b1680ae 738
bogdanm 86:04dd9b1680ae 739 /**
bogdanm 86:04dd9b1680ae 740 * @brief AF 6 selection
bogdanm 86:04dd9b1680ae 741 */
bogdanm 86:04dd9b1680ae 742 #define GPIO_AF6_SPI2 ((uint8_t)0x06) /* I2S2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 743 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 744 #define GPIO_AF6_SPI4 ((uint8_t)0x06) /* SPI4/I2S4 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 745 #define GPIO_AF6_SPI5 ((uint8_t)0x06) /* SPI5/I2S5 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 746 #define GPIO_AF6_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping */
bogdanm 86:04dd9b1680ae 747 /**
bogdanm 86:04dd9b1680ae 748 * @brief AF 7 selection
bogdanm 86:04dd9b1680ae 749 */
bogdanm 86:04dd9b1680ae 750 #define GPIO_AF7_SPI3 ((uint8_t)0x07) /* SPI3/I2S3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 751 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 752 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 753 #define GPIO_AF7_I2S3ext ((uint8_t)0x07) /* I2S3ext_SD Alternate Function mapping */
bogdanm 86:04dd9b1680ae 754
bogdanm 86:04dd9b1680ae 755 /**
bogdanm 86:04dd9b1680ae 756 * @brief AF 8 selection
bogdanm 86:04dd9b1680ae 757 */
bogdanm 86:04dd9b1680ae 758 #define GPIO_AF8_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 759
bogdanm 86:04dd9b1680ae 760 /**
bogdanm 86:04dd9b1680ae 761 * @brief AF 9 selection
bogdanm 86:04dd9b1680ae 762 */
bogdanm 86:04dd9b1680ae 763 #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 764 #define GPIO_AF9_I2C2 ((uint8_t)0x09) /* I2C2 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 765 #define GPIO_AF9_I2C3 ((uint8_t)0x09) /* I2C3 Alternate Function mapping */
bogdanm 86:04dd9b1680ae 766
bogdanm 86:04dd9b1680ae 767
bogdanm 86:04dd9b1680ae 768 /**
bogdanm 86:04dd9b1680ae 769 * @brief AF 10 selection
bogdanm 86:04dd9b1680ae 770 */
bogdanm 86:04dd9b1680ae 771 #define GPIO_AF10_OTG_FS ((uint8_t)0xA) /* OTG_FS Alternate Function mapping */
bogdanm 86:04dd9b1680ae 772
bogdanm 86:04dd9b1680ae 773 /**
bogdanm 86:04dd9b1680ae 774 * @brief AF 12 selection
bogdanm 86:04dd9b1680ae 775 */
bogdanm 86:04dd9b1680ae 776 #define GPIO_AF12_SDIO ((uint8_t)0xC) /* SDIO Alternate Function mapping */
bogdanm 86:04dd9b1680ae 777
bogdanm 86:04dd9b1680ae 778 /**
bogdanm 86:04dd9b1680ae 779 * @brief AF 15 selection
bogdanm 86:04dd9b1680ae 780 */
bogdanm 86:04dd9b1680ae 781 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */
bogdanm 86:04dd9b1680ae 782
bogdanm 86:04dd9b1680ae 783 #define IS_GPIO_AF(AF) (((AF) == GPIO_AF0_RTC_50Hz) || ((AF) == GPIO_AF9_TIM14) || \
bogdanm 86:04dd9b1680ae 784 ((AF) == GPIO_AF0_MCO) || ((AF) == GPIO_AF0_TAMPER) || \
bogdanm 86:04dd9b1680ae 785 ((AF) == GPIO_AF0_SWJ) || ((AF) == GPIO_AF0_TRACE) || \
bogdanm 86:04dd9b1680ae 786 ((AF) == GPIO_AF1_TIM1) || ((AF) == GPIO_AF1_TIM2) || \
bogdanm 86:04dd9b1680ae 787 ((AF) == GPIO_AF2_TIM3) || ((AF) == GPIO_AF2_TIM4) || \
bogdanm 86:04dd9b1680ae 788 ((AF) == GPIO_AF2_TIM5) || ((AF) == GPIO_AF4_I2C1) || \
bogdanm 86:04dd9b1680ae 789 ((AF) == GPIO_AF4_I2C2) || ((AF) == GPIO_AF4_I2C3) || \
bogdanm 86:04dd9b1680ae 790 ((AF) == GPIO_AF5_SPI1) || ((AF) == GPIO_AF5_SPI2) || \
bogdanm 86:04dd9b1680ae 791 ((AF) == GPIO_AF5_SPI3) || ((AF) == GPIO_AF6_SPI4) || \
bogdanm 86:04dd9b1680ae 792 ((AF) == GPIO_AF6_SPI3) || ((AF) == GPIO_AF5_SPI4) || \
bogdanm 86:04dd9b1680ae 793 ((AF) == GPIO_AF6_SPI5) || ((AF) == GPIO_AF7_SPI3) || \
bogdanm 86:04dd9b1680ae 794 ((AF) == GPIO_AF7_USART1) || ((AF) == GPIO_AF7_USART2) || \
bogdanm 86:04dd9b1680ae 795 ((AF) == GPIO_AF8_USART6) || ((AF) == GPIO_AF10_OTG_FS) || \
bogdanm 86:04dd9b1680ae 796 ((AF) == GPIO_AF9_I2C2) || ((AF) == GPIO_AF9_I2C3) || \
bogdanm 86:04dd9b1680ae 797 ((AF) == GPIO_AF12_SDIO) || ((AF) == GPIO_AF15_EVENTOUT))
bogdanm 86:04dd9b1680ae 798
bogdanm 86:04dd9b1680ae 799 #endif /* STM32F411xE */
bogdanm 86:04dd9b1680ae 800 /**
bogdanm 86:04dd9b1680ae 801 * @}
bogdanm 86:04dd9b1680ae 802 */
bogdanm 86:04dd9b1680ae 803
bogdanm 86:04dd9b1680ae 804 /**
bogdanm 86:04dd9b1680ae 805 * @}
bogdanm 86:04dd9b1680ae 806 */
bogdanm 86:04dd9b1680ae 807
bogdanm 86:04dd9b1680ae 808 /* Exported macro ------------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 809 /* Exported functions --------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 810
bogdanm 86:04dd9b1680ae 811
bogdanm 86:04dd9b1680ae 812 /**
bogdanm 86:04dd9b1680ae 813 * @}
bogdanm 86:04dd9b1680ae 814 */
bogdanm 86:04dd9b1680ae 815
bogdanm 86:04dd9b1680ae 816 /**
bogdanm 86:04dd9b1680ae 817 * @}
bogdanm 86:04dd9b1680ae 818 */
bogdanm 86:04dd9b1680ae 819
bogdanm 86:04dd9b1680ae 820 #ifdef __cplusplus
bogdanm 86:04dd9b1680ae 821 }
bogdanm 86:04dd9b1680ae 822 #endif
bogdanm 86:04dd9b1680ae 823
bogdanm 86:04dd9b1680ae 824 #endif /* __STM32F4xx_HAL_GPIO_EX_H */
bogdanm 86:04dd9b1680ae 825
bogdanm 86:04dd9b1680ae 826 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/