The official mbed C/C SDK provides the software platform and libraries to build your applications.
Fork of mbed by
TARGET_NUCLEO_F334R8/stm32f3xx_hal_gpio_ex.h@86:04dd9b1680ae, 2014-07-02 (annotated)
- Committer:
- bogdanm
- Date:
- Wed Jul 02 13:22:23 2014 +0100
- Revision:
- 86:04dd9b1680ae
- Child:
- 92:4fc01daae5a5
Release 86 of the mbed library
Main changes:
- bug fixes in various backends
- mbed "error" replaced by assert logic (mbed_assert)
- new ST Nucleo targets
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 86:04dd9b1680ae | 1 | /** |
bogdanm | 86:04dd9b1680ae | 2 | ****************************************************************************** |
bogdanm | 86:04dd9b1680ae | 3 | * @file stm32f3xx_hal_gpio_ex.h |
bogdanm | 86:04dd9b1680ae | 4 | * @author MCD Application Team |
bogdanm | 86:04dd9b1680ae | 5 | * @version V1.0.1 |
bogdanm | 86:04dd9b1680ae | 6 | * @date 18-June-2014 |
bogdanm | 86:04dd9b1680ae | 7 | * @brief Header file of GPIO HAL Extension module. |
bogdanm | 86:04dd9b1680ae | 8 | ****************************************************************************** |
bogdanm | 86:04dd9b1680ae | 9 | * @attention |
bogdanm | 86:04dd9b1680ae | 10 | * |
bogdanm | 86:04dd9b1680ae | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
bogdanm | 86:04dd9b1680ae | 12 | * |
bogdanm | 86:04dd9b1680ae | 13 | * Redistribution and use in source and binary forms, with or without modification, |
bogdanm | 86:04dd9b1680ae | 14 | * are permitted provided that the following conditions are met: |
bogdanm | 86:04dd9b1680ae | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
bogdanm | 86:04dd9b1680ae | 16 | * this list of conditions and the following disclaimer. |
bogdanm | 86:04dd9b1680ae | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
bogdanm | 86:04dd9b1680ae | 18 | * this list of conditions and the following disclaimer in the documentation |
bogdanm | 86:04dd9b1680ae | 19 | * and/or other materials provided with the distribution. |
bogdanm | 86:04dd9b1680ae | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
bogdanm | 86:04dd9b1680ae | 21 | * may be used to endorse or promote products derived from this software |
bogdanm | 86:04dd9b1680ae | 22 | * without specific prior written permission. |
bogdanm | 86:04dd9b1680ae | 23 | * |
bogdanm | 86:04dd9b1680ae | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
bogdanm | 86:04dd9b1680ae | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
bogdanm | 86:04dd9b1680ae | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
bogdanm | 86:04dd9b1680ae | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
bogdanm | 86:04dd9b1680ae | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
bogdanm | 86:04dd9b1680ae | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
bogdanm | 86:04dd9b1680ae | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
bogdanm | 86:04dd9b1680ae | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
bogdanm | 86:04dd9b1680ae | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
bogdanm | 86:04dd9b1680ae | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
bogdanm | 86:04dd9b1680ae | 34 | * |
bogdanm | 86:04dd9b1680ae | 35 | ****************************************************************************** |
bogdanm | 86:04dd9b1680ae | 36 | */ |
bogdanm | 86:04dd9b1680ae | 37 | |
bogdanm | 86:04dd9b1680ae | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 39 | #ifndef __STM32F3xx_HAL_GPIO_EX_H |
bogdanm | 86:04dd9b1680ae | 40 | #define __STM32F3xx_HAL_GPIO_EX_H |
bogdanm | 86:04dd9b1680ae | 41 | |
bogdanm | 86:04dd9b1680ae | 42 | #ifdef __cplusplus |
bogdanm | 86:04dd9b1680ae | 43 | extern "C" { |
bogdanm | 86:04dd9b1680ae | 44 | #endif |
bogdanm | 86:04dd9b1680ae | 45 | |
bogdanm | 86:04dd9b1680ae | 46 | /* Includes ------------------------------------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 47 | #include "stm32f3xx_hal_def.h" |
bogdanm | 86:04dd9b1680ae | 48 | |
bogdanm | 86:04dd9b1680ae | 49 | /** @addtogroup STM32F3xx_HAL_Driver |
bogdanm | 86:04dd9b1680ae | 50 | * @{ |
bogdanm | 86:04dd9b1680ae | 51 | */ |
bogdanm | 86:04dd9b1680ae | 52 | |
bogdanm | 86:04dd9b1680ae | 53 | /** @addtogroup GPIOEx |
bogdanm | 86:04dd9b1680ae | 54 | * @{ |
bogdanm | 86:04dd9b1680ae | 55 | */ |
bogdanm | 86:04dd9b1680ae | 56 | |
bogdanm | 86:04dd9b1680ae | 57 | /* Exported types ------------------------------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 58 | |
bogdanm | 86:04dd9b1680ae | 59 | /* Exported constants --------------------------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 60 | |
bogdanm | 86:04dd9b1680ae | 61 | /** @defgroup GPIOEx_Exported_Constants GPIOEx_Exported_Constants |
bogdanm | 86:04dd9b1680ae | 62 | * @{ |
bogdanm | 86:04dd9b1680ae | 63 | */ |
bogdanm | 86:04dd9b1680ae | 64 | |
bogdanm | 86:04dd9b1680ae | 65 | /** @defgroup GPIOEx_Alternate_function_selection GPIOEx_Alternate_function_selection |
bogdanm | 86:04dd9b1680ae | 66 | * @{ |
bogdanm | 86:04dd9b1680ae | 67 | */ |
bogdanm | 86:04dd9b1680ae | 68 | |
bogdanm | 86:04dd9b1680ae | 69 | #if defined (STM32F302xC) || defined (STM32F303xC) |
bogdanm | 86:04dd9b1680ae | 70 | /*------------------------- STM32F302xC/STM32F303xC---------------------------*/ |
bogdanm | 86:04dd9b1680ae | 71 | /** |
bogdanm | 86:04dd9b1680ae | 72 | * @brief AF 0 selection |
bogdanm | 86:04dd9b1680ae | 73 | */ |
bogdanm | 86:04dd9b1680ae | 74 | #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 75 | #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 76 | #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 77 | #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 78 | #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 79 | |
bogdanm | 86:04dd9b1680ae | 80 | /** |
bogdanm | 86:04dd9b1680ae | 81 | * @brief AF 1 selection |
bogdanm | 86:04dd9b1680ae | 82 | */ |
bogdanm | 86:04dd9b1680ae | 83 | #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 84 | #define GPIO_AF1_TIM15 ((uint8_t)0x01) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 85 | #define GPIO_AF1_TIM16 ((uint8_t)0x01) /* TIM16 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 86 | #define GPIO_AF1_TIM17 ((uint8_t)0x01) /* TIM17 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 87 | #define GPIO_AF1_EVENTOUT ((uint8_t)0x01) /* EVENTOUT Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 88 | /** |
bogdanm | 86:04dd9b1680ae | 89 | * @brief AF 2 selection |
bogdanm | 86:04dd9b1680ae | 90 | */ |
bogdanm | 86:04dd9b1680ae | 91 | #define GPIO_AF2_TIM1 ((uint8_t)0x02) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 92 | #define GPIO_AF2_TIM2 ((uint8_t)0x02) /* TIM2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 93 | #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 94 | #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 95 | #define GPIO_AF2_TIM8 ((uint8_t)0x02) /* TIM8 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 96 | #define GPIO_AF2_TIM15 ((uint8_t)0x02) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 97 | #define GPIO_AF2_COMP1 ((uint8_t)0x02) /* COMP1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 98 | /** |
bogdanm | 86:04dd9b1680ae | 99 | * @brief AF 3 selection |
bogdanm | 86:04dd9b1680ae | 100 | */ |
bogdanm | 86:04dd9b1680ae | 101 | #define GPIO_AF3_TSC ((uint8_t)0x03) /* TSC Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 102 | #define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 103 | #define GPIO_AF3_COMP7 ((uint8_t)0x03) /* COMP7 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 104 | #define GPIO_AF3_TIM15 ((uint8_t)0x03) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 105 | |
bogdanm | 86:04dd9b1680ae | 106 | /** |
bogdanm | 86:04dd9b1680ae | 107 | * @brief AF 4 selection |
bogdanm | 86:04dd9b1680ae | 108 | */ |
bogdanm | 86:04dd9b1680ae | 109 | #define GPIO_AF4_TIM1 ((uint8_t)0x04) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 110 | #define GPIO_AF4_TIM8 ((uint8_t)0x04) /* TIM8 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 111 | #define GPIO_AF4_TIM16 ((uint8_t)0x04) /* TIM16 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 112 | #define GPIO_AF4_TIM17 ((uint8_t)0x04) /* TIM17 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 113 | #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 114 | #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 115 | |
bogdanm | 86:04dd9b1680ae | 116 | /** |
bogdanm | 86:04dd9b1680ae | 117 | * @brief AF 5 selection |
bogdanm | 86:04dd9b1680ae | 118 | */ |
bogdanm | 86:04dd9b1680ae | 119 | #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1/I2S1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 120 | #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 121 | #define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3/I2S3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 122 | #define GPIO_AF5_I2S ((uint8_t)0x05) /* I2S Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 123 | #define GPIO_AF5_I2S2ext ((uint8_t)0x05) /* I2S2ext Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 124 | #define GPIO_AF5_TIM8 ((uint8_t)0x05) /* TIM8 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 125 | #define GPIO_AF5_IR ((uint8_t)0x05) /* IR Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 126 | #define GPIO_AF5_UART4 ((uint8_t)0x05) /* UART4 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 127 | #define GPIO_AF5_UART5 ((uint8_t)0x05) /* UART5 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 128 | /** |
bogdanm | 86:04dd9b1680ae | 129 | * @brief AF 6 selection |
bogdanm | 86:04dd9b1680ae | 130 | */ |
bogdanm | 86:04dd9b1680ae | 131 | #define GPIO_AF6_SPI2 ((uint8_t)0x06) /* SPI2/I2S2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 132 | #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 133 | #define GPIO_AF6_I2S3ext ((uint8_t)0x06) /* I2S3ext Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 134 | #define GPIO_AF6_TIM1 ((uint8_t)0x06) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 135 | #define GPIO_AF6_TIM8 ((uint8_t)0x06) /* TIM8 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 136 | #define GPIO_AF6_IR ((uint8_t)0x06) /* IR Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 137 | |
bogdanm | 86:04dd9b1680ae | 138 | /** |
bogdanm | 86:04dd9b1680ae | 139 | * @brief AF 7 selection |
bogdanm | 86:04dd9b1680ae | 140 | */ |
bogdanm | 86:04dd9b1680ae | 141 | #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 142 | #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 143 | #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 144 | #define GPIO_AF7_COMP3 ((uint8_t)0x07) /* COMP3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 145 | #define GPIO_AF7_COMP5 ((uint8_t)0x07) /* COMP5 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 146 | #define GPIO_AF7_COMP6 ((uint8_t)0x07) /* COMP6 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 147 | #define GPIO_AF7_CAN ((uint8_t)0x07) /* CAN Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 148 | |
bogdanm | 86:04dd9b1680ae | 149 | /** |
bogdanm | 86:04dd9b1680ae | 150 | * @brief AF 8 selection |
bogdanm | 86:04dd9b1680ae | 151 | */ |
bogdanm | 86:04dd9b1680ae | 152 | #define GPIO_AF8_COMP1 ((uint8_t)0x08) /* COMP1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 153 | #define GPIO_AF8_COMP2 ((uint8_t)0x08) /* COMP2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 154 | #define GPIO_AF8_COMP3 ((uint8_t)0x08) /* COMP3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 155 | #define GPIO_AF8_COMP4 ((uint8_t)0x08) /* COMP4 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 156 | #define GPIO_AF8_COMP5 ((uint8_t)0x08) /* COMP5 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 157 | #define GPIO_AF8_COMP6 ((uint8_t)0x08) /* COMP6 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 158 | |
bogdanm | 86:04dd9b1680ae | 159 | /** |
bogdanm | 86:04dd9b1680ae | 160 | * @brief AF 9 selection |
bogdanm | 86:04dd9b1680ae | 161 | */ |
bogdanm | 86:04dd9b1680ae | 162 | #define GPIO_AF9_CAN ((uint8_t)0x09) /* CAN Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 163 | #define GPIO_AF9_TIM1 ((uint8_t)0x09) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 164 | #define GPIO_AF9_TIM8 ((uint8_t)0x09) /* TIM8 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 165 | #define GPIO_AF9_TIM15 ((uint8_t)0x09) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 166 | |
bogdanm | 86:04dd9b1680ae | 167 | /** |
bogdanm | 86:04dd9b1680ae | 168 | * @brief AF 10 selection |
bogdanm | 86:04dd9b1680ae | 169 | */ |
bogdanm | 86:04dd9b1680ae | 170 | #define GPIO_AF10_TIM2 ((uint8_t)0xA) /* TIM2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 171 | #define GPIO_AF10_TIM3 ((uint8_t)0xA) /* TIM3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 172 | #define GPIO_AF10_TIM4 ((uint8_t)0xA) /* TIM4 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 173 | #define GPIO_AF10_TIM8 ((uint8_t)0xA) /* TIM8 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 174 | #define GPIO_AF10_TIM17 ((uint8_t)0xA) /* TIM17 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 175 | /** |
bogdanm | 86:04dd9b1680ae | 176 | * @brief AF 11 selection |
bogdanm | 86:04dd9b1680ae | 177 | */ |
bogdanm | 86:04dd9b1680ae | 178 | #define GPIO_AF11_TIM1 ((uint8_t)0x0B) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 179 | #define GPIO_AF11_TIM8 ((uint8_t)0x0B) /* TIM8 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 180 | |
bogdanm | 86:04dd9b1680ae | 181 | /** |
bogdanm | 86:04dd9b1680ae | 182 | * @brief AF 12 selection |
bogdanm | 86:04dd9b1680ae | 183 | */ |
bogdanm | 86:04dd9b1680ae | 184 | #define GPIO_AF12_TIM1 ((uint8_t)0xC) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 185 | |
bogdanm | 86:04dd9b1680ae | 186 | /** |
bogdanm | 86:04dd9b1680ae | 187 | * @brief AF 14 selection |
bogdanm | 86:04dd9b1680ae | 188 | */ |
bogdanm | 86:04dd9b1680ae | 189 | |
bogdanm | 86:04dd9b1680ae | 190 | #define GPIO_AF14_USB ((uint8_t)0x0E) /* USB Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 191 | /** |
bogdanm | 86:04dd9b1680ae | 192 | * @brief AF 15 selection |
bogdanm | 86:04dd9b1680ae | 193 | */ |
bogdanm | 86:04dd9b1680ae | 194 | #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 195 | |
bogdanm | 86:04dd9b1680ae | 196 | #define IS_GPIO_AF(AF) (((AF) <= (uint8_t)0x0C) || ((AF) == (uint8_t)0x0E) || ((AF) == (uint8_t)0x0F)) |
bogdanm | 86:04dd9b1680ae | 197 | /*------------------------------------------------------------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 198 | #endif /* STM32F302xC || STM32F303xC */ |
bogdanm | 86:04dd9b1680ae | 199 | |
bogdanm | 86:04dd9b1680ae | 200 | #if defined (STM32F358xx) |
bogdanm | 86:04dd9b1680ae | 201 | /*---------------------------------- STM32F358xx -------------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 202 | /** |
bogdanm | 86:04dd9b1680ae | 203 | * @brief AF 0 selection |
bogdanm | 86:04dd9b1680ae | 204 | */ |
bogdanm | 86:04dd9b1680ae | 205 | #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 206 | #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 207 | #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 208 | #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 209 | #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 210 | |
bogdanm | 86:04dd9b1680ae | 211 | /** |
bogdanm | 86:04dd9b1680ae | 212 | * @brief AF 1 selection |
bogdanm | 86:04dd9b1680ae | 213 | */ |
bogdanm | 86:04dd9b1680ae | 214 | #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 215 | #define GPIO_AF1_TIM15 ((uint8_t)0x01) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 216 | #define GPIO_AF1_TIM16 ((uint8_t)0x01) /* TIM16 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 217 | #define GPIO_AF1_TIM17 ((uint8_t)0x01) /* TIM17 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 218 | #define GPIO_AF1_EVENTOUT ((uint8_t)0x01) /* EVENTOUT Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 219 | /** |
bogdanm | 86:04dd9b1680ae | 220 | * @brief AF 2 selection |
bogdanm | 86:04dd9b1680ae | 221 | */ |
bogdanm | 86:04dd9b1680ae | 222 | #define GPIO_AF2_TIM1 ((uint8_t)0x02) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 223 | #define GPIO_AF2_TIM2 ((uint8_t)0x02) /* TIM2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 224 | #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 225 | #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 226 | #define GPIO_AF2_TIM8 ((uint8_t)0x02) /* TIM8 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 227 | #define GPIO_AF2_TIM15 ((uint8_t)0x02) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 228 | #define GPIO_AF2_COMP1 ((uint8_t)0x02) /* COMP1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 229 | /** |
bogdanm | 86:04dd9b1680ae | 230 | * @brief AF 3 selection |
bogdanm | 86:04dd9b1680ae | 231 | */ |
bogdanm | 86:04dd9b1680ae | 232 | #define GPIO_AF3_TSC ((uint8_t)0x03) /* TSC Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 233 | #define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 234 | #define GPIO_AF3_COMP7 ((uint8_t)0x03) /* COMP7 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 235 | #define GPIO_AF3_TIM15 ((uint8_t)0x03) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 236 | |
bogdanm | 86:04dd9b1680ae | 237 | /** |
bogdanm | 86:04dd9b1680ae | 238 | * @brief AF 4 selection |
bogdanm | 86:04dd9b1680ae | 239 | */ |
bogdanm | 86:04dd9b1680ae | 240 | #define GPIO_AF4_TIM1 ((uint8_t)0x04) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 241 | #define GPIO_AF4_TIM8 ((uint8_t)0x04) /* TIM8 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 242 | #define GPIO_AF4_TIM16 ((uint8_t)0x04) /* TIM16 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 243 | #define GPIO_AF4_TIM17 ((uint8_t)0x04) /* TIM17 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 244 | #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 245 | #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 246 | |
bogdanm | 86:04dd9b1680ae | 247 | /** |
bogdanm | 86:04dd9b1680ae | 248 | * @brief AF 5 selection |
bogdanm | 86:04dd9b1680ae | 249 | */ |
bogdanm | 86:04dd9b1680ae | 250 | #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1/I2S1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 251 | #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 252 | #define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3/I2S3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 253 | #define GPIO_AF5_I2S ((uint8_t)0x05) /* I2S Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 254 | #define GPIO_AF5_I2S2ext ((uint8_t)0x05) /* I2S2ext Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 255 | #define GPIO_AF5_TIM8 ((uint8_t)0x05) /* TIM8 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 256 | #define GPIO_AF5_IR ((uint8_t)0x05) /* IR Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 257 | #define GPIO_AF5_UART4 ((uint8_t)0x05) /* UART4 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 258 | #define GPIO_AF5_UART5 ((uint8_t)0x05) /* UART5 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 259 | /** |
bogdanm | 86:04dd9b1680ae | 260 | * @brief AF 6 selection |
bogdanm | 86:04dd9b1680ae | 261 | */ |
bogdanm | 86:04dd9b1680ae | 262 | #define GPIO_AF6_SPI2 ((uint8_t)0x06) /* SPI2/I2S2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 263 | #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 264 | #define GPIO_AF6_I2S3ext ((uint8_t)0x06) /* I2S3ext Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 265 | #define GPIO_AF6_TIM1 ((uint8_t)0x06) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 266 | #define GPIO_AF6_TIM8 ((uint8_t)0x06) /* TIM8 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 267 | #define GPIO_AF6_IR ((uint8_t)0x06) /* IR Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 268 | |
bogdanm | 86:04dd9b1680ae | 269 | /** |
bogdanm | 86:04dd9b1680ae | 270 | * @brief AF 7 selection |
bogdanm | 86:04dd9b1680ae | 271 | */ |
bogdanm | 86:04dd9b1680ae | 272 | #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 273 | #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 274 | #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 275 | #define GPIO_AF7_COMP3 ((uint8_t)0x07) /* COMP3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 276 | #define GPIO_AF7_COMP5 ((uint8_t)0x07) /* COMP5 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 277 | #define GPIO_AF7_COMP6 ((uint8_t)0x07) /* COMP6 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 278 | #define GPIO_AF7_CAN ((uint8_t)0x07) /* CAN Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 279 | |
bogdanm | 86:04dd9b1680ae | 280 | /** |
bogdanm | 86:04dd9b1680ae | 281 | * @brief AF 8 selection |
bogdanm | 86:04dd9b1680ae | 282 | */ |
bogdanm | 86:04dd9b1680ae | 283 | #define GPIO_AF8_COMP1 ((uint8_t)0x08) /* COMP1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 284 | #define GPIO_AF8_COMP2 ((uint8_t)0x08) /* COMP2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 285 | #define GPIO_AF8_COMP3 ((uint8_t)0x08) /* COMP3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 286 | #define GPIO_AF8_COMP4 ((uint8_t)0x08) /* COMP4 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 287 | #define GPIO_AF8_COMP5 ((uint8_t)0x08) /* COMP5 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 288 | #define GPIO_AF8_COMP6 ((uint8_t)0x08) /* COMP6 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 289 | |
bogdanm | 86:04dd9b1680ae | 290 | /** |
bogdanm | 86:04dd9b1680ae | 291 | * @brief AF 9 selection |
bogdanm | 86:04dd9b1680ae | 292 | */ |
bogdanm | 86:04dd9b1680ae | 293 | #define GPIO_AF9_CAN ((uint8_t)0x09) /* CAN Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 294 | #define GPIO_AF9_TIM1 ((uint8_t)0x09) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 295 | #define GPIO_AF9_TIM8 ((uint8_t)0x09) /* TIM8 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 296 | #define GPIO_AF9_TIM15 ((uint8_t)0x09) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 297 | |
bogdanm | 86:04dd9b1680ae | 298 | /** |
bogdanm | 86:04dd9b1680ae | 299 | * @brief AF 10 selection |
bogdanm | 86:04dd9b1680ae | 300 | */ |
bogdanm | 86:04dd9b1680ae | 301 | #define GPIO_AF10_TIM2 ((uint8_t)0xA) /* TIM2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 302 | #define GPIO_AF10_TIM3 ((uint8_t)0xA) /* TIM3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 303 | #define GPIO_AF10_TIM4 ((uint8_t)0xA) /* TIM4 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 304 | #define GPIO_AF10_TIM8 ((uint8_t)0xA) /* TIM8 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 305 | #define GPIO_AF10_TIM17 ((uint8_t)0xA) /* TIM17 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 306 | /** |
bogdanm | 86:04dd9b1680ae | 307 | * @brief AF 11 selection |
bogdanm | 86:04dd9b1680ae | 308 | */ |
bogdanm | 86:04dd9b1680ae | 309 | #define GPIO_AF11_TIM1 ((uint8_t)0x0B) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 310 | #define GPIO_AF11_TIM8 ((uint8_t)0x0B) /* TIM8 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 311 | |
bogdanm | 86:04dd9b1680ae | 312 | /** |
bogdanm | 86:04dd9b1680ae | 313 | * @brief AF 12 selection |
bogdanm | 86:04dd9b1680ae | 314 | */ |
bogdanm | 86:04dd9b1680ae | 315 | #define GPIO_AF12_TIM1 ((uint8_t)0xC) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 316 | |
bogdanm | 86:04dd9b1680ae | 317 | /** |
bogdanm | 86:04dd9b1680ae | 318 | * @brief AF 15 selection |
bogdanm | 86:04dd9b1680ae | 319 | */ |
bogdanm | 86:04dd9b1680ae | 320 | #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 321 | |
bogdanm | 86:04dd9b1680ae | 322 | #define IS_GPIO_AF(AF) (((AF) <= (uint8_t)0x0C) || ((AF) == (uint8_t)0x0F)) |
bogdanm | 86:04dd9b1680ae | 323 | /*------------------------------------------------------------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 324 | #endif /* STM32F358xx */ |
bogdanm | 86:04dd9b1680ae | 325 | |
bogdanm | 86:04dd9b1680ae | 326 | #if defined (STM32F373xC) |
bogdanm | 86:04dd9b1680ae | 327 | /*---------------------------------- STM32F373xC--------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 328 | /** |
bogdanm | 86:04dd9b1680ae | 329 | * @brief AF 0 selection |
bogdanm | 86:04dd9b1680ae | 330 | */ |
bogdanm | 86:04dd9b1680ae | 331 | #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 332 | #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 333 | #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 334 | #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 335 | #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 336 | |
bogdanm | 86:04dd9b1680ae | 337 | /** |
bogdanm | 86:04dd9b1680ae | 338 | * @brief AF 1 selection |
bogdanm | 86:04dd9b1680ae | 339 | */ |
bogdanm | 86:04dd9b1680ae | 340 | #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 341 | #define GPIO_AF1_TIM15 ((uint8_t)0x01) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 342 | #define GPIO_AF1_TIM16 ((uint8_t)0x01) /* TIM16 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 343 | #define GPIO_AF1_TIM17 ((uint8_t)0x01) /* TIM17 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 344 | #define GPIO_AF1_EVENTOUT ((uint8_t)0x01) /* EVENTOUT Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 345 | /** |
bogdanm | 86:04dd9b1680ae | 346 | * @brief AF 2 selection |
bogdanm | 86:04dd9b1680ae | 347 | */ |
bogdanm | 86:04dd9b1680ae | 348 | #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 349 | #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 350 | #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 351 | #define GPIO_AF2_TIM13 ((uint8_t)0x02) /* TIM13 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 352 | #define GPIO_AF2_TIM14 ((uint8_t)0x02) /* TIM14 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 353 | #define GPIO_AF2_TIM15 ((uint8_t)0x02) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 354 | #define GPIO_AF2_TIM19 ((uint8_t)0x02) /* TIM19 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 355 | |
bogdanm | 86:04dd9b1680ae | 356 | /** |
bogdanm | 86:04dd9b1680ae | 357 | * @brief AF 3 selection |
bogdanm | 86:04dd9b1680ae | 358 | */ |
bogdanm | 86:04dd9b1680ae | 359 | #define GPIO_AF3_TSC ((uint8_t)0x03) /* TSC Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 360 | /** |
bogdanm | 86:04dd9b1680ae | 361 | * @brief AF 4 selection |
bogdanm | 86:04dd9b1680ae | 362 | */ |
bogdanm | 86:04dd9b1680ae | 363 | #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 364 | #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 365 | |
bogdanm | 86:04dd9b1680ae | 366 | /** |
bogdanm | 86:04dd9b1680ae | 367 | * @brief AF 5 selection |
bogdanm | 86:04dd9b1680ae | 368 | */ |
bogdanm | 86:04dd9b1680ae | 369 | #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1/I2S1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 370 | #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 371 | #define GPIO_AF5_IR ((uint8_t)0x05) /* IR Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 372 | /** |
bogdanm | 86:04dd9b1680ae | 373 | * @brief AF 6 selection |
bogdanm | 86:04dd9b1680ae | 374 | */ |
bogdanm | 86:04dd9b1680ae | 375 | #define GPIO_AF6_SPI1 ((uint8_t)0x06) /* SPI1/I2S1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 376 | #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 377 | #define GPIO_AF6_IR ((uint8_t)0x06) /* IR Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 378 | #define GPIO_AF6_CEC ((uint8_t)0x06) /* CEC Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 379 | /** |
bogdanm | 86:04dd9b1680ae | 380 | * @brief AF 7 selection |
bogdanm | 86:04dd9b1680ae | 381 | */ |
bogdanm | 86:04dd9b1680ae | 382 | #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 383 | #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 384 | #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 385 | #define GPIO_AF7_CAN ((uint8_t)0x07) /* CAN Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 386 | #define GPIO_AF7_CEC ((uint8_t)0x07) /* CEC Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 387 | |
bogdanm | 86:04dd9b1680ae | 388 | /** |
bogdanm | 86:04dd9b1680ae | 389 | * @brief AF 8 selection |
bogdanm | 86:04dd9b1680ae | 390 | */ |
bogdanm | 86:04dd9b1680ae | 391 | #define GPIO_AF8_COMP1 ((uint8_t)0x08) /* COMP1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 392 | #define GPIO_AF8_COMP2 ((uint8_t)0x08) /* COMP2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 393 | |
bogdanm | 86:04dd9b1680ae | 394 | /** |
bogdanm | 86:04dd9b1680ae | 395 | * @brief AF 9 selection |
bogdanm | 86:04dd9b1680ae | 396 | */ |
bogdanm | 86:04dd9b1680ae | 397 | #define GPIO_AF9_CAN ((uint8_t)0x09) /* CAN Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 398 | #define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 399 | #define GPIO_AF9_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 400 | #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 401 | #define GPIO_AF9_TIM15 ((uint8_t)0x09) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 402 | /** |
bogdanm | 86:04dd9b1680ae | 403 | * @brief AF 10 selection |
bogdanm | 86:04dd9b1680ae | 404 | */ |
bogdanm | 86:04dd9b1680ae | 405 | #define GPIO_AF10_TIM2 ((uint8_t)0xA) /* TIM2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 406 | #define GPIO_AF10_TIM3 ((uint8_t)0xA) /* TIM3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 407 | #define GPIO_AF10_TIM4 ((uint8_t)0xA) /* TIM4 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 408 | #define GPIO_AF10_TIM12 ((uint8_t)0xA) /* TIM12 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 409 | #define GPIO_AF10_TIM17 ((uint8_t)0xA) /* TIM17 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 410 | /** |
bogdanm | 86:04dd9b1680ae | 411 | * @brief AF 11 selection |
bogdanm | 86:04dd9b1680ae | 412 | */ |
bogdanm | 86:04dd9b1680ae | 413 | #define GPIO_AF11_TIM19 ((uint8_t)0x0B) /* TIM19 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 414 | |
bogdanm | 86:04dd9b1680ae | 415 | |
bogdanm | 86:04dd9b1680ae | 416 | /** |
bogdanm | 86:04dd9b1680ae | 417 | * @brief AF 14 selection |
bogdanm | 86:04dd9b1680ae | 418 | */ |
bogdanm | 86:04dd9b1680ae | 419 | #define GPIO_AF14_USB ((uint8_t)0x0E) /* USB Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 420 | |
bogdanm | 86:04dd9b1680ae | 421 | /** |
bogdanm | 86:04dd9b1680ae | 422 | * @brief AF 15 selection |
bogdanm | 86:04dd9b1680ae | 423 | */ |
bogdanm | 86:04dd9b1680ae | 424 | #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 425 | |
bogdanm | 86:04dd9b1680ae | 426 | #define IS_GPIO_AF(AF) (((AF) <= (uint8_t)0x0B) || ((AF) == (uint8_t)0x0E) || ((AF) == (uint8_t)0x0F)) |
bogdanm | 86:04dd9b1680ae | 427 | /*------------------------------------------------------------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 428 | #endif /* STM32F373xC */ |
bogdanm | 86:04dd9b1680ae | 429 | |
bogdanm | 86:04dd9b1680ae | 430 | |
bogdanm | 86:04dd9b1680ae | 431 | #if defined (STM32F378xx) |
bogdanm | 86:04dd9b1680ae | 432 | /*---------------------------------------- STM32F378xx--------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 433 | /** |
bogdanm | 86:04dd9b1680ae | 434 | * @brief AF 0 selection |
bogdanm | 86:04dd9b1680ae | 435 | */ |
bogdanm | 86:04dd9b1680ae | 436 | #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 437 | #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 438 | #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 439 | #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 440 | #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 441 | |
bogdanm | 86:04dd9b1680ae | 442 | /** |
bogdanm | 86:04dd9b1680ae | 443 | * @brief AF 1 selection |
bogdanm | 86:04dd9b1680ae | 444 | */ |
bogdanm | 86:04dd9b1680ae | 445 | #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 446 | #define GPIO_AF1_TIM15 ((uint8_t)0x01) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 447 | #define GPIO_AF1_TIM16 ((uint8_t)0x01) /* TIM16 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 448 | #define GPIO_AF1_TIM17 ((uint8_t)0x01) /* TIM17 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 449 | #define GPIO_AF1_EVENTOUT ((uint8_t)0x01) /* EVENTOUT Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 450 | /** |
bogdanm | 86:04dd9b1680ae | 451 | * @brief AF 2 selection |
bogdanm | 86:04dd9b1680ae | 452 | */ |
bogdanm | 86:04dd9b1680ae | 453 | #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 454 | #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 455 | #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 456 | #define GPIO_AF2_TIM13 ((uint8_t)0x02) /* TIM13 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 457 | #define GPIO_AF2_TIM14 ((uint8_t)0x02) /* TIM14 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 458 | #define GPIO_AF2_TIM15 ((uint8_t)0x02) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 459 | #define GPIO_AF2_TIM19 ((uint8_t)0x02) /* TIM19 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 460 | |
bogdanm | 86:04dd9b1680ae | 461 | /** |
bogdanm | 86:04dd9b1680ae | 462 | * @brief AF 3 selection |
bogdanm | 86:04dd9b1680ae | 463 | */ |
bogdanm | 86:04dd9b1680ae | 464 | #define GPIO_AF3_TSC ((uint8_t)0x03) /* TSC Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 465 | /** |
bogdanm | 86:04dd9b1680ae | 466 | * @brief AF 4 selection |
bogdanm | 86:04dd9b1680ae | 467 | */ |
bogdanm | 86:04dd9b1680ae | 468 | #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 469 | #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 470 | |
bogdanm | 86:04dd9b1680ae | 471 | /** |
bogdanm | 86:04dd9b1680ae | 472 | * @brief AF 5 selection |
bogdanm | 86:04dd9b1680ae | 473 | */ |
bogdanm | 86:04dd9b1680ae | 474 | #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1/I2S1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 475 | #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 476 | #define GPIO_AF5_IR ((uint8_t)0x05) /* IR Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 477 | |
bogdanm | 86:04dd9b1680ae | 478 | /** |
bogdanm | 86:04dd9b1680ae | 479 | * @brief AF 6 selection |
bogdanm | 86:04dd9b1680ae | 480 | */ |
bogdanm | 86:04dd9b1680ae | 481 | #define GPIO_AF6_SPI1 ((uint8_t)0x06) /* SPI1/I2S1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 482 | #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 483 | #define GPIO_AF6_IR ((uint8_t)0x06) /* IR Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 484 | #define GPIO_AF6_CEC ((uint8_t)0x06) /* CEC Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 485 | |
bogdanm | 86:04dd9b1680ae | 486 | /** |
bogdanm | 86:04dd9b1680ae | 487 | * @brief AF 7 selection |
bogdanm | 86:04dd9b1680ae | 488 | */ |
bogdanm | 86:04dd9b1680ae | 489 | #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 490 | #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 491 | #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 492 | #define GPIO_AF7_CAN ((uint8_t)0x07) /* CAN Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 493 | #define GPIO_AF7_CEC ((uint8_t)0x07) /* CEC Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 494 | |
bogdanm | 86:04dd9b1680ae | 495 | /** |
bogdanm | 86:04dd9b1680ae | 496 | * @brief AF 8 selection |
bogdanm | 86:04dd9b1680ae | 497 | */ |
bogdanm | 86:04dd9b1680ae | 498 | #define GPIO_AF8_COMP1 ((uint8_t)0x08) /* COMP1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 499 | #define GPIO_AF8_COMP2 ((uint8_t)0x08) /* COMP2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 500 | |
bogdanm | 86:04dd9b1680ae | 501 | /** |
bogdanm | 86:04dd9b1680ae | 502 | * @brief AF 9 selection |
bogdanm | 86:04dd9b1680ae | 503 | */ |
bogdanm | 86:04dd9b1680ae | 504 | #define GPIO_AF9_CAN ((uint8_t)0x09) /* CAN Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 505 | #define GPIO_AF9_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 506 | #define GPIO_AF9_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 507 | #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 508 | #define GPIO_AF9_TIM15 ((uint8_t)0x09) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 509 | |
bogdanm | 86:04dd9b1680ae | 510 | /** |
bogdanm | 86:04dd9b1680ae | 511 | * @brief AF 10 selection |
bogdanm | 86:04dd9b1680ae | 512 | */ |
bogdanm | 86:04dd9b1680ae | 513 | #define GPIO_AF10_TIM2 ((uint8_t)0xA) /* TIM2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 514 | #define GPIO_AF10_TIM3 ((uint8_t)0xA) /* TIM3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 515 | #define GPIO_AF10_TIM4 ((uint8_t)0xA) /* TIM4 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 516 | #define GPIO_AF10_TIM12 ((uint8_t)0xA) /* TIM12 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 517 | #define GPIO_AF10_TIM17 ((uint8_t)0xA) /* TIM17 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 518 | |
bogdanm | 86:04dd9b1680ae | 519 | /** |
bogdanm | 86:04dd9b1680ae | 520 | * @brief AF 11 selection |
bogdanm | 86:04dd9b1680ae | 521 | */ |
bogdanm | 86:04dd9b1680ae | 522 | #define GPIO_AF11_TIM19 ((uint8_t)0x0B) /* TIM19 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 523 | |
bogdanm | 86:04dd9b1680ae | 524 | /** |
bogdanm | 86:04dd9b1680ae | 525 | * @brief AF 15 selection |
bogdanm | 86:04dd9b1680ae | 526 | */ |
bogdanm | 86:04dd9b1680ae | 527 | #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 528 | |
bogdanm | 86:04dd9b1680ae | 529 | #define IS_GPIO_AF(AF) (((AF) <= (uint8_t)0x0B) || ((AF) == (uint8_t)0x0F)) |
bogdanm | 86:04dd9b1680ae | 530 | /*------------------------------------------------------------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 531 | #endif /* STM32F378xx */ |
bogdanm | 86:04dd9b1680ae | 532 | |
bogdanm | 86:04dd9b1680ae | 533 | #if defined (STM32F303x8) |
bogdanm | 86:04dd9b1680ae | 534 | /*---------------------------------- STM32F303x8--------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 535 | /** |
bogdanm | 86:04dd9b1680ae | 536 | * @brief AF 0 selection |
bogdanm | 86:04dd9b1680ae | 537 | */ |
bogdanm | 86:04dd9b1680ae | 538 | #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 539 | #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 540 | #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 541 | #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 542 | |
bogdanm | 86:04dd9b1680ae | 543 | /** |
bogdanm | 86:04dd9b1680ae | 544 | * @brief AF 1 selection |
bogdanm | 86:04dd9b1680ae | 545 | */ |
bogdanm | 86:04dd9b1680ae | 546 | #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 547 | #define GPIO_AF1_TIM15 ((uint8_t)0x01) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 548 | #define GPIO_AF1_TIM16 ((uint8_t)0x01) /* TIM16 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 549 | #define GPIO_AF1_TIM17 ((uint8_t)0x01) /* TIM17 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 550 | #define GPIO_AF1_EVENTOUT ((uint8_t)0x01) /* EVENTOUT Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 551 | /** |
bogdanm | 86:04dd9b1680ae | 552 | * @brief AF 2 selection |
bogdanm | 86:04dd9b1680ae | 553 | */ |
bogdanm | 86:04dd9b1680ae | 554 | #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 555 | #define GPIO_AF2_TIM1 ((uint8_t)0x02) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 556 | #define GPIO_AF2_TIM15 ((uint8_t)0x02) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 557 | #define GPIO_AF2_TIM16 ((uint8_t)0x02) /* TIM16 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 558 | |
bogdanm | 86:04dd9b1680ae | 559 | /** |
bogdanm | 86:04dd9b1680ae | 560 | * @brief AF 3 selection |
bogdanm | 86:04dd9b1680ae | 561 | */ |
bogdanm | 86:04dd9b1680ae | 562 | #define GPIO_AF3_TSC ((uint8_t)0x03) /* TSC Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 563 | |
bogdanm | 86:04dd9b1680ae | 564 | /** |
bogdanm | 86:04dd9b1680ae | 565 | * @brief AF 4 selection |
bogdanm | 86:04dd9b1680ae | 566 | */ |
bogdanm | 86:04dd9b1680ae | 567 | #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 568 | #define GPIO_AF4_TIM1 ((uint8_t)0x04) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 569 | |
bogdanm | 86:04dd9b1680ae | 570 | /** |
bogdanm | 86:04dd9b1680ae | 571 | * @brief AF 5 selection |
bogdanm | 86:04dd9b1680ae | 572 | */ |
bogdanm | 86:04dd9b1680ae | 573 | #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 574 | #define GPIO_AF5_IR ((uint8_t)0x05) /* IR Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 575 | /** |
bogdanm | 86:04dd9b1680ae | 576 | * @brief AF 6 selection |
bogdanm | 86:04dd9b1680ae | 577 | */ |
bogdanm | 86:04dd9b1680ae | 578 | #define GPIO_AF6_TIM1 ((uint8_t)0x06) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 579 | #define GPIO_AF6_IR ((uint8_t)0x06) /* IR Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 580 | |
bogdanm | 86:04dd9b1680ae | 581 | /** |
bogdanm | 86:04dd9b1680ae | 582 | * @brief AF 7 selection |
bogdanm | 86:04dd9b1680ae | 583 | */ |
bogdanm | 86:04dd9b1680ae | 584 | #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 585 | #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 586 | #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 587 | #define GPIO_AF7_GPCOMP6 ((uint8_t)0x07) /* GPCOMP6 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 588 | |
bogdanm | 86:04dd9b1680ae | 589 | /** |
bogdanm | 86:04dd9b1680ae | 590 | * @brief AF 8 selection |
bogdanm | 86:04dd9b1680ae | 591 | */ |
bogdanm | 86:04dd9b1680ae | 592 | #define GPIO_AF8_GPCOMP2 ((uint8_t)0x08) /* GPCOMP2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 593 | #define GPIO_AF8_GPCOMP4 ((uint8_t)0x08) /* GPCOMP4 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 594 | #define GPIO_AF8_GPCOMP6 ((uint8_t)0x08) /* GPCOMP6 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 595 | |
bogdanm | 86:04dd9b1680ae | 596 | /** |
bogdanm | 86:04dd9b1680ae | 597 | * @brief AF 9 selection |
bogdanm | 86:04dd9b1680ae | 598 | */ |
bogdanm | 86:04dd9b1680ae | 599 | #define GPIO_AF9_CAN ((uint8_t)0x09) /* CAN Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 600 | #define GPIO_AF9_TIM1 ((uint8_t)0x09) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 601 | #define GPIO_AF9_TIM15 ((uint8_t)0x09) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 602 | /** |
bogdanm | 86:04dd9b1680ae | 603 | * @brief AF 10 selection |
bogdanm | 86:04dd9b1680ae | 604 | */ |
bogdanm | 86:04dd9b1680ae | 605 | #define GPIO_AF10_TIM2 ((uint8_t)0xA) /* TIM2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 606 | #define GPIO_AF10_TIM3 ((uint8_t)0xA) /* TIM3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 607 | #define GPIO_AF10_TIM17 ((uint8_t)0xA) /* TIM17 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 608 | |
bogdanm | 86:04dd9b1680ae | 609 | /** |
bogdanm | 86:04dd9b1680ae | 610 | * @brief AF 11 selection |
bogdanm | 86:04dd9b1680ae | 611 | */ |
bogdanm | 86:04dd9b1680ae | 612 | #define GPIO_AF11_TIM1 ((uint8_t)0x0B) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 613 | |
bogdanm | 86:04dd9b1680ae | 614 | /** |
bogdanm | 86:04dd9b1680ae | 615 | * @brief AF 12 selection |
bogdanm | 86:04dd9b1680ae | 616 | */ |
bogdanm | 86:04dd9b1680ae | 617 | #define GPIO_AF12_TIM1 ((uint8_t)0x0C) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 618 | |
bogdanm | 86:04dd9b1680ae | 619 | /** |
bogdanm | 86:04dd9b1680ae | 620 | * @brief AF 13 selection |
bogdanm | 86:04dd9b1680ae | 621 | */ |
bogdanm | 86:04dd9b1680ae | 622 | #define GPIO_AF13_OPAMP2 ((uint8_t)0x0D) /* OPAMP2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 623 | |
bogdanm | 86:04dd9b1680ae | 624 | /** |
bogdanm | 86:04dd9b1680ae | 625 | * @brief AF 15 selection |
bogdanm | 86:04dd9b1680ae | 626 | */ |
bogdanm | 86:04dd9b1680ae | 627 | #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 628 | |
bogdanm | 86:04dd9b1680ae | 629 | #define IS_GPIO_AF(AF) (((AF) <= (uint8_t)0x0D) || ((AF) == (uint8_t)0x0F)) |
bogdanm | 86:04dd9b1680ae | 630 | /*------------------------------------------------------------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 631 | #endif /* STM32F303x8 */ |
bogdanm | 86:04dd9b1680ae | 632 | |
bogdanm | 86:04dd9b1680ae | 633 | #if defined (STM32F334x8) || defined (STM32F328xx) |
bogdanm | 86:04dd9b1680ae | 634 | /*---------------------------------- STM32F334x8/STM32F328xx -------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 635 | /** |
bogdanm | 86:04dd9b1680ae | 636 | * @brief AF 0 selection |
bogdanm | 86:04dd9b1680ae | 637 | */ |
bogdanm | 86:04dd9b1680ae | 638 | #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 639 | #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 640 | #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 641 | #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 642 | |
bogdanm | 86:04dd9b1680ae | 643 | /** |
bogdanm | 86:04dd9b1680ae | 644 | * @brief AF 1 selection |
bogdanm | 86:04dd9b1680ae | 645 | */ |
bogdanm | 86:04dd9b1680ae | 646 | #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 647 | #define GPIO_AF1_TIM15 ((uint8_t)0x01) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 648 | #define GPIO_AF1_TIM16 ((uint8_t)0x01) /* TIM16 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 649 | #define GPIO_AF1_TIM17 ((uint8_t)0x01) /* TIM17 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 650 | #define GPIO_AF1_EVENTOUT ((uint8_t)0x01) /* EVENTOUT Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 651 | /** |
bogdanm | 86:04dd9b1680ae | 652 | * @brief AF 2 selection |
bogdanm | 86:04dd9b1680ae | 653 | */ |
bogdanm | 86:04dd9b1680ae | 654 | #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 655 | #define GPIO_AF2_TIM1 ((uint8_t)0x02) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 656 | #define GPIO_AF2_TIM15 ((uint8_t)0x02) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 657 | #define GPIO_AF2_TIM16 ((uint8_t)0x02) /* TIM16 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 658 | |
bogdanm | 86:04dd9b1680ae | 659 | /** |
bogdanm | 86:04dd9b1680ae | 660 | * @brief AF 3 selection |
bogdanm | 86:04dd9b1680ae | 661 | */ |
bogdanm | 86:04dd9b1680ae | 662 | #define GPIO_AF3_TSC ((uint8_t)0x03) /* TSC Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 663 | #define GPIO_AF3_HRTIM1 ((uint8_t)0x03) /* HRTIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 664 | |
bogdanm | 86:04dd9b1680ae | 665 | /** |
bogdanm | 86:04dd9b1680ae | 666 | * @brief AF 4 selection |
bogdanm | 86:04dd9b1680ae | 667 | */ |
bogdanm | 86:04dd9b1680ae | 668 | #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 669 | #define GPIO_AF4_TIM1 ((uint8_t)0x04) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 670 | |
bogdanm | 86:04dd9b1680ae | 671 | /** |
bogdanm | 86:04dd9b1680ae | 672 | * @brief AF 5 selection |
bogdanm | 86:04dd9b1680ae | 673 | */ |
bogdanm | 86:04dd9b1680ae | 674 | #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 675 | #define GPIO_AF5_IR ((uint8_t)0x05) /* IR Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 676 | /** |
bogdanm | 86:04dd9b1680ae | 677 | * @brief AF 6 selection |
bogdanm | 86:04dd9b1680ae | 678 | */ |
bogdanm | 86:04dd9b1680ae | 679 | #define GPIO_AF6_TIM1 ((uint8_t)0x06) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 680 | #define GPIO_AF6_IR ((uint8_t)0x06) /* IR Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 681 | |
bogdanm | 86:04dd9b1680ae | 682 | /** |
bogdanm | 86:04dd9b1680ae | 683 | * @brief AF 7 selection |
bogdanm | 86:04dd9b1680ae | 684 | */ |
bogdanm | 86:04dd9b1680ae | 685 | #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 686 | #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 687 | #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 688 | #define GPIO_AF7_GPCOMP6 ((uint8_t)0x07) /* GPCOMP6 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 689 | |
bogdanm | 86:04dd9b1680ae | 690 | /** |
bogdanm | 86:04dd9b1680ae | 691 | * @brief AF 8 selection |
bogdanm | 86:04dd9b1680ae | 692 | */ |
bogdanm | 86:04dd9b1680ae | 693 | #define GPIO_AF8_GPCOMP2 ((uint8_t)0x08) /* GPCOMP2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 694 | #define GPIO_AF8_GPCOMP4 ((uint8_t)0x08) /* GPCOMP4 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 695 | #define GPIO_AF8_GPCOMP6 ((uint8_t)0x08) /* GPCOMP6 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 696 | |
bogdanm | 86:04dd9b1680ae | 697 | /** |
bogdanm | 86:04dd9b1680ae | 698 | * @brief AF 9 selection |
bogdanm | 86:04dd9b1680ae | 699 | */ |
bogdanm | 86:04dd9b1680ae | 700 | #define GPIO_AF9_CAN ((uint8_t)0x09) /* CAN Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 701 | #define GPIO_AF9_TIM1 ((uint8_t)0x09) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 702 | #define GPIO_AF9_TIM15 ((uint8_t)0x09) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 703 | /** |
bogdanm | 86:04dd9b1680ae | 704 | * @brief AF 10 selection |
bogdanm | 86:04dd9b1680ae | 705 | */ |
bogdanm | 86:04dd9b1680ae | 706 | #define GPIO_AF10_TIM2 ((uint8_t)0xA) /* TIM2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 707 | #define GPIO_AF10_TIM3 ((uint8_t)0xA) /* TIM3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 708 | #define GPIO_AF10_TIM17 ((uint8_t)0xA) /* TIM17 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 709 | |
bogdanm | 86:04dd9b1680ae | 710 | /** |
bogdanm | 86:04dd9b1680ae | 711 | * @brief AF 11 selection |
bogdanm | 86:04dd9b1680ae | 712 | */ |
bogdanm | 86:04dd9b1680ae | 713 | #define GPIO_AF11_TIM1 ((uint8_t)0x0B) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 714 | |
bogdanm | 86:04dd9b1680ae | 715 | /** |
bogdanm | 86:04dd9b1680ae | 716 | * @brief AF 12 selection |
bogdanm | 86:04dd9b1680ae | 717 | */ |
bogdanm | 86:04dd9b1680ae | 718 | #define GPIO_AF12_TIM1 ((uint8_t)0x0C) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 719 | #define GPIO_AF12_HRTIM1 ((uint8_t)0x0C) /* HRTIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 720 | |
bogdanm | 86:04dd9b1680ae | 721 | /** |
bogdanm | 86:04dd9b1680ae | 722 | * @brief AF 13 selection |
bogdanm | 86:04dd9b1680ae | 723 | */ |
bogdanm | 86:04dd9b1680ae | 724 | #define GPIO_AF13_OPAMP2 ((uint8_t)0x0D) /* OPAMP2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 725 | #define GPIO_AF13_HRTIM1 ((uint8_t)0x0D) /* HRTIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 726 | |
bogdanm | 86:04dd9b1680ae | 727 | /** |
bogdanm | 86:04dd9b1680ae | 728 | * @brief AF 15 selection |
bogdanm | 86:04dd9b1680ae | 729 | */ |
bogdanm | 86:04dd9b1680ae | 730 | #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 731 | |
bogdanm | 86:04dd9b1680ae | 732 | #define IS_GPIO_AF(AF) (((AF) <= (uint8_t)0x0D) || ((AF) == (uint8_t)0x0F)) |
bogdanm | 86:04dd9b1680ae | 733 | /*------------------------------------------------------------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 734 | #endif /* STM32F334x8 || STM32F328xx */ |
bogdanm | 86:04dd9b1680ae | 735 | |
bogdanm | 86:04dd9b1680ae | 736 | #if defined (STM32F301x8) || defined (STM32F318xx) |
bogdanm | 86:04dd9b1680ae | 737 | /*---------------------------------- STM32F301x8 / STM32F318xx ------------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 738 | /** |
bogdanm | 86:04dd9b1680ae | 739 | * @brief AF 0 selection |
bogdanm | 86:04dd9b1680ae | 740 | */ |
bogdanm | 86:04dd9b1680ae | 741 | #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 742 | #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 743 | #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 744 | #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 745 | #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 746 | |
bogdanm | 86:04dd9b1680ae | 747 | /** |
bogdanm | 86:04dd9b1680ae | 748 | * @brief AF 1 selection |
bogdanm | 86:04dd9b1680ae | 749 | */ |
bogdanm | 86:04dd9b1680ae | 750 | #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 751 | #define GPIO_AF1_TIM15 ((uint8_t)0x01) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 752 | #define GPIO_AF1_TIM16 ((uint8_t)0x01) /* TIM16 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 753 | #define GPIO_AF1_TIM17 ((uint8_t)0x01) /* TIM17 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 754 | #define GPIO_AF1_EVENTOUT ((uint8_t)0x01) /* EVENTOUT Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 755 | /** |
bogdanm | 86:04dd9b1680ae | 756 | * @brief AF 2 selection |
bogdanm | 86:04dd9b1680ae | 757 | */ |
bogdanm | 86:04dd9b1680ae | 758 | #define GPIO_AF2_I2C3 ((uint8_t)0x02) /* I2C3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 759 | #define GPIO_AF2_TIM1 ((uint8_t)0x02) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 760 | #define GPIO_AF2_TIM15 ((uint8_t)0x02) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 761 | #define GPIO_AF2_TIM2 ((uint8_t)0x02) /* TIM2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 762 | |
bogdanm | 86:04dd9b1680ae | 763 | /** |
bogdanm | 86:04dd9b1680ae | 764 | * @brief AF 3 selection |
bogdanm | 86:04dd9b1680ae | 765 | */ |
bogdanm | 86:04dd9b1680ae | 766 | #define GPIO_AF3_TSC ((uint8_t)0x03) /* TSC Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 767 | #define GPIO_AF3_I2C3 ((uint8_t)0x03) /* I2C3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 768 | #define GPIO_AF3_TIM15 ((uint8_t)0x03) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 769 | |
bogdanm | 86:04dd9b1680ae | 770 | /** |
bogdanm | 86:04dd9b1680ae | 771 | * @brief AF 4 selection |
bogdanm | 86:04dd9b1680ae | 772 | */ |
bogdanm | 86:04dd9b1680ae | 773 | #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 774 | #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 775 | #define GPIO_AF4_TIM1 ((uint8_t)0x04) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 776 | #define GPIO_AF4_TIM16 ((uint8_t)0x04) /* TIM16 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 777 | #define GPIO_AF4_TIM17 ((uint8_t)0x04) /* TIM17 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 778 | |
bogdanm | 86:04dd9b1680ae | 779 | /** |
bogdanm | 86:04dd9b1680ae | 780 | * @brief AF 5 selection |
bogdanm | 86:04dd9b1680ae | 781 | */ |
bogdanm | 86:04dd9b1680ae | 782 | #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 783 | #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 784 | #define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3/I2S3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 785 | #define GPIO_AF5_IR ((uint8_t)0x05) /* IR Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 786 | /** |
bogdanm | 86:04dd9b1680ae | 787 | * @brief AF 6 selection |
bogdanm | 86:04dd9b1680ae | 788 | */ |
bogdanm | 86:04dd9b1680ae | 789 | #define GPIO_AF6_TIM1 ((uint8_t)0x06) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 790 | #define GPIO_AF6_IR ((uint8_t)0x06) /* IR Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 791 | #define GPIO_AF6_SPI2 ((uint8_t)0x06) /* SPI2/I2S2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 792 | #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 793 | |
bogdanm | 86:04dd9b1680ae | 794 | /** |
bogdanm | 86:04dd9b1680ae | 795 | * @brief AF 7 selection |
bogdanm | 86:04dd9b1680ae | 796 | */ |
bogdanm | 86:04dd9b1680ae | 797 | #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 798 | #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 799 | #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 800 | #define GPIO_AF7_GPCOMP6 ((uint8_t)0x07) /* GPCOMP6 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 801 | |
bogdanm | 86:04dd9b1680ae | 802 | /** |
bogdanm | 86:04dd9b1680ae | 803 | * @brief AF 8 selection |
bogdanm | 86:04dd9b1680ae | 804 | */ |
bogdanm | 86:04dd9b1680ae | 805 | #define GPIO_AF8_I2C3 ((uint8_t)0x08) /* I2C3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 806 | #define GPIO_AF8_GPCOMP2 ((uint8_t)0x08) /* GPCOMP2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 807 | #define GPIO_AF8_GPCOMP4 ((uint8_t)0x08) /* GPCOMP4 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 808 | #define GPIO_AF8_GPCOMP6 ((uint8_t)0x08) /* GPCOMP6 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 809 | |
bogdanm | 86:04dd9b1680ae | 810 | /** |
bogdanm | 86:04dd9b1680ae | 811 | * @brief AF 9 selection |
bogdanm | 86:04dd9b1680ae | 812 | */ |
bogdanm | 86:04dd9b1680ae | 813 | #define GPIO_AF9_TIM1 ((uint8_t)0x09) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 814 | #define GPIO_AF9_TIM15 ((uint8_t)0x09) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 815 | |
bogdanm | 86:04dd9b1680ae | 816 | /** |
bogdanm | 86:04dd9b1680ae | 817 | * @brief AF 10 selection |
bogdanm | 86:04dd9b1680ae | 818 | */ |
bogdanm | 86:04dd9b1680ae | 819 | #define GPIO_AF10_TIM2 ((uint8_t)0xA) /* TIM2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 820 | #define GPIO_AF10_TIM17 ((uint8_t)0xA) /* TIM17 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 821 | |
bogdanm | 86:04dd9b1680ae | 822 | /** |
bogdanm | 86:04dd9b1680ae | 823 | * @brief AF 11 selection |
bogdanm | 86:04dd9b1680ae | 824 | */ |
bogdanm | 86:04dd9b1680ae | 825 | #define GPIO_AF11_TIM1 ((uint8_t)0x0B) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 826 | |
bogdanm | 86:04dd9b1680ae | 827 | /** |
bogdanm | 86:04dd9b1680ae | 828 | * @brief AF 12 selection |
bogdanm | 86:04dd9b1680ae | 829 | */ |
bogdanm | 86:04dd9b1680ae | 830 | #define GPIO_AF12_TIM1 ((uint8_t)0x0C) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 831 | |
bogdanm | 86:04dd9b1680ae | 832 | /** |
bogdanm | 86:04dd9b1680ae | 833 | * @brief AF 15 selection |
bogdanm | 86:04dd9b1680ae | 834 | */ |
bogdanm | 86:04dd9b1680ae | 835 | #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 836 | |
bogdanm | 86:04dd9b1680ae | 837 | #define IS_GPIO_AF(AF) (((AF) <= (uint8_t)0x0C) || ((AF) == (uint8_t)0x0F)) |
bogdanm | 86:04dd9b1680ae | 838 | /*------------------------------------------------------------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 839 | #endif /* STM32F301x8 || STM32F318xx */ |
bogdanm | 86:04dd9b1680ae | 840 | |
bogdanm | 86:04dd9b1680ae | 841 | #if defined (STM32F302x8) |
bogdanm | 86:04dd9b1680ae | 842 | /*---------------------------------- STM32F302x8------------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 843 | /** |
bogdanm | 86:04dd9b1680ae | 844 | * @brief AF 0 selection |
bogdanm | 86:04dd9b1680ae | 845 | */ |
bogdanm | 86:04dd9b1680ae | 846 | #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 847 | #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 848 | #define GPIO_AF0_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 849 | #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 850 | #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 851 | |
bogdanm | 86:04dd9b1680ae | 852 | /** |
bogdanm | 86:04dd9b1680ae | 853 | * @brief AF 1 selection |
bogdanm | 86:04dd9b1680ae | 854 | */ |
bogdanm | 86:04dd9b1680ae | 855 | #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 856 | #define GPIO_AF1_TIM15 ((uint8_t)0x01) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 857 | #define GPIO_AF1_TIM16 ((uint8_t)0x01) /* TIM16 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 858 | #define GPIO_AF1_TIM17 ((uint8_t)0x01) /* TIM17 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 859 | #define GPIO_AF1_EVENTOUT ((uint8_t)0x01) /* EVENTOUT Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 860 | /** |
bogdanm | 86:04dd9b1680ae | 861 | * @brief AF 2 selection |
bogdanm | 86:04dd9b1680ae | 862 | */ |
bogdanm | 86:04dd9b1680ae | 863 | #define GPIO_AF2_I2C3 ((uint8_t)0x02) /* I2C3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 864 | #define GPIO_AF2_TIM1 ((uint8_t)0x02) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 865 | #define GPIO_AF2_TIM15 ((uint8_t)0x02) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 866 | #define GPIO_AF2_TIM2 ((uint8_t)0x02) /* TIM2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 867 | |
bogdanm | 86:04dd9b1680ae | 868 | /** |
bogdanm | 86:04dd9b1680ae | 869 | * @brief AF 3 selection |
bogdanm | 86:04dd9b1680ae | 870 | */ |
bogdanm | 86:04dd9b1680ae | 871 | #define GPIO_AF3_TSC ((uint8_t)0x03) /* TSC Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 872 | #define GPIO_AF3_I2C3 ((uint8_t)0x03) /* I2C3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 873 | #define GPIO_AF3_TIM15 ((uint8_t)0x03) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 874 | |
bogdanm | 86:04dd9b1680ae | 875 | /** |
bogdanm | 86:04dd9b1680ae | 876 | * @brief AF 4 selection |
bogdanm | 86:04dd9b1680ae | 877 | */ |
bogdanm | 86:04dd9b1680ae | 878 | #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 879 | #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 880 | #define GPIO_AF4_TIM1 ((uint8_t)0x04) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 881 | #define GPIO_AF4_TIM16 ((uint8_t)0x04) /* TIM16 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 882 | #define GPIO_AF4_TIM17 ((uint8_t)0x04) /* TIM17 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 883 | |
bogdanm | 86:04dd9b1680ae | 884 | /** |
bogdanm | 86:04dd9b1680ae | 885 | * @brief AF 5 selection |
bogdanm | 86:04dd9b1680ae | 886 | */ |
bogdanm | 86:04dd9b1680ae | 887 | #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 888 | #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 889 | #define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3/I2S3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 890 | #define GPIO_AF5_IR ((uint8_t)0x05) /* IR Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 891 | /** |
bogdanm | 86:04dd9b1680ae | 892 | * @brief AF 6 selection |
bogdanm | 86:04dd9b1680ae | 893 | */ |
bogdanm | 86:04dd9b1680ae | 894 | #define GPIO_AF6_TIM1 ((uint8_t)0x06) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 895 | #define GPIO_AF6_IR ((uint8_t)0x06) /* IR Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 896 | #define GPIO_AF6_SPI2 ((uint8_t)0x06) /* SPI2/I2S2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 897 | #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 898 | |
bogdanm | 86:04dd9b1680ae | 899 | /** |
bogdanm | 86:04dd9b1680ae | 900 | * @brief AF 7 selection |
bogdanm | 86:04dd9b1680ae | 901 | */ |
bogdanm | 86:04dd9b1680ae | 902 | #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 903 | #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 904 | #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 905 | #define GPIO_AF7_GPCOMP6 ((uint8_t)0x07) /* GPCOMP6 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 906 | #define GPIO_AF7_CAN ((uint8_t)0x07) /* CAN Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 907 | |
bogdanm | 86:04dd9b1680ae | 908 | /** |
bogdanm | 86:04dd9b1680ae | 909 | * @brief AF 8 selection |
bogdanm | 86:04dd9b1680ae | 910 | */ |
bogdanm | 86:04dd9b1680ae | 911 | #define GPIO_AF8_I2C3 ((uint8_t)0x08) /* I2C3 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 912 | #define GPIO_AF8_GPCOMP2 ((uint8_t)0x08) /* GPCOMP2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 913 | #define GPIO_AF8_GPCOMP4 ((uint8_t)0x08) /* GPCOMP4 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 914 | #define GPIO_AF8_GPCOMP6 ((uint8_t)0x08) /* GPCOMP6 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 915 | |
bogdanm | 86:04dd9b1680ae | 916 | /** |
bogdanm | 86:04dd9b1680ae | 917 | * @brief AF 9 selection |
bogdanm | 86:04dd9b1680ae | 918 | */ |
bogdanm | 86:04dd9b1680ae | 919 | #define GPIO_AF9_TIM1 ((uint8_t)0x09) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 920 | #define GPIO_AF9_TIM15 ((uint8_t)0x09) /* TIM15 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 921 | #define GPIO_AF9_CAN ((uint8_t)0x09) /* CAN Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 922 | |
bogdanm | 86:04dd9b1680ae | 923 | /** |
bogdanm | 86:04dd9b1680ae | 924 | * @brief AF 10 selection |
bogdanm | 86:04dd9b1680ae | 925 | */ |
bogdanm | 86:04dd9b1680ae | 926 | #define GPIO_AF10_TIM2 ((uint8_t)0xA) /* TIM2 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 927 | #define GPIO_AF10_TIM17 ((uint8_t)0xA) /* TIM17 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 928 | |
bogdanm | 86:04dd9b1680ae | 929 | /** |
bogdanm | 86:04dd9b1680ae | 930 | * @brief AF 11 selection |
bogdanm | 86:04dd9b1680ae | 931 | */ |
bogdanm | 86:04dd9b1680ae | 932 | #define GPIO_AF11_TIM1 ((uint8_t)0x0B) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 933 | |
bogdanm | 86:04dd9b1680ae | 934 | /** |
bogdanm | 86:04dd9b1680ae | 935 | * @brief AF 12 selection |
bogdanm | 86:04dd9b1680ae | 936 | */ |
bogdanm | 86:04dd9b1680ae | 937 | #define GPIO_AF12_TIM1 ((uint8_t)0x0C) /* TIM1 Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 938 | |
bogdanm | 86:04dd9b1680ae | 939 | /** |
bogdanm | 86:04dd9b1680ae | 940 | * @brief AF 15 selection |
bogdanm | 86:04dd9b1680ae | 941 | */ |
bogdanm | 86:04dd9b1680ae | 942 | #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ |
bogdanm | 86:04dd9b1680ae | 943 | |
bogdanm | 86:04dd9b1680ae | 944 | #define IS_GPIO_AF(AF) (((AF) <= (uint8_t)0x0C) || ((AF) == (uint8_t)0x0F)) |
bogdanm | 86:04dd9b1680ae | 945 | /*------------------------------------------------------------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 946 | #endif /* STM32F302x8 */ |
bogdanm | 86:04dd9b1680ae | 947 | /** |
bogdanm | 86:04dd9b1680ae | 948 | * @} |
bogdanm | 86:04dd9b1680ae | 949 | */ |
bogdanm | 86:04dd9b1680ae | 950 | |
bogdanm | 86:04dd9b1680ae | 951 | /** |
bogdanm | 86:04dd9b1680ae | 952 | * @} |
bogdanm | 86:04dd9b1680ae | 953 | */ |
bogdanm | 86:04dd9b1680ae | 954 | |
bogdanm | 86:04dd9b1680ae | 955 | /* Exported macro ------------------------------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 956 | /* Exported functions --------------------------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 957 | |
bogdanm | 86:04dd9b1680ae | 958 | |
bogdanm | 86:04dd9b1680ae | 959 | /** |
bogdanm | 86:04dd9b1680ae | 960 | * @} |
bogdanm | 86:04dd9b1680ae | 961 | */ |
bogdanm | 86:04dd9b1680ae | 962 | |
bogdanm | 86:04dd9b1680ae | 963 | /** |
bogdanm | 86:04dd9b1680ae | 964 | * @} |
bogdanm | 86:04dd9b1680ae | 965 | */ |
bogdanm | 86:04dd9b1680ae | 966 | |
bogdanm | 86:04dd9b1680ae | 967 | #ifdef __cplusplus |
bogdanm | 86:04dd9b1680ae | 968 | } |
bogdanm | 86:04dd9b1680ae | 969 | #endif |
bogdanm | 86:04dd9b1680ae | 970 | |
bogdanm | 86:04dd9b1680ae | 971 | #endif /* __STM32F3xx_HAL_GPIO_EX_H */ |
bogdanm | 86:04dd9b1680ae | 972 | |
bogdanm | 86:04dd9b1680ae | 973 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |