my fork

Dependents:   Nucleo_blueNRG

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Thu Nov 27 13:33:22 2014 +0000
Revision:
92:4fc01daae5a5
Parent:
85:024bf7f99721
Child:
93:e188a91d3eaa
Release 92 of the mbed libray

Main changes:

- nRF51822: fixed pin assignment issues
- ST targets moving to the STM32Cube driver
- LPC1439: fixed serial interrupt issue
- first Cortex-A platform supported in mbed (RZ_A1H)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 85:024bf7f99721 1 /**
bogdanm 85:024bf7f99721 2 ******************************************************************************
bogdanm 85:024bf7f99721 3 * @file stm32f0xx_hal_gpio_ex.h
bogdanm 85:024bf7f99721 4 * @author MCD Application Team
bogdanm 92:4fc01daae5a5 5 * @version V1.1.0
bogdanm 92:4fc01daae5a5 6 * @date 03-Oct-2014
bogdanm 85:024bf7f99721 7 * @brief Header file of GPIO HAL Extension module.
bogdanm 85:024bf7f99721 8 ******************************************************************************
bogdanm 85:024bf7f99721 9 * @attention
bogdanm 85:024bf7f99721 10 *
bogdanm 85:024bf7f99721 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
bogdanm 85:024bf7f99721 12 *
bogdanm 85:024bf7f99721 13 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 85:024bf7f99721 14 * are permitted provided that the following conditions are met:
bogdanm 85:024bf7f99721 15 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 85:024bf7f99721 16 * this list of conditions and the following disclaimer.
bogdanm 85:024bf7f99721 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 85:024bf7f99721 18 * this list of conditions and the following disclaimer in the documentation
bogdanm 85:024bf7f99721 19 * and/or other materials provided with the distribution.
bogdanm 85:024bf7f99721 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 85:024bf7f99721 21 * may be used to endorse or promote products derived from this software
bogdanm 85:024bf7f99721 22 * without specific prior written permission.
bogdanm 85:024bf7f99721 23 *
bogdanm 85:024bf7f99721 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 85:024bf7f99721 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 85:024bf7f99721 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 85:024bf7f99721 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 85:024bf7f99721 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 85:024bf7f99721 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 85:024bf7f99721 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 85:024bf7f99721 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 85:024bf7f99721 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 85:024bf7f99721 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 85:024bf7f99721 34 *
bogdanm 85:024bf7f99721 35 ******************************************************************************
bogdanm 85:024bf7f99721 36 */
bogdanm 85:024bf7f99721 37
bogdanm 85:024bf7f99721 38 /* Define to prevent recursive inclusion -------------------------------------*/
bogdanm 85:024bf7f99721 39 #ifndef __STM32F0xx_HAL_GPIO_EX_H
bogdanm 85:024bf7f99721 40 #define __STM32F0xx_HAL_GPIO_EX_H
bogdanm 85:024bf7f99721 41
bogdanm 85:024bf7f99721 42 #ifdef __cplusplus
bogdanm 85:024bf7f99721 43 extern "C" {
bogdanm 85:024bf7f99721 44 #endif
bogdanm 85:024bf7f99721 45
bogdanm 85:024bf7f99721 46 /* Includes ------------------------------------------------------------------*/
bogdanm 85:024bf7f99721 47 #include "stm32f0xx_hal_def.h"
bogdanm 85:024bf7f99721 48
bogdanm 85:024bf7f99721 49 /** @addtogroup STM32F0xx_HAL_Driver
bogdanm 85:024bf7f99721 50 * @{
bogdanm 85:024bf7f99721 51 */
bogdanm 85:024bf7f99721 52
bogdanm 92:4fc01daae5a5 53 /** @defgroup GPIOEx GPIOEx Extended HAL module driver
bogdanm 85:024bf7f99721 54 * @{
bogdanm 85:024bf7f99721 55 */
bogdanm 85:024bf7f99721 56
bogdanm 85:024bf7f99721 57 /* Exported types ------------------------------------------------------------*/
bogdanm 85:024bf7f99721 58 /* Exported constants --------------------------------------------------------*/
bogdanm 92:4fc01daae5a5 59 /** @defgroup GPIOEx_Exported_Constants GPIOEx Exported Constants
bogdanm 85:024bf7f99721 60 * @{
bogdanm 85:024bf7f99721 61 */
bogdanm 85:024bf7f99721 62
bogdanm 92:4fc01daae5a5 63 /** @defgroup GPIOEx_Alternate_function_selection GPIOEx Alternate function selection
bogdanm 85:024bf7f99721 64 * @{
bogdanm 85:024bf7f99721 65 */
bogdanm 85:024bf7f99721 66
bogdanm 85:024bf7f99721 67 #if defined (STM32F030x6)
bogdanm 85:024bf7f99721 68 /*------------------------- STM32F030x6---------------------------*/
bogdanm 92:4fc01daae5a5 69 /* AF 0 */
bogdanm 92:4fc01daae5a5 70 #define GPIO_AF0_EVENTOUT ((uint8_t)0x00) /*!< AF0: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 71 #define GPIO_AF0_MCO ((uint8_t)0x00) /*!< AF0: MCO Alternate Function mapping */
bogdanm 92:4fc01daae5a5 72 #define GPIO_AF0_SPI1 ((uint8_t)0x00) /*!< AF0: SPI1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 73 #define GPIO_AF0_TIM17 ((uint8_t)0x00) /*!< AF0: TIM17 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 74 #define GPIO_AF0_SWDIO ((uint8_t)0x00) /*!< AF0: SWDIO Alternate Function mapping */
bogdanm 92:4fc01daae5a5 75 #define GPIO_AF0_SWCLK ((uint8_t)0x00) /*!< AF0: SWCLK Alternate Function mapping */
bogdanm 92:4fc01daae5a5 76 #define GPIO_AF0_TIM14 ((uint8_t)0x00) /*!< AF0: TIM14 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 77 #define GPIO_AF0_USART1 ((uint8_t)0x00) /*!< AF0: USART1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 78 #define GPIO_AF0_IR ((uint8_t)0x00) /*!< AF0: IR Alternate Function mapping */
bogdanm 85:024bf7f99721 79
bogdanm 92:4fc01daae5a5 80 /* AF 1 */
bogdanm 92:4fc01daae5a5 81 #define GPIO_AF1_TIM3 ((uint8_t)0x01) /*!< AF1: TIM3 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 82 #define GPIO_AF1_USART1 ((uint8_t)0x01) /*!< AF1: USART1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 83 #define GPIO_AF1_EVENTOUT ((uint8_t)0x01) /*!< AF1: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 84 #define GPIO_AF1_I2C1 ((uint8_t)0x01) /*!< AF1: I2C1 Alternate Function mapping */
bogdanm 85:024bf7f99721 85
bogdanm 92:4fc01daae5a5 86 /* AF 2 */
bogdanm 92:4fc01daae5a5 87 #define GPIO_AF2_TIM1 ((uint8_t)0x02) /*!< AF2: TIM1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 88 #define GPIO_AF2_TIM16 ((uint8_t)0x02) /*!< AF2: TIM16 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 89 #define GPIO_AF2_TIM17 ((uint8_t)0x02) /*!< AF2: TIM17 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 90 #define GPIO_AF2_EVENTOUT ((uint8_t)0x02) /*!< AF2: EVENTOUT Alternate Function mapping */
bogdanm 85:024bf7f99721 91
bogdanm 92:4fc01daae5a5 92 /* AF 3 */
bogdanm 92:4fc01daae5a5 93 #define GPIO_AF3_EVENTOUT ((uint8_t)0x03) /*!< AF3: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 94 #define GPIO_AF3_I2C1 ((uint8_t)0x03) /*!< AF3: I2C1 Alternate Function mapping */
bogdanm 85:024bf7f99721 95
bogdanm 92:4fc01daae5a5 96 /* AF 4 */
bogdanm 92:4fc01daae5a5 97 #define GPIO_AF4_TIM14 ((uint8_t)0x04) /*!< AF4: TIM14 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 98 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /*!< AF4: I2C1 Alternate Function mapping */
bogdanm 85:024bf7f99721 99
bogdanm 92:4fc01daae5a5 100 /* AF 5 */
bogdanm 92:4fc01daae5a5 101 #define GPIO_AF5_TIM16 ((uint8_t)0x05) /*!< AF5: TIM16 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 102 #define GPIO_AF5_TIM17 ((uint8_t)0x05) /*!< AF5: TIM17 Alternate Function mapping */
bogdanm 85:024bf7f99721 103
bogdanm 92:4fc01daae5a5 104 /* AF 6 */
bogdanm 92:4fc01daae5a5 105 #define GPIO_AF6_EVENTOUT ((uint8_t)0x06) /*!< AF6: EVENTOUT Alternate Function mapping */
bogdanm 85:024bf7f99721 106
bogdanm 92:4fc01daae5a5 107 #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x06)
bogdanm 85:024bf7f99721 108
bogdanm 85:024bf7f99721 109 #endif /* STM32F030x6 */
bogdanm 85:024bf7f99721 110
bogdanm 85:024bf7f99721 111 /*---------------------------------- STM32F030x8 -------------------------------------------*/
bogdanm 85:024bf7f99721 112 #if defined (STM32F030x8)
bogdanm 92:4fc01daae5a5 113 /* AF 0 */
bogdanm 92:4fc01daae5a5 114 #define GPIO_AF0_EVENTOUT ((uint8_t)0x00) /*!< AF0: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 115 #define GPIO_AF0_MCO ((uint8_t)0x00) /*!< AF0: MCO Alternate Function mapping */
bogdanm 92:4fc01daae5a5 116 #define GPIO_AF0_SPI1 ((uint8_t)0x00) /*!< AF0: SPI1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 117 #define GPIO_AF0_SPI2 ((uint8_t)0x00) /*!< AF0: SPI2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 118 #define GPIO_AF0_TIM15 ((uint8_t)0x00) /*!< AF0: TIM15 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 119 #define GPIO_AF0_TIM17 ((uint8_t)0x00) /*!< AF0: TIM17 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 120 #define GPIO_AF0_SWDIO ((uint8_t)0x00) /*!< AF0: SWDIO Alternate Function mapping */
bogdanm 92:4fc01daae5a5 121 #define GPIO_AF0_SWCLK ((uint8_t)0x00) /*!< AF0: SWCLK Alternate Function mapping */
bogdanm 92:4fc01daae5a5 122 #define GPIO_AF0_TIM14 ((uint8_t)0x00) /*!< AF0: TIM14 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 123 #define GPIO_AF0_USART1 ((uint8_t)0x00) /*!< AF0: USART1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 124 #define GPIO_AF0_IR ((uint8_t)0x00) /*!< AF0: IR Alternate Function mapping */
bogdanm 85:024bf7f99721 125
bogdanm 92:4fc01daae5a5 126 /* AF 1 */
bogdanm 92:4fc01daae5a5 127 #define GPIO_AF1_TIM3 ((uint8_t)0x01) /*!< AF1: TIM3 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 128 #define GPIO_AF1_TIM15 ((uint8_t)0x01) /*!< AF1: TIM15 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 129 #define GPIO_AF1_USART1 ((uint8_t)0x01) /*!< AF1: USART1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 130 #define GPIO_AF1_USART2 ((uint8_t)0x01) /*!< AF1: USART2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 131 #define GPIO_AF1_EVENTOUT ((uint8_t)0x01) /*!< AF1: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 132 #define GPIO_AF1_I2C1 ((uint8_t)0x01) /*!< AF1: I2C1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 133 #define GPIO_AF1_I2C2 ((uint8_t)0x01) /*!< AF1: I2C2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 134 #define GPIO_AF1_IR ((uint8_t)0x01) /*!< AF1: IR Alternate Function mapping */
bogdanm 85:024bf7f99721 135
bogdanm 92:4fc01daae5a5 136 /* AF 2 */
bogdanm 92:4fc01daae5a5 137 #define GPIO_AF2_TIM1 ((uint8_t)0x02) /*!< AF2: TIM1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 138 #define GPIO_AF2_TIM16 ((uint8_t)0x02) /*!< AF2: TIM16 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 139 #define GPIO_AF2_TIM17 ((uint8_t)0x02) /*!< AF2: TIM17 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 140 #define GPIO_AF2_EVENTOUT ((uint8_t)0x02) /*!< AF2: EVENTOUT Alternate Function mapping */
bogdanm 85:024bf7f99721 141
bogdanm 92:4fc01daae5a5 142 /* AF 3 */
bogdanm 92:4fc01daae5a5 143 #define GPIO_AF3_EVENTOUT ((uint8_t)0x03) /*!< AF3: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 144 #define GPIO_AF3_I2C1 ((uint8_t)0x03) /*!< AF3: I2C1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 145 #define GPIO_AF3_TIM15 ((uint8_t)0x03) /*!< AF3: TIM15 Alternate Function mapping */
bogdanm 85:024bf7f99721 146
bogdanm 92:4fc01daae5a5 147 /* AF 4 */
bogdanm 92:4fc01daae5a5 148 #define GPIO_AF4_TIM14 ((uint8_t)0x04) /*!< AF4: TIM14 Alternate Function mapping */
bogdanm 85:024bf7f99721 149
bogdanm 92:4fc01daae5a5 150 /* AF 5 */
bogdanm 92:4fc01daae5a5 151 #define GPIO_AF5_TIM16 ((uint8_t)0x05) /*!< AF5: TIM16 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 152 #define GPIO_AF5_TIM17 ((uint8_t)0x05) /*!< AF5: TIM17 Alternate Function mapping */
bogdanm 85:024bf7f99721 153
bogdanm 92:4fc01daae5a5 154 /* AF 6 */
bogdanm 92:4fc01daae5a5 155 #define GPIO_AF6_EVENTOUT ((uint8_t)0x06) /*!< AF6: EVENTOUT Alternate Function mapping */
bogdanm 85:024bf7f99721 156
bogdanm 92:4fc01daae5a5 157 #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x06)
bogdanm 85:024bf7f99721 158
bogdanm 85:024bf7f99721 159 #endif /* STM32F030x8 */
bogdanm 85:024bf7f99721 160
bogdanm 85:024bf7f99721 161 #if defined (STM32F031x6) || defined (STM32F038xx)
bogdanm 85:024bf7f99721 162 /*--------------------------- STM32F031x6/STM32F038xx ---------------------------*/
bogdanm 92:4fc01daae5a5 163 /* AF 0 */
bogdanm 92:4fc01daae5a5 164 #define GPIO_AF0_EVENTOUT ((uint8_t)0x00) /*!< AF0: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 165 #define GPIO_AF0_MCO ((uint8_t)0x00) /*!< AF0: MCO Alternate Function mapping */
bogdanm 92:4fc01daae5a5 166 #define GPIO_AF0_SPI1 ((uint8_t)0x00) /*!< AF0: SPI1/I2S1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 167 #define GPIO_AF0_TIM17 ((uint8_t)0x00) /*!< AF0: TIM17 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 168 #define GPIO_AF0_SWDAT ((uint8_t)0x00) /*!< AF0: SWDAT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 169 #define GPIO_AF0_SWCLK ((uint8_t)0x00) /*!< AF0: SWCLK Alternate Function mapping */
bogdanm 92:4fc01daae5a5 170 #define GPIO_AF0_TIM14 ((uint8_t)0x00) /*!< AF0: TIM14 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 171 #define GPIO_AF0_USART1 ((uint8_t)0x00) /*!< AF0: USART1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 172 #define GPIO_AF0_IR ((uint8_t)0x00) /*!< AF0: IR Alternate Function mapping */
bogdanm 85:024bf7f99721 173
bogdanm 92:4fc01daae5a5 174 /* AF 1 */
bogdanm 92:4fc01daae5a5 175 #define GPIO_AF1_TIM3 ((uint8_t)0x01) /*!< AF1: TIM3 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 176 #define GPIO_AF1_USART1 ((uint8_t)0x01) /*!< AF1: USART1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 177 #define GPIO_AF1_IR ((uint8_t)0x01) /*!< AF1: IR Alternate Function mapping */
bogdanm 92:4fc01daae5a5 178 #define GPIO_AF1_EVENTOUT ((uint8_t)0x01) /*!< AF1: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 179 #define GPIO_AF1_I2C1 ((uint8_t)0x01) /*!< AF1: I2C1 Alternate Function mapping */
bogdanm 85:024bf7f99721 180
bogdanm 92:4fc01daae5a5 181 /* AF 2 */
bogdanm 92:4fc01daae5a5 182 #define GPIO_AF2_TIM1 ((uint8_t)0x02) /*!< AF2: TIM1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 183 #define GPIO_AF2_TIM2 ((uint8_t)0x02) /*!< AF2: TIM2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 184 #define GPIO_AF2_TIM16 ((uint8_t)0x02) /*!< AF2: TIM16 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 185 #define GPIO_AF2_TIM17 ((uint8_t)0x02) /*!< AF2: TIM17 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 186 #define GPIO_AF2_EVENTOUT ((uint8_t)0x02) /*!< AF2: EVENTOUT Alternate Function mapping */
bogdanm 85:024bf7f99721 187
bogdanm 92:4fc01daae5a5 188 /* AF 3 */
bogdanm 92:4fc01daae5a5 189 #define GPIO_AF3_EVENTOUT ((uint8_t)0x03) /*!< AF3: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 190 #define GPIO_AF3_I2C1 ((uint8_t)0x03) /*!< AF3: I2C1 Alternate Function mapping */
bogdanm 85:024bf7f99721 191
bogdanm 92:4fc01daae5a5 192 /* AF 4 */
bogdanm 92:4fc01daae5a5 193 #define GPIO_AF4_TIM14 ((uint8_t)0x04) /*!< AF4: TIM14 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 194 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /*!< AF4: I2C1 Alternate Function mapping */
bogdanm 85:024bf7f99721 195
bogdanm 92:4fc01daae5a5 196 /* AF 5 */
bogdanm 92:4fc01daae5a5 197 #define GPIO_AF5_TIM16 ((uint8_t)0x05) /*!< AF5: TIM16 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 198 #define GPIO_AF5_TIM17 ((uint8_t)0x05) /*!< AF5: TIM17 Alternate Function mapping */
bogdanm 85:024bf7f99721 199
bogdanm 92:4fc01daae5a5 200 /* AF 6 */
bogdanm 92:4fc01daae5a5 201 #define GPIO_AF6_EVENTOUT ((uint8_t)0x06) /*!< AF6: EVENTOUT Alternate Function mapping */
bogdanm 85:024bf7f99721 202
bogdanm 92:4fc01daae5a5 203 #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x06)
bogdanm 85:024bf7f99721 204
bogdanm 85:024bf7f99721 205 #endif /* STM32F031x6 || STM32F038xx */
bogdanm 85:024bf7f99721 206
bogdanm 85:024bf7f99721 207 #if defined (STM32F051x8) || defined (STM32F058xx)
bogdanm 85:024bf7f99721 208 /*--------------------------- STM32F051x8/STM32F058xx---------------------------*/
bogdanm 92:4fc01daae5a5 209 /* AF 0 */
bogdanm 92:4fc01daae5a5 210 #define GPIO_AF0_EVENTOUT ((uint8_t)0x00) /*!< AF0: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 211 #define GPIO_AF0_MCO ((uint8_t)0x00) /*!< AF0: MCO Alternate Function mapping */
bogdanm 92:4fc01daae5a5 212 #define GPIO_AF0_SPI1 ((uint8_t)0x00) /*!< AF0: SPI1/I2S1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 213 #define GPIO_AF0_SPI2 ((uint8_t)0x00) /*!< AF0: SPI2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 214 #define GPIO_AF0_TIM15 ((uint8_t)0x00) /*!< AF0: TIM15 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 215 #define GPIO_AF0_TIM17 ((uint8_t)0x00) /*!< AF0: TIM17 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 216 #define GPIO_AF0_SWDIO ((uint8_t)0x00) /*!< AF0: SWDIO Alternate Function mapping */
bogdanm 92:4fc01daae5a5 217 #define GPIO_AF0_SWCLK ((uint8_t)0x00) /*!< AF0: SWCLK Alternate Function mapping */
bogdanm 92:4fc01daae5a5 218 #define GPIO_AF0_TIM14 ((uint8_t)0x00) /*!< AF0: TIM14 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 219 #define GPIO_AF0_USART1 ((uint8_t)0x00) /*!< AF0: USART1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 220 #define GPIO_AF0_IR ((uint8_t)0x00) /*!< AF0: IR Alternate Function mapping */
bogdanm 92:4fc01daae5a5 221 #define GPIO_AF0_CEC ((uint8_t)0x00) /*!< AF0: CEC Alternate Function mapping */
bogdanm 85:024bf7f99721 222
bogdanm 92:4fc01daae5a5 223 /* AF 1 */
bogdanm 92:4fc01daae5a5 224 #define GPIO_AF1_TIM3 ((uint8_t)0x01) /*!< AF1: TIM3 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 225 #define GPIO_AF1_TIM15 ((uint8_t)0x01) /*!< AF1: TIM15 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 226 #define GPIO_AF1_USART1 ((uint8_t)0x01) /*!< AF1: USART1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 227 #define GPIO_AF1_USART2 ((uint8_t)0x01) /*!< AF1: USART2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 228 #define GPIO_AF1_EVENTOUT ((uint8_t)0x01) /*!< AF1: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 229 #define GPIO_AF1_I2C1 ((uint8_t)0x01) /*!< AF1: I2C1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 230 #define GPIO_AF1_I2C2 ((uint8_t)0x01) /*!< AF1: I2C2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 231 #define GPIO_AF1_IR ((uint8_t)0x01) /*!< AF1: IR Alternate Function mapping */
bogdanm 92:4fc01daae5a5 232 #define GPIO_AF1_CEC ((uint8_t)0x01) /*!< AF1: CEC Alternate Function mapping */
bogdanm 85:024bf7f99721 233
bogdanm 92:4fc01daae5a5 234 /* AF 2 */
bogdanm 92:4fc01daae5a5 235 #define GPIO_AF2_TIM1 ((uint8_t)0x02) /*!< AF2: TIM1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 236 #define GPIO_AF2_TIM2 ((uint8_t)0x02) /*!< AF2: TIM2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 237 #define GPIO_AF2_TIM16 ((uint8_t)0x02) /*!< AF2: TIM16 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 238 #define GPIO_AF2_TIM17 ((uint8_t)0x02) /*!< AF2: TIM17 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 239 #define GPIO_AF2_EVENTOUT ((uint8_t)0x02) /*!< AF2: EVENTOUT Alternate Function mapping */
bogdanm 85:024bf7f99721 240
bogdanm 92:4fc01daae5a5 241 /* AF 3 */
bogdanm 92:4fc01daae5a5 242 #define GPIO_AF3_EVENTOUT ((uint8_t)0x03) /*!< AF3: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 243 #define GPIO_AF3_I2C1 ((uint8_t)0x03) /*!< AF3: I2C1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 244 #define GPIO_AF3_TIM15 ((uint8_t)0x03) /*!< AF3: TIM15 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 245 #define GPIO_AF3_TSC ((uint8_t)0x03) /*!< AF3: TSC Alternate Function mapping */
bogdanm 85:024bf7f99721 246
bogdanm 92:4fc01daae5a5 247 /* AF 4 */
bogdanm 92:4fc01daae5a5 248 #define GPIO_AF4_TIM14 ((uint8_t)0x04) /*!< AF4: TIM14 Alternate Function mapping */
bogdanm 85:024bf7f99721 249
bogdanm 92:4fc01daae5a5 250 /* AF 5 */
bogdanm 92:4fc01daae5a5 251 #define GPIO_AF5_TIM16 ((uint8_t)0x05) /*!< AF5: TIM16 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 252 #define GPIO_AF5_TIM17 ((uint8_t)0x05) /*!< AF5: TIM17 Alternate Function mapping */
bogdanm 85:024bf7f99721 253
bogdanm 92:4fc01daae5a5 254 /* AF 6 */
bogdanm 92:4fc01daae5a5 255 #define GPIO_AF6_EVENTOUT ((uint8_t)0x06) /*!< AF6: EVENTOUT Alternate Function mapping */
bogdanm 85:024bf7f99721 256
bogdanm 92:4fc01daae5a5 257 /* AF 7 */
bogdanm 92:4fc01daae5a5 258 #define GPIO_AF7_COMP1 ((uint8_t)0x07) /*!< AF7: COMP1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 259 #define GPIO_AF7_COMP2 ((uint8_t)0x07) /*!< AF7: COMP2 Alternate Function mapping */
bogdanm 85:024bf7f99721 260
bogdanm 92:4fc01daae5a5 261 #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x07)
bogdanm 85:024bf7f99721 262
bogdanm 85:024bf7f99721 263 #endif /* STM32F051x8/STM32F058xx */
bogdanm 85:024bf7f99721 264
bogdanm 85:024bf7f99721 265 #if defined (STM32F071xB)
bogdanm 85:024bf7f99721 266 /*--------------------------- STM32F071xB ---------------------------*/
bogdanm 92:4fc01daae5a5 267 /* AF 0 */
bogdanm 92:4fc01daae5a5 268 #define GPIO_AF0_EVENTOUT ((uint8_t)0x00) /*!< AF0: AEVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 269 #define GPIO_AF0_SWDIO ((uint8_t)0x00) /*!< AF0: SWDIO Alternate Function mapping */
bogdanm 92:4fc01daae5a5 270 #define GPIO_AF0_SWCLK ((uint8_t)0x00) /*!< AF0: SWCLK Alternate Function mapping */
bogdanm 92:4fc01daae5a5 271 #define GPIO_AF0_MCO ((uint8_t)0x00) /*!< AF0: MCO Alternate Function mapping */
bogdanm 92:4fc01daae5a5 272 #define GPIO_AF0_CEC ((uint8_t)0x00) /*!< AF0: CEC Alternate Function mapping */
bogdanm 92:4fc01daae5a5 273 #define GPIO_AF0_CRS ((uint8_t)0x00) /*!< AF0: CRS Alternate Function mapping */
bogdanm 92:4fc01daae5a5 274 #define GPIO_AF0_IR ((uint8_t)0x00) /*!< AF0: IR Alternate Function mapping */
bogdanm 92:4fc01daae5a5 275 #define GPIO_AF0_SPI1 ((uint8_t)0x00) /*!< AF0: SPI1/I2S1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 276 #define GPIO_AF0_SPI2 ((uint8_t)0x00) /*!< AF0: SPI2/I2S2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 277 #define GPIO_AF0_TIM1 ((uint8_t)0x00) /*!< AF0: TIM1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 278 #define GPIO_AF0_TIM3 ((uint8_t)0x00) /*!< AF0: TIM3 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 279 #define GPIO_AF0_TIM14 ((uint8_t)0x00) /*!< AF0: TIM14 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 280 #define GPIO_AF0_TIM15 ((uint8_t)0x00) /*!< AF0: TIM15 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 281 #define GPIO_AF0_TIM16 ((uint8_t)0x00) /*!< AF0: TIM16 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 282 #define GPIO_AF0_TIM17 ((uint8_t)0x00) /*!< AF0: TIM17 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 283 #define GPIO_AF0_TSC ((uint8_t)0x00) /*!< AF0: TSC Alternate Function mapping */
bogdanm 92:4fc01daae5a5 284 #define GPIO_AF0_USART1 ((uint8_t)0x00) /*!< AF0: USART1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 285 #define GPIO_AF0_USART2 ((uint8_t)0x00) /*!< AF0: USART2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 286 #define GPIO_AF0_USART3 ((uint8_t)0x00) /*!< AF0: USART3 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 287 #define GPIO_AF0_USART4 ((uint8_t)0x00) /*!< AF0: USART4 Alternate Function mapping */
bogdanm 85:024bf7f99721 288
bogdanm 92:4fc01daae5a5 289 /* AF 1 */
bogdanm 92:4fc01daae5a5 290 #define GPIO_AF1_TIM3 ((uint8_t)0x01) /*!< AF1: TIM3 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 291 #define GPIO_AF1_TIM15 ((uint8_t)0x01) /*!< AF1: TIM15 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 292 #define GPIO_AF1_USART1 ((uint8_t)0x01) /*!< AF1: USART1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 293 #define GPIO_AF1_USART2 ((uint8_t)0x01) /*!< AF1: USART2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 294 #define GPIO_AF1_USART3 ((uint8_t)0x01) /*!< AF1: USART3 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 295 #define GPIO_AF1_IR ((uint8_t)0x01) /*!< AF1: IR Alternate Function mapping */
bogdanm 92:4fc01daae5a5 296 #define GPIO_AF1_CEC ((uint8_t)0x01) /*!< AF1: CEC Alternate Function mapping */
bogdanm 92:4fc01daae5a5 297 #define GPIO_AF1_EVENTOUT ((uint8_t)0x01) /*!< AF1: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 298 #define GPIO_AF1_I2C1 ((uint8_t)0x01) /*!< AF1: I2C1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 299 #define GPIO_AF1_I2C2 ((uint8_t)0x01) /*!< AF1: I2C2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 300 #define GPIO_AF1_TSC ((uint8_t)0x01) /*!< AF1: TSC Alternate Function mapping */
bogdanm 92:4fc01daae5a5 301 #define GPIO_AF1_SPI1 ((uint8_t)0x01) /*!< AF1: SPI1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 302 #define GPIO_AF1_SPI2 ((uint8_t)0x01) /*!< AF1: SPI2 Alternate Function mapping */
bogdanm 85:024bf7f99721 303
bogdanm 92:4fc01daae5a5 304 /* AF 2 */
bogdanm 92:4fc01daae5a5 305 #define GPIO_AF2_TIM1 ((uint8_t)0x02) /*!< AF2: TIM1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 306 #define GPIO_AF2_TIM2 ((uint8_t)0x02) /*!< AF2: TIM2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 307 #define GPIO_AF2_TIM16 ((uint8_t)0x02) /*!< AF2: TIM16 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 308 #define GPIO_AF2_TIM17 ((uint8_t)0x02) /*!< AF2: TIM17 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 309 #define GPIO_AF2_EVENTOUT ((uint8_t)0x02) /*!< AF2: EVENTOUT Alternate Function mapping */
bogdanm 85:024bf7f99721 310
bogdanm 92:4fc01daae5a5 311 /* AF 3 */
bogdanm 92:4fc01daae5a5 312 #define GPIO_AF3_EVENTOUT ((uint8_t)0x03) /*!< AF3: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 313 #define GPIO_AF3_TSC ((uint8_t)0x03) /*!< AF3: TSC Alternate Function mapping */
bogdanm 92:4fc01daae5a5 314 #define GPIO_AF3_TIM15 ((uint8_t)0x03) /*!< AF3: TIM15 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 315 #define GPIO_AF3_I2C1 ((uint8_t)0x03) /*!< AF3: I2C1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 316
bogdanm 92:4fc01daae5a5 317 /* AF 4 */
bogdanm 92:4fc01daae5a5 318 #define GPIO_AF4_TIM14 ((uint8_t)0x04) /*!< AF4: TIM14 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 319 #define GPIO_AF4_USART4 ((uint8_t)0x04) /*!< AF4: USART4 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 320 #define GPIO_AF4_USART3 ((uint8_t)0x04) /*!< AF4: USART3 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 321 #define GPIO_AF4_CRS ((uint8_t)0x04) /*!< AF4: CRS Alternate Function mapping */
bogdanm 85:024bf7f99721 322
bogdanm 92:4fc01daae5a5 323 /* AF 5 */
bogdanm 92:4fc01daae5a5 324 #define GPIO_AF5_TIM15 ((uint8_t)0x05) /*!< AF5: TIM15 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 325 #define GPIO_AF5_TIM16 ((uint8_t)0x05) /*!< AF5: TIM16 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 326 #define GPIO_AF5_TIM17 ((uint8_t)0x05) /*!< AF5: TIM17 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 327 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /*!< AF5: SPI2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 328 #define GPIO_AF5_I2C2 ((uint8_t)0x05) /*!< AF5: I2C2 Alternate Function mapping */
bogdanm 85:024bf7f99721 329
bogdanm 92:4fc01daae5a5 330 /* AF 6 */
bogdanm 92:4fc01daae5a5 331 #define GPIO_AF6_EVENTOUT ((uint8_t)0x06) /*!< AF6: EVENTOUT Alternate Function mapping */
bogdanm 85:024bf7f99721 332
bogdanm 92:4fc01daae5a5 333 /* AF 7 */
bogdanm 92:4fc01daae5a5 334 #define GPIO_AF7_COMP1 ((uint8_t)0x07) /*!< AF7: COMP1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 335 #define GPIO_AF7_COMP2 ((uint8_t)0x07) /*!< AF7: COMP2 Alternate Function mapping */
bogdanm 85:024bf7f99721 336
bogdanm 92:4fc01daae5a5 337 #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x07)
bogdanm 85:024bf7f99721 338
bogdanm 85:024bf7f99721 339 #endif /* STM32F071xB */
bogdanm 85:024bf7f99721 340
bogdanm 85:024bf7f99721 341
bogdanm 92:4fc01daae5a5 342 #if defined(STM32F091xC) || defined(STM32F098xx)
bogdanm 92:4fc01daae5a5 343 /*--------------------------- STM32F091xC || STM32F098xx ------------------------------*/
bogdanm 92:4fc01daae5a5 344 /* AF 0 */
bogdanm 92:4fc01daae5a5 345 #define GPIO_AF0_EVENTOUT ((uint8_t)0x00) /*!< AF0: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 346 #define GPIO_AF0_SWDIO ((uint8_t)0x00) /*!< AF0: SWDIO Alternate Function mapping */
bogdanm 92:4fc01daae5a5 347 #define GPIO_AF0_SWCLK ((uint8_t)0x00) /*!< AF0: SWCLK Alternate Function mapping */
bogdanm 92:4fc01daae5a5 348 #define GPIO_AF0_MCO ((uint8_t)0x00) /*!< AF0: MCO Alternate Function mapping */
bogdanm 92:4fc01daae5a5 349 #define GPIO_AF0_CEC ((uint8_t)0x00) /*!< AF0: CEC Alternate Function mapping */
bogdanm 92:4fc01daae5a5 350 #define GPIO_AF0_CRS ((uint8_t)0x00) /*!< AF0: CRS Alternate Function mapping */
bogdanm 92:4fc01daae5a5 351 #define GPIO_AF0_IR ((uint8_t)0x00) /*!< AF0: IR Alternate Function mapping */
bogdanm 92:4fc01daae5a5 352 #define GPIO_AF0_SPI1 ((uint8_t)0x00) /*!< AF0: SPI1/I2S1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 353 #define GPIO_AF0_SPI2 ((uint8_t)0x00) /*!< AF0: SPI2/I2S2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 354 #define GPIO_AF0_TIM1 ((uint8_t)0x00) /*!< AF0: TIM1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 355 #define GPIO_AF0_TIM3 ((uint8_t)0x00) /*!< AF0: TIM3 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 356 #define GPIO_AF0_TIM14 ((uint8_t)0x00) /*!< AF0: TIM14 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 357 #define GPIO_AF0_TIM15 ((uint8_t)0x00) /*!< AF0: TIM15 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 358 #define GPIO_AF0_TIM16 ((uint8_t)0x00) /*!< AF0: TIM16 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 359 #define GPIO_AF0_TIM17 ((uint8_t)0x00) /*!< AF0: TIM17 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 360 #define GPIO_AF0_TSC ((uint8_t)0x00) /*!< AF0: TSC Alternate Function mapping */
bogdanm 92:4fc01daae5a5 361 #define GPIO_AF0_USART1 ((uint8_t)0x00) /*!< AF0: USART1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 362 #define GPIO_AF0_USART2 ((uint8_t)0x00) /*!< AF0: USART2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 363 #define GPIO_AF0_USART3 ((uint8_t)0x00) /*!< AF0: USART3 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 364 #define GPIO_AF0_USART4 ((uint8_t)0x00) /*!< AF0: USART4 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 365 #define GPIO_AF0_USART8 ((uint8_t)0x00) /*!< AF0: USART8 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 366 #define GPIO_AF0_CAN ((uint8_t)0x00) /*!< AF0: CAN Alternate Function mapping */
bogdanm 92:4fc01daae5a5 367
bogdanm 92:4fc01daae5a5 368 /* AF 1 */
bogdanm 92:4fc01daae5a5 369 #define GPIO_AF1_TIM3 ((uint8_t)0x01) /*!< AF1: TIM3 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 370 #define GPIO_AF1_TIM15 ((uint8_t)0x01) /*!< AF1: TIM15 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 371 #define GPIO_AF1_USART1 ((uint8_t)0x01) /*!< AF1: USART1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 372 #define GPIO_AF1_USART2 ((uint8_t)0x01) /*!< AF1: USART2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 373 #define GPIO_AF1_USART3 ((uint8_t)0x01) /*!< AF1: USART3 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 374 #define GPIO_AF1_USART4 ((uint8_t)0x01) /*!< AF1: USART4 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 375 #define GPIO_AF1_USART5 ((uint8_t)0x01) /*!< AF1: USART5 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 376 #define GPIO_AF1_USART6 ((uint8_t)0x01) /*!< AF1: USART6 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 377 #define GPIO_AF1_USART7 ((uint8_t)0x01) /*!< AF1: USART7 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 378 #define GPIO_AF1_USART8 ((uint8_t)0x01) /*!< AF1: USART8 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 379 #define GPIO_AF1_IR ((uint8_t)0x01) /*!< AF1: IR Alternate Function mapping */
bogdanm 92:4fc01daae5a5 380 #define GPIO_AF1_CEC ((uint8_t)0x01) /*!< AF1: CEC Alternate Function mapping */
bogdanm 92:4fc01daae5a5 381 #define GPIO_AF1_EVENTOUT ((uint8_t)0x01) /*!< AF1: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 382 #define GPIO_AF1_I2C1 ((uint8_t)0x01) /*!< AF1: I2C1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 383 #define GPIO_AF1_I2C2 ((uint8_t)0x01) /*!< AF1: I2C2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 384 #define GPIO_AF1_TSC ((uint8_t)0x01) /*!< AF1: TSC Alternate Function mapping */
bogdanm 92:4fc01daae5a5 385 #define GPIO_AF1_SPI1 ((uint8_t)0x01) /*!< AF1: SPI1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 386 #define GPIO_AF1_SPI2 ((uint8_t)0x01) /*!< AF1: SPI2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 387
bogdanm 92:4fc01daae5a5 388 /* AF 2 */
bogdanm 92:4fc01daae5a5 389 #define GPIO_AF2_TIM1 ((uint8_t)0x02) /*!< AF2: TIM1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 390 #define GPIO_AF2_TIM2 ((uint8_t)0x02) /*!< AF2: TIM2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 391 #define GPIO_AF2_TIM16 ((uint8_t)0x02) /*!< AF2: TIM16 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 392 #define GPIO_AF2_TIM17 ((uint8_t)0x02) /*!< AF2: TIM17 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 393 #define GPIO_AF2_EVENTOUT ((uint8_t)0x02) /*!< AF2: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 394 #define GPIO_AF2_USART5 ((uint8_t)0x02) /*!< AF2: USART5 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 395 #define GPIO_AF2_USART6 ((uint8_t)0x02) /*!< AF2: USART6 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 396 #define GPIO_AF2_USART7 ((uint8_t)0x02) /*!< AF2: USART7 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 397 #define GPIO_AF2_USART8 ((uint8_t)0x02) /*!< AF2: USART8 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 398
bogdanm 92:4fc01daae5a5 399 /* AF 3 */
bogdanm 92:4fc01daae5a5 400 #define GPIO_AF3_EVENTOUT ((uint8_t)0x03) /*!< AF3: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 401 #define GPIO_AF3_TSC ((uint8_t)0x03) /*!< AF3: TSC Alternate Function mapping */
bogdanm 92:4fc01daae5a5 402 #define GPIO_AF3_TIM15 ((uint8_t)0x03) /*!< AF3: TIM15 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 403 #define GPIO_AF3_I2C1 ((uint8_t)0x03) /*!< AF3: I2C1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 404
bogdanm 92:4fc01daae5a5 405 /* AF 4 */
bogdanm 92:4fc01daae5a5 406 #define GPIO_AF4_TIM14 ((uint8_t)0x04) /*!< AF4: TIM14 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 407 #define GPIO_AF4_USART4 ((uint8_t)0x04) /*!< AF4: USART4 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 408 #define GPIO_AF4_USART3 ((uint8_t)0x04) /*!< AF4: USART3 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 409 #define GPIO_AF4_CRS ((uint8_t)0x04) /*!< AF4: CRS Alternate Function mapping */
bogdanm 92:4fc01daae5a5 410 #define GPIO_AF4_CAN ((uint8_t)0x04) /*!< AF4: CAN Alternate Function mapping */
bogdanm 92:4fc01daae5a5 411 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /*!< AF4: I2C1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 412 #define GPIO_AF4_USART5 ((uint8_t)0x04) /*!< AF4: USART5 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 413
bogdanm 92:4fc01daae5a5 414 /* AF 5 */
bogdanm 92:4fc01daae5a5 415 #define GPIO_AF5_TIM15 ((uint8_t)0x05) /*!< AF5: TIM15 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 416 #define GPIO_AF5_TIM16 ((uint8_t)0x05) /*!< AF5: TIM16 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 417 #define GPIO_AF5_TIM17 ((uint8_t)0x05) /*!< AF5: TIM17 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 418 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /*!< AF5: SPI2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 419 #define GPIO_AF5_I2C2 ((uint8_t)0x05) /*!< AF5: I2C2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 420 #define GPIO_AF5_MCO ((uint8_t)0x05) /*!< AF5: MCO Alternate Function mapping */
bogdanm 92:4fc01daae5a5 421 #define GPIO_AF5_USART6 ((uint8_t)0x05) /*!< AF5: USART6 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 422
bogdanm 92:4fc01daae5a5 423 /* AF 6 */
bogdanm 92:4fc01daae5a5 424 #define GPIO_AF6_EVENTOUT ((uint8_t)0x06) /*!< AF6: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 425
bogdanm 92:4fc01daae5a5 426 /* AF 7 */
bogdanm 92:4fc01daae5a5 427 #define GPIO_AF7_COMP1 ((uint8_t)0x07) /*!< AF7: COMP1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 428 #define GPIO_AF7_COMP2 ((uint8_t)0x07) /*!< AF7: COMP2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 429
bogdanm 92:4fc01daae5a5 430 #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x07)
bogdanm 92:4fc01daae5a5 431
bogdanm 92:4fc01daae5a5 432 #endif /* STM32F091xC || STM32F098xx */
bogdanm 92:4fc01daae5a5 433
bogdanm 85:024bf7f99721 434 #if defined (STM32F072xB) || defined (STM32F078xx)
bogdanm 85:024bf7f99721 435 /*--------------------------- STM32F072xB/STM32F078xx ---------------------------*/
bogdanm 92:4fc01daae5a5 436 /* AF 0 */
bogdanm 92:4fc01daae5a5 437 #define GPIO_AF0_EVENTOUT ((uint8_t)0x00) /*!< AF0: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 438 #define GPIO_AF0_SWDIO ((uint8_t)0x00) /*!< AF0: SWDIO Alternate Function mapping */
bogdanm 92:4fc01daae5a5 439 #define GPIO_AF0_SWCLK ((uint8_t)0x00) /*!< AF0: SWCLK Alternate Function mapping */
bogdanm 92:4fc01daae5a5 440 #define GPIO_AF0_MCO ((uint8_t)0x00) /*!< AF0: MCO Alternate Function mapping */
bogdanm 92:4fc01daae5a5 441 #define GPIO_AF0_CEC ((uint8_t)0x00) /*!< AF0: CEC Alternate Function mapping */
bogdanm 92:4fc01daae5a5 442 #define GPIO_AF0_CRS ((uint8_t)0x00) /*!< AF0: CRS Alternate Function mapping */
bogdanm 92:4fc01daae5a5 443 #define GPIO_AF0_IR ((uint8_t)0x00) /*!< AF0: IR Alternate Function mapping */
bogdanm 92:4fc01daae5a5 444 #define GPIO_AF0_SPI1 ((uint8_t)0x00) /*!< AF0: SPI1/I2S1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 445 #define GPIO_AF0_SPI2 ((uint8_t)0x00) /*!< AF0: SPI2/I2S2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 446 #define GPIO_AF0_TIM1 ((uint8_t)0x00) /*!< AF0: TIM1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 447 #define GPIO_AF0_TIM3 ((uint8_t)0x00) /*!< AF0: TIM3 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 448 #define GPIO_AF0_TIM14 ((uint8_t)0x00) /*!< AF0: TIM14 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 449 #define GPIO_AF0_TIM15 ((uint8_t)0x00) /*!< AF0: TIM15 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 450 #define GPIO_AF0_TIM16 ((uint8_t)0x00) /*!< AF0: TIM16 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 451 #define GPIO_AF0_TIM17 ((uint8_t)0x00) /*!< AF0: TIM17 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 452 #define GPIO_AF0_TSC ((uint8_t)0x00) /*!< AF0: TSC Alternate Function mapping */
bogdanm 92:4fc01daae5a5 453 #define GPIO_AF0_USART1 ((uint8_t)0x00) /*!< AF0: USART1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 454 #define GPIO_AF0_USART2 ((uint8_t)0x00) /*!< AF0: USART2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 455 #define GPIO_AF0_USART3 ((uint8_t)0x00) /*!< AF0: USART2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 456 #define GPIO_AF0_USART4 ((uint8_t)0x00) /*!< AF0: USART4 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 457 #define GPIO_AF0_CAN ((uint8_t)0x00) /*!< AF0: CAN Alternate Function mapping */
bogdanm 85:024bf7f99721 458
bogdanm 92:4fc01daae5a5 459 /* AF 1 */
bogdanm 92:4fc01daae5a5 460 #define GPIO_AF1_TIM3 ((uint8_t)0x01) /*!< AF1: TIM3 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 461 #define GPIO_AF1_TIM15 ((uint8_t)0x01) /*!< AF1: TIM15 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 462 #define GPIO_AF1_USART1 ((uint8_t)0x01) /*!< AF1: USART1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 463 #define GPIO_AF1_USART2 ((uint8_t)0x01) /*!< AF1: USART2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 464 #define GPIO_AF1_USART3 ((uint8_t)0x01) /*!< AF1: USART3 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 465 #define GPIO_AF1_IR ((uint8_t)0x01) /*!< AF1: IR Alternate Function mapping */
bogdanm 92:4fc01daae5a5 466 #define GPIO_AF1_CEC ((uint8_t)0x01) /*!< AF1: CEC Alternate Function mapping */
bogdanm 92:4fc01daae5a5 467 #define GPIO_AF1_EVENTOUT ((uint8_t)0x01) /*!< AF1: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 468 #define GPIO_AF1_I2C1 ((uint8_t)0x01) /*!< AF1: I2C1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 469 #define GPIO_AF1_I2C2 ((uint8_t)0x01) /*!< AF1: I2C1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 470 #define GPIO_AF1_TSC ((uint8_t)0x01) /*!< AF1: I2C1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 471 #define GPIO_AF1_SPI1 ((uint8_t)0x01) /*!< AF1: SPI1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 472 #define GPIO_AF1_SPI2 ((uint8_t)0x01) /*!< AF1: SPI2 Alternate Function mapping */
bogdanm 85:024bf7f99721 473
bogdanm 92:4fc01daae5a5 474 /* AF 2 */
bogdanm 92:4fc01daae5a5 475 #define GPIO_AF2_TIM1 ((uint8_t)0x02) /*!< AF2: TIM1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 476 #define GPIO_AF2_TIM2 ((uint8_t)0x02) /*!< AF2: TIM2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 477 #define GPIO_AF2_TIM16 ((uint8_t)0x02) /*!< AF2: TIM16 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 478 #define GPIO_AF2_TIM17 ((uint8_t)0x02) /*!< AF2: TIM17 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 479 #define GPIO_AF2_EVENTOUT ((uint8_t)0x02) /*!< AF2: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 480 #define GPIO_AF2_USB ((uint8_t)0x02) /*!< AF2: USB Alternate Function mapping */
bogdanm 85:024bf7f99721 481
bogdanm 92:4fc01daae5a5 482 /* AF 3 */
bogdanm 92:4fc01daae5a5 483 #define GPIO_AF3_EVENTOUT ((uint8_t)0x03) /*!< AF3: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 484 #define GPIO_AF3_TSC ((uint8_t)0x03) /*!< AF3: TSC Alternate Function mapping */
bogdanm 92:4fc01daae5a5 485 #define GPIO_AF3_TIM15 ((uint8_t)0x03) /*!< AF3: TIM15 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 486 #define GPIO_AF3_I2C1 ((uint8_t)0x03) /*!< AF3: I2C1 Alternate Function mapping */
bogdanm 85:024bf7f99721 487
bogdanm 92:4fc01daae5a5 488 /* AF 4 */
bogdanm 92:4fc01daae5a5 489 #define GPIO_AF4_TIM14 ((uint8_t)0x04) /*!< AF4: TIM14 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 490 #define GPIO_AF4_USART4 ((uint8_t)0x04) /*!< AF4: USART4 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 491 #define GPIO_AF4_USART3 ((uint8_t)0x04) /*!< AF4: USART3 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 492 #define GPIO_AF4_CRS ((uint8_t)0x04) /*!< AF4: CRS Alternate Function mapping */
bogdanm 92:4fc01daae5a5 493 #define GPIO_AF4_CAN ((uint8_t)0x04) /*!< AF4: CAN Alternate Function mapping */
bogdanm 85:024bf7f99721 494
bogdanm 92:4fc01daae5a5 495 /* AF 5 */
bogdanm 92:4fc01daae5a5 496 #define GPIO_AF5_TIM15 ((uint8_t)0x05) /*!< AF5: TIM15 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 497 #define GPIO_AF5_TIM16 ((uint8_t)0x05) /*!< AF5: TIM16 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 498 #define GPIO_AF5_TIM17 ((uint8_t)0x05) /*!< AF5: TIM17 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 499 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /*!< AF5: SPI2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 500 #define GPIO_AF5_I2C2 ((uint8_t)0x05) /*!< AF5: I2C2 Alternate Function mapping */
bogdanm 85:024bf7f99721 501
bogdanm 92:4fc01daae5a5 502 /* AF 6 */
bogdanm 92:4fc01daae5a5 503 #define GPIO_AF6_EVENTOUT ((uint8_t)0x06) /*!< AF6: EVENTOUT Alternate Function mapping */
bogdanm 85:024bf7f99721 504
bogdanm 92:4fc01daae5a5 505 /* AF 7 */
bogdanm 92:4fc01daae5a5 506 #define GPIO_AF7_COMP1 ((uint8_t)0x07) /*!< AF7: COMP1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 507 #define GPIO_AF7_COMP2 ((uint8_t)0x07) /*!< AF7: COMP2 Alternate Function mapping */
bogdanm 85:024bf7f99721 508
bogdanm 92:4fc01daae5a5 509 #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x07)
bogdanm 85:024bf7f99721 510
bogdanm 85:024bf7f99721 511 #endif /* STM32F072xB || STM32F078xx */
bogdanm 85:024bf7f99721 512
bogdanm 85:024bf7f99721 513 #if defined (STM32F042x6) || defined (STM32F048xx)
bogdanm 85:024bf7f99721 514 /*--------------------------- STM32F042x6/STM32F048xx ---------------------------*/
bogdanm 92:4fc01daae5a5 515 /* AF 0 */
bogdanm 92:4fc01daae5a5 516 #define GPIO_AF0_EVENTOUT ((uint8_t)0x00) /*!< AF0: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 517 #define GPIO_AF0_CEC ((uint8_t)0x00) /*!< AF0: CEC Alternate Function mapping */
bogdanm 92:4fc01daae5a5 518 #define GPIO_AF0_CRS ((uint8_t)0x00) /*!< AF0: CRS Alternate Function mapping */
bogdanm 92:4fc01daae5a5 519 #define GPIO_AF0_IR ((uint8_t)0x00) /*!< AF0: IR Alternate Function mapping */
bogdanm 92:4fc01daae5a5 520 #define GPIO_AF0_MCO ((uint8_t)0x00) /*!< AF0: MCO Alternate Function mapping */
bogdanm 92:4fc01daae5a5 521 #define GPIO_AF0_SPI1 ((uint8_t)0x00) /*!< AF0: SPI1/I2S1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 522 #define GPIO_AF0_SPI2 ((uint8_t)0x00) /*!< AF0: SPI2/I2S2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 523 #define GPIO_AF0_SWDIO ((uint8_t)0x00) /*!< AF0: SWDIO Alternate Function mapping */
bogdanm 92:4fc01daae5a5 524 #define GPIO_AF0_SWCLK ((uint8_t)0x00) /*!< AF0: SWCLK Alternate Function mapping */
bogdanm 92:4fc01daae5a5 525 #define GPIO_AF0_TIM14 ((uint8_t)0x00) /*!< AF0: TIM14 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 526 #define GPIO_AF0_TIM17 ((uint8_t)0x00) /*!< AF0: TIM17 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 527 #define GPIO_AF0_USART1 ((uint8_t)0x00) /*!< AF0: USART1 Alternate Function mapping */
bogdanm 85:024bf7f99721 528
bogdanm 92:4fc01daae5a5 529 /* AF 1 */
bogdanm 92:4fc01daae5a5 530 #define GPIO_AF1_CEC ((uint8_t)0x01) /*!< AF1: CEC Alternate Function mapping */
bogdanm 92:4fc01daae5a5 531 #define GPIO_AF1_EVENTOUT ((uint8_t)0x01) /*!< AF1: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 532 #define GPIO_AF1_I2C1 ((uint8_t)0x01) /*!< AF1: I2C1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 533 #define GPIO_AF1_IR ((uint8_t)0x01) /*!< AF1: IR Alternate Function mapping */
bogdanm 92:4fc01daae5a5 534 #define GPIO_AF1_USART1 ((uint8_t)0x01) /*!< AF1: USART1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 535 #define GPIO_AF1_USART2 ((uint8_t)0x01) /*!< AF1: USART2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 536 #define GPIO_AF1_TIM3 ((uint8_t)0x01) /*!< AF1: TIM3 Alternate Function mapping */
bogdanm 85:024bf7f99721 537
bogdanm 92:4fc01daae5a5 538 /* AF 2 */
bogdanm 92:4fc01daae5a5 539 #define GPIO_AF2_EVENTOUT ((uint8_t)0x02) /*!< AF2: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 540 #define GPIO_AF2_TIM1 ((uint8_t)0x02) /*!< AF2: TIM1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 541 #define GPIO_AF2_TIM2 ((uint8_t)0x02) /*!< AF2: TIM2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 542 #define GPIO_AF2_TIM16 ((uint8_t)0x02) /*!< AF2: TIM16 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 543 #define GPIO_AF2_TIM17 ((uint8_t)0x02) /*!< AF2: TIM17 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 544 #define GPIO_AF2_USB ((uint8_t)0x02) /*!< AF2: USB Alternate Function mapping */
bogdanm 85:024bf7f99721 545
bogdanm 92:4fc01daae5a5 546 /* AF 3 */
bogdanm 92:4fc01daae5a5 547 #define GPIO_AF3_EVENTOUT ((uint8_t)0x03) /*!< AF3: EVENTOUT Alternate Function mapping */
bogdanm 92:4fc01daae5a5 548 #define GPIO_AF3_I2C1 ((uint8_t)0x03) /*!< AF3: I2C1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 549 #define GPIO_AF3_TSC ((uint8_t)0x03) /*!< AF3: TSC Alternate Function mapping */
bogdanm 85:024bf7f99721 550
bogdanm 92:4fc01daae5a5 551 /* AF 4 */
bogdanm 92:4fc01daae5a5 552 #define GPIO_AF4_TIM14 ((uint8_t)0x04) /*!< AF4: TIM14 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 553 #define GPIO_AF4_CAN ((uint8_t)0x04) /*!< AF4: CAN Alternate Function mapping */
bogdanm 92:4fc01daae5a5 554 #define GPIO_AF4_CRS ((uint8_t)0x04) /*!< AF4: CRS Alternate Function mapping */
bogdanm 92:4fc01daae5a5 555 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /*!< AF4: I2C1 Alternate Function mapping */
bogdanm 85:024bf7f99721 556
bogdanm 92:4fc01daae5a5 557 /* AF 5 */
bogdanm 92:4fc01daae5a5 558 #define GPIO_AF5_MCO ((uint8_t)0x05) /*!< AF5: MCO Alternate Function mapping */
bogdanm 92:4fc01daae5a5 559 #define GPIO_AF5_I2C1 ((uint8_t)0x05) /*!< AF5: I2C1 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 560 #define GPIO_AF5_I2C2 ((uint8_t)0x05) /*!< AF5: I2C2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 561 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /*!< AF5: SPI2 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 562 #define GPIO_AF5_TIM16 ((uint8_t)0x05) /*!< AF5: TIM16 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 563 #define GPIO_AF5_TIM17 ((uint8_t)0x05) /*!< AF5: TIM17 Alternate Function mapping */
bogdanm 92:4fc01daae5a5 564 #define GPIO_AF5_USB ((uint8_t)0x05) /*!< AF5: USB Alternate Function mapping */
bogdanm 85:024bf7f99721 565
bogdanm 92:4fc01daae5a5 566 /* AF 6 */
bogdanm 92:4fc01daae5a5 567 #define GPIO_AF6_EVENTOUT ((uint8_t)0x06) /*!< AF6: EVENTOUT Alternate Function mapping */
bogdanm 85:024bf7f99721 568
bogdanm 92:4fc01daae5a5 569 #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x06)
bogdanm 85:024bf7f99721 570
bogdanm 85:024bf7f99721 571 #endif /* STM32F042x6 || STM32F048xx */
bogdanm 85:024bf7f99721 572 /**
bogdanm 85:024bf7f99721 573 * @}
bogdanm 85:024bf7f99721 574 */
bogdanm 85:024bf7f99721 575
bogdanm 85:024bf7f99721 576 /**
bogdanm 85:024bf7f99721 577 * @}
bogdanm 85:024bf7f99721 578 */
bogdanm 85:024bf7f99721 579
bogdanm 85:024bf7f99721 580 /* Exported macro ------------------------------------------------------------*/
bogdanm 92:4fc01daae5a5 581 /** @defgroup GPIOEx_Exported_Macros GPIOEx Exported Macros
bogdanm 92:4fc01daae5a5 582 * @{
bogdanm 92:4fc01daae5a5 583 */
bogdanm 92:4fc01daae5a5 584
bogdanm 92:4fc01daae5a5 585 /** @defgroup GPIOEx_Get_Port_Index GPIOEx_Get Port Index
bogdanm 92:4fc01daae5a5 586 * @{
bogdanm 92:4fc01daae5a5 587 */
bogdanm 92:4fc01daae5a5 588 #if defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
bogdanm 92:4fc01daae5a5 589 defined (STM32F091xC) || defined (STM32F098xx)
bogdanm 92:4fc01daae5a5 590 #define GET_GPIO_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
bogdanm 92:4fc01daae5a5 591 ((__GPIOx__) == (GPIOB))? 1U :\
bogdanm 92:4fc01daae5a5 592 ((__GPIOx__) == (GPIOC))? 2U :\
bogdanm 92:4fc01daae5a5 593 ((__GPIOx__) == (GPIOD))? 3U :\
bogdanm 92:4fc01daae5a5 594 ((__GPIOx__) == (GPIOE))? 4U : 5U)
bogdanm 92:4fc01daae5a5 595 #endif
bogdanm 85:024bf7f99721 596
bogdanm 92:4fc01daae5a5 597 #if defined (STM32F030x6) || defined (STM32F030x8) || \
bogdanm 92:4fc01daae5a5 598 defined (STM32F051x8) || defined (STM32F058xx)
bogdanm 92:4fc01daae5a5 599 #define GET_GPIO_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
bogdanm 92:4fc01daae5a5 600 ((__GPIOx__) == (GPIOB))? 1U :\
bogdanm 92:4fc01daae5a5 601 ((__GPIOx__) == (GPIOC))? 2U :\
bogdanm 92:4fc01daae5a5 602 ((__GPIOx__) == (GPIOD))? 3U : 5U)
bogdanm 92:4fc01daae5a5 603 #endif
bogdanm 85:024bf7f99721 604
bogdanm 92:4fc01daae5a5 605 #if defined (STM32F031x6) || defined (STM32F038xx) || \
bogdanm 92:4fc01daae5a5 606 defined (STM32F042x6) || defined (STM32F048xx)
bogdanm 92:4fc01daae5a5 607 #define GET_GPIO_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
bogdanm 92:4fc01daae5a5 608 ((__GPIOx__) == (GPIOB))? 1U :\
bogdanm 92:4fc01daae5a5 609 ((__GPIOx__) == (GPIOC))? 2U : 5U)
bogdanm 92:4fc01daae5a5 610 #endif
bogdanm 92:4fc01daae5a5 611
bogdanm 92:4fc01daae5a5 612 /**
bogdanm 92:4fc01daae5a5 613 * @}
bogdanm 92:4fc01daae5a5 614 */
bogdanm 92:4fc01daae5a5 615
bogdanm 92:4fc01daae5a5 616 /**
bogdanm 92:4fc01daae5a5 617 * @}
bogdanm 92:4fc01daae5a5 618 */
bogdanm 92:4fc01daae5a5 619
bogdanm 92:4fc01daae5a5 620 /* Exported functions --------------------------------------------------------*/
bogdanm 85:024bf7f99721 621 /**
bogdanm 85:024bf7f99721 622 * @}
bogdanm 85:024bf7f99721 623 */
bogdanm 85:024bf7f99721 624
bogdanm 85:024bf7f99721 625 /**
bogdanm 85:024bf7f99721 626 * @}
bogdanm 85:024bf7f99721 627 */
bogdanm 85:024bf7f99721 628
bogdanm 85:024bf7f99721 629 #ifdef __cplusplus
bogdanm 85:024bf7f99721 630 }
bogdanm 85:024bf7f99721 631 #endif
bogdanm 85:024bf7f99721 632
bogdanm 85:024bf7f99721 633 #endif /* __STM32F0xx_HAL_GPIO_EX_H */
bogdanm 85:024bf7f99721 634
bogdanm 85:024bf7f99721 635 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
bogdanm 92:4fc01daae5a5 636