mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

Committer:
yusuke_kyo
Date:
Wed Apr 08 08:04:18 2015 +0000
Revision:
98:01a414ca7d6d
Parent:
92:4fc01daae5a5
remove SerialHalfDuplex.h

Who changed what in which revision?

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