DHT11

Committer:
jhon309
Date:
Thu Aug 13 00:21:57 2015 +0000
Revision:
0:c52df770855b
DHT11

Who changed what in which revision?

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