version_2.0

Dependents:   cc3000_ping_demo_try_2

Fork of mbed by mbed official

Committer:
emilmont
Date:
Fri Feb 14 14:36:43 2014 +0000
Revision:
77:869cf507173a
Child:
81:7d30d6019079
Release 77 of the mbed library

Main changes:
* Add target NUCLEO_F030R8
* Add target NUCLEO_F401RE
* Add target NUCLEO_F103RB
* Add target NUCLEO_L152RE

Who changed what in which revision?

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