my fork

Dependents:   Nucleo_blueNRG

Fork of mbed by mbed official

Committer:
filartrix
Date:
Wed Apr 08 14:12:53 2015 +0000
Revision:
97:4298809c7c9e
Parent:
92:4fc01daae5a5
First reale BlueNRG module for nucleo 401 board

Who changed what in which revision?

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