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

Fork of mbed by mbed official

Committer:
Mikchel
Date:
Sun May 03 16:04:42 2015 +0000
Revision:
99:7f6c6de930c0
Parent:
93:e188a91d3eaa
12

Who changed what in which revision?

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