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