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