Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
stm32f4xx_gpio_mort.h@0:34ee385f4d2d, 2021-10-23 (annotated)
- Committer:
- rajathr
- Date:
- Sat Oct 23 05:49:09 2021 +0000
- Revision:
- 0:34ee385f4d2d
At 23rd Oct 21 - All Code
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| rajathr | 0:34ee385f4d2d | 1 | /** | 
| rajathr | 0:34ee385f4d2d | 2 | ****************************************************************************** | 
| rajathr | 0:34ee385f4d2d | 3 | * @file stm32f4xx_gpio.h | 
| rajathr | 0:34ee385f4d2d | 4 | * @author MCD Application Team | 
| rajathr | 0:34ee385f4d2d | 5 | * @version V1.8.0 | 
| rajathr | 0:34ee385f4d2d | 6 | * @date 04-November-2016 | 
| rajathr | 0:34ee385f4d2d | 7 | * @brief This file contains all the functions prototypes for the GPIO firmware | 
| rajathr | 0:34ee385f4d2d | 8 | * library. | 
| rajathr | 0:34ee385f4d2d | 9 | ****************************************************************************** | 
| rajathr | 0:34ee385f4d2d | 10 | * @attention | 
| rajathr | 0:34ee385f4d2d | 11 | * | 
| rajathr | 0:34ee385f4d2d | 12 | * <h2><center>© COPYRIGHT 2016 STMicroelectronics</center></h2> | 
| rajathr | 0:34ee385f4d2d | 13 | * | 
| rajathr | 0:34ee385f4d2d | 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); | 
| rajathr | 0:34ee385f4d2d | 15 | * You may not use this file except in compliance with the License. | 
| rajathr | 0:34ee385f4d2d | 16 | * You may obtain a copy of the License at: | 
| rajathr | 0:34ee385f4d2d | 17 | * | 
| rajathr | 0:34ee385f4d2d | 18 | * http://www.st.com/software_license_agreement_liberty_v2 | 
| rajathr | 0:34ee385f4d2d | 19 | * | 
| rajathr | 0:34ee385f4d2d | 20 | * Unless required by applicable law or agreed to in writing, software | 
| rajathr | 0:34ee385f4d2d | 21 | * distributed under the License is distributed on an "AS IS" BASIS, | 
| rajathr | 0:34ee385f4d2d | 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
| rajathr | 0:34ee385f4d2d | 23 | * See the License for the specific language governing permissions and | 
| rajathr | 0:34ee385f4d2d | 24 | * limitations under the License. | 
| rajathr | 0:34ee385f4d2d | 25 | * | 
| rajathr | 0:34ee385f4d2d | 26 | ****************************************************************************** | 
| rajathr | 0:34ee385f4d2d | 27 | */ | 
| rajathr | 0:34ee385f4d2d | 28 | |
| rajathr | 0:34ee385f4d2d | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ | 
| rajathr | 0:34ee385f4d2d | 30 | #ifndef __STM32F4xx_GPIO_H_MORT | 
| rajathr | 0:34ee385f4d2d | 31 | #define __STM32F4xx_GPIO_H_MORT | 
| rajathr | 0:34ee385f4d2d | 32 | |
| rajathr | 0:34ee385f4d2d | 33 | #ifdef __cplusplus | 
| rajathr | 0:34ee385f4d2d | 34 | extern "C" { | 
| rajathr | 0:34ee385f4d2d | 35 | #endif | 
| rajathr | 0:34ee385f4d2d | 36 | |
| rajathr | 0:34ee385f4d2d | 37 | /* Includes ------------------------------------------------------------------*/ | 
| rajathr | 0:34ee385f4d2d | 38 | #include "stm32f4xx_mort2.h" | 
| rajathr | 0:34ee385f4d2d | 39 | |
| rajathr | 0:34ee385f4d2d | 40 | /** @addtogroup STM32F4xx_StdPeriph_Driver | 
| rajathr | 0:34ee385f4d2d | 41 | * @{ | 
| rajathr | 0:34ee385f4d2d | 42 | */ | 
| rajathr | 0:34ee385f4d2d | 43 | |
| rajathr | 0:34ee385f4d2d | 44 | /** @addtogroup GPIO | 
| rajathr | 0:34ee385f4d2d | 45 | * @{ | 
| rajathr | 0:34ee385f4d2d | 46 | */ | 
| rajathr | 0:34ee385f4d2d | 47 | |
| rajathr | 0:34ee385f4d2d | 48 | /* Exported types ------------------------------------------------------------*/ | 
| rajathr | 0:34ee385f4d2d | 49 | |
| rajathr | 0:34ee385f4d2d | 50 | #define IS_GPIO_ALL_PERIPH(PERIPH) (((PERIPH) == GPIOA) || \ | 
| rajathr | 0:34ee385f4d2d | 51 | ((PERIPH) == GPIOB) || \ | 
| rajathr | 0:34ee385f4d2d | 52 | ((PERIPH) == GPIOC) || \ | 
| rajathr | 0:34ee385f4d2d | 53 | ((PERIPH) == GPIOD) || \ | 
| rajathr | 0:34ee385f4d2d | 54 | ((PERIPH) == GPIOE) || \ | 
| rajathr | 0:34ee385f4d2d | 55 | ((PERIPH) == GPIOF) || \ | 
| rajathr | 0:34ee385f4d2d | 56 | ((PERIPH) == GPIOG) || \ | 
| rajathr | 0:34ee385f4d2d | 57 | ((PERIPH) == GPIOH) || \ | 
| rajathr | 0:34ee385f4d2d | 58 | ((PERIPH) == GPIOI) || \ | 
| rajathr | 0:34ee385f4d2d | 59 | ((PERIPH) == GPIOJ) || \ | 
| rajathr | 0:34ee385f4d2d | 60 | ((PERIPH) == GPIOK)) | 
| rajathr | 0:34ee385f4d2d | 61 | |
| rajathr | 0:34ee385f4d2d | 62 | /** | 
| rajathr | 0:34ee385f4d2d | 63 | * @brief GPIO Configuration Mode enumeration | 
| rajathr | 0:34ee385f4d2d | 64 | */ | 
| rajathr | 0:34ee385f4d2d | 65 | typedef enum | 
| rajathr | 0:34ee385f4d2d | 66 | { | 
| rajathr | 0:34ee385f4d2d | 67 | GPIO_Mode_IN = 0x00, /*!< GPIO Input Mode */ | 
| rajathr | 0:34ee385f4d2d | 68 | GPIO_Mode_OUT = 0x01, /*!< GPIO Output Mode */ | 
| rajathr | 0:34ee385f4d2d | 69 | GPIO_Mode_AF = 0x02, /*!< GPIO Alternate function Mode */ | 
| rajathr | 0:34ee385f4d2d | 70 | GPIO_Mode_AN = 0x03 /*!< GPIO Analog Mode */ | 
| rajathr | 0:34ee385f4d2d | 71 | }GPIOMode_TypeDef_mort; | 
| rajathr | 0:34ee385f4d2d | 72 | #define IS_GPIO_MODE_MORT(MODE) (((MODE) == GPIO_Mode_IN) || ((MODE) == GPIO_Mode_OUT) || \ | 
| rajathr | 0:34ee385f4d2d | 73 | ((MODE) == GPIO_Mode_AF)|| ((MODE) == GPIO_Mode_AN)) | 
| rajathr | 0:34ee385f4d2d | 74 | |
| rajathr | 0:34ee385f4d2d | 75 | /** | 
| rajathr | 0:34ee385f4d2d | 76 | * @brief GPIO Output type enumeration | 
| rajathr | 0:34ee385f4d2d | 77 | */ | 
| rajathr | 0:34ee385f4d2d | 78 | typedef enum | 
| rajathr | 0:34ee385f4d2d | 79 | { | 
| rajathr | 0:34ee385f4d2d | 80 | GPIO_OType_PP = 0x00, | 
| rajathr | 0:34ee385f4d2d | 81 | GPIO_OType_OD = 0x01 | 
| rajathr | 0:34ee385f4d2d | 82 | }GPIOOType_TypeDef_mort; | 
| rajathr | 0:34ee385f4d2d | 83 | #define IS_GPIO_OTYPE(OTYPE) (((OTYPE) == GPIO_OType_PP) || ((OTYPE) == GPIO_OType_OD)) | 
| rajathr | 0:34ee385f4d2d | 84 | |
| rajathr | 0:34ee385f4d2d | 85 | |
| rajathr | 0:34ee385f4d2d | 86 | /** | 
| rajathr | 0:34ee385f4d2d | 87 | * @brief GPIO Output Maximum frequency enumeration | 
| rajathr | 0:34ee385f4d2d | 88 | */ | 
| rajathr | 0:34ee385f4d2d | 89 | typedef enum | 
| rajathr | 0:34ee385f4d2d | 90 | { | 
| rajathr | 0:34ee385f4d2d | 91 | GPIO_Low_Speed = 0x00, /*!< Low speed */ | 
| rajathr | 0:34ee385f4d2d | 92 | GPIO_Medium_Speed = 0x01, /*!< Medium speed */ | 
| rajathr | 0:34ee385f4d2d | 93 | GPIO_Fast_Speed = 0x02, /*!< Fast speed */ | 
| rajathr | 0:34ee385f4d2d | 94 | GPIO_High_Speed = 0x03 /*!< High speed */ | 
| rajathr | 0:34ee385f4d2d | 95 | }GPIOSpeed_TypeDef_mort; | 
| rajathr | 0:34ee385f4d2d | 96 | |
| rajathr | 0:34ee385f4d2d | 97 | /* Add legacy definition */ | 
| rajathr | 0:34ee385f4d2d | 98 | #define GPIO_Speed_2MHz GPIO_Low_Speed | 
| rajathr | 0:34ee385f4d2d | 99 | #define GPIO_Speed_25MHz GPIO_Medium_Speed | 
| rajathr | 0:34ee385f4d2d | 100 | #define GPIO_Speed_50MHz GPIO_Fast_Speed | 
| rajathr | 0:34ee385f4d2d | 101 | #define GPIO_Speed_100MHz GPIO_High_Speed | 
| rajathr | 0:34ee385f4d2d | 102 | |
| rajathr | 0:34ee385f4d2d | 103 | #define IS_GPIO_SPEED_MORT(SPEED) (((SPEED) == GPIO_Low_Speed) || ((SPEED) == GPIO_Medium_Speed) || \ | 
| rajathr | 0:34ee385f4d2d | 104 | ((SPEED) == GPIO_Fast_Speed)|| ((SPEED) == GPIO_High_Speed)) | 
| rajathr | 0:34ee385f4d2d | 105 | |
| rajathr | 0:34ee385f4d2d | 106 | /** | 
| rajathr | 0:34ee385f4d2d | 107 | * @brief GPIO Configuration PullUp PullDown enumeration | 
| rajathr | 0:34ee385f4d2d | 108 | */ | 
| rajathr | 0:34ee385f4d2d | 109 | typedef enum | 
| rajathr | 0:34ee385f4d2d | 110 | { | 
| rajathr | 0:34ee385f4d2d | 111 | GPIO_PuPd_NOPULL = 0x00, | 
| rajathr | 0:34ee385f4d2d | 112 | GPIO_PuPd_UP = 0x01, | 
| rajathr | 0:34ee385f4d2d | 113 | GPIO_PuPd_DOWN = 0x02 | 
| rajathr | 0:34ee385f4d2d | 114 | }GPIOPuPd_TypeDef_mort; | 
| rajathr | 0:34ee385f4d2d | 115 | #define IS_GPIO_PUPD(PUPD) (((PUPD) == GPIO_PuPd_NOPULL) || ((PUPD) == GPIO_PuPd_UP) || \ | 
| rajathr | 0:34ee385f4d2d | 116 | ((PUPD) == GPIO_PuPd_DOWN)) | 
| rajathr | 0:34ee385f4d2d | 117 | |
| rajathr | 0:34ee385f4d2d | 118 | /** | 
| rajathr | 0:34ee385f4d2d | 119 | * @brief GPIO Bit SET and Bit RESET enumeration | 
| rajathr | 0:34ee385f4d2d | 120 | */ | 
| rajathr | 0:34ee385f4d2d | 121 | typedef enum | 
| rajathr | 0:34ee385f4d2d | 122 | { | 
| rajathr | 0:34ee385f4d2d | 123 | Bit_RESET = 0, | 
| rajathr | 0:34ee385f4d2d | 124 | Bit_SET | 
| rajathr | 0:34ee385f4d2d | 125 | }BitAction; | 
| rajathr | 0:34ee385f4d2d | 126 | #define IS_GPIO_BIT_ACTION(ACTION) (((ACTION) == Bit_RESET) || ((ACTION) == Bit_SET)) | 
| rajathr | 0:34ee385f4d2d | 127 | |
| rajathr | 0:34ee385f4d2d | 128 | |
| rajathr | 0:34ee385f4d2d | 129 | /** | 
| rajathr | 0:34ee385f4d2d | 130 | * @brief GPIO Init structure definition | 
| rajathr | 0:34ee385f4d2d | 131 | */ | 
| rajathr | 0:34ee385f4d2d | 132 | typedef struct | 
| rajathr | 0:34ee385f4d2d | 133 | { | 
| rajathr | 0:34ee385f4d2d | 134 | uint32_t GPIO_Pin; /*!< Specifies the GPIO pins to be configured. | 
| rajathr | 0:34ee385f4d2d | 135 | This parameter can be any value of @ref GPIO_pins_define */ | 
| rajathr | 0:34ee385f4d2d | 136 | |
| rajathr | 0:34ee385f4d2d | 137 | GPIOMode_TypeDef_mort GPIO_Mode; /*!< Specifies the operating mode for the selected pins. | 
| rajathr | 0:34ee385f4d2d | 138 | This parameter can be a value of @ref GPIOMode_TypeDef */ | 
| rajathr | 0:34ee385f4d2d | 139 | |
| rajathr | 0:34ee385f4d2d | 140 | GPIOSpeed_TypeDef_mort GPIO_Speed; /*!< Specifies the speed for the selected pins. | 
| rajathr | 0:34ee385f4d2d | 141 | This parameter can be a value of @ref GPIOSpeed_TypeDef */ | 
| rajathr | 0:34ee385f4d2d | 142 | |
| rajathr | 0:34ee385f4d2d | 143 | GPIOOType_TypeDef_mort GPIO_OType; /*!< Specifies the operating output type for the selected pins. | 
| rajathr | 0:34ee385f4d2d | 144 | This parameter can be a value of @ref GPIOOType_TypeDef */ | 
| rajathr | 0:34ee385f4d2d | 145 | |
| rajathr | 0:34ee385f4d2d | 146 | GPIOPuPd_TypeDef_mort GPIO_PuPd; /*!< Specifies the operating Pull-up/Pull down for the selected pins. | 
| rajathr | 0:34ee385f4d2d | 147 | This parameter can be a value of @ref GPIOPuPd_TypeDef */ | 
| rajathr | 0:34ee385f4d2d | 148 | }GPIO_InitTypeDef_mort; | 
| rajathr | 0:34ee385f4d2d | 149 | |
| rajathr | 0:34ee385f4d2d | 150 | /* Exported constants --------------------------------------------------------*/ | 
| rajathr | 0:34ee385f4d2d | 151 | |
| rajathr | 0:34ee385f4d2d | 152 | /** @defgroup GPIO_Exported_Constants | 
| rajathr | 0:34ee385f4d2d | 153 | * @{ | 
| rajathr | 0:34ee385f4d2d | 154 | */ | 
| rajathr | 0:34ee385f4d2d | 155 | |
| rajathr | 0:34ee385f4d2d | 156 | /** @defgroup GPIO_pins_define | 
| rajathr | 0:34ee385f4d2d | 157 | * @{ | 
| rajathr | 0:34ee385f4d2d | 158 | */ | 
| rajathr | 0:34ee385f4d2d | 159 | #define GPIO_Pin_0 ((uint16_t)0x0001) /* Pin 0 selected */ | 
| rajathr | 0:34ee385f4d2d | 160 | #define GPIO_Pin_1 ((uint16_t)0x0002) /* Pin 1 selected */ | 
| rajathr | 0:34ee385f4d2d | 161 | #define GPIO_Pin_2 ((uint16_t)0x0004) /* Pin 2 selected */ | 
| rajathr | 0:34ee385f4d2d | 162 | #define GPIO_Pin_3 ((uint16_t)0x0008) /* Pin 3 selected */ | 
| rajathr | 0:34ee385f4d2d | 163 | #define GPIO_Pin_4 ((uint16_t)0x0010) /* Pin 4 selected */ | 
| rajathr | 0:34ee385f4d2d | 164 | #define GPIO_Pin_5 ((uint16_t)0x0020) /* Pin 5 selected */ | 
| rajathr | 0:34ee385f4d2d | 165 | #define GPIO_Pin_6 ((uint16_t)0x0040) /* Pin 6 selected */ | 
| rajathr | 0:34ee385f4d2d | 166 | #define GPIO_Pin_7 ((uint16_t)0x0080) /* Pin 7 selected */ | 
| rajathr | 0:34ee385f4d2d | 167 | #define GPIO_Pin_8 ((uint16_t)0x0100) /* Pin 8 selected */ | 
| rajathr | 0:34ee385f4d2d | 168 | #define GPIO_Pin_9 ((uint16_t)0x0200) /* Pin 9 selected */ | 
| rajathr | 0:34ee385f4d2d | 169 | #define GPIO_Pin_10 ((uint16_t)0x0400) /* Pin 10 selected */ | 
| rajathr | 0:34ee385f4d2d | 170 | #define GPIO_Pin_11 ((uint16_t)0x0800) /* Pin 11 selected */ | 
| rajathr | 0:34ee385f4d2d | 171 | #define GPIO_Pin_12 ((uint16_t)0x1000) /* Pin 12 selected */ | 
| rajathr | 0:34ee385f4d2d | 172 | #define GPIO_Pin_13 ((uint16_t)0x2000) /* Pin 13 selected */ | 
| rajathr | 0:34ee385f4d2d | 173 | #define GPIO_Pin_14 ((uint16_t)0x4000) /* Pin 14 selected */ | 
| rajathr | 0:34ee385f4d2d | 174 | #define GPIO_Pin_15 ((uint16_t)0x8000) /* Pin 15 selected */ | 
| rajathr | 0:34ee385f4d2d | 175 | #define GPIO_Pin_All ((uint16_t)0xFFFF) /* All pins selected */ | 
| rajathr | 0:34ee385f4d2d | 176 | |
| rajathr | 0:34ee385f4d2d | 177 | #define GPIO_PIN_MASK_MORT ((uint32_t)0x0000FFFF) /* PIN mask for assert test */ | 
| rajathr | 0:34ee385f4d2d | 178 | #define IS_GPIO_PIN_MORT(PIN) (((PIN) & GPIO_PIN_MASK_MORT ) != (uint32_t)0x00) | 
| rajathr | 0:34ee385f4d2d | 179 | #define IS_GET_GPIO_PIN(PIN) (((PIN) == GPIO_Pin_0) || \ | 
| rajathr | 0:34ee385f4d2d | 180 | ((PIN) == GPIO_Pin_1) || \ | 
| rajathr | 0:34ee385f4d2d | 181 | ((PIN) == GPIO_Pin_2) || \ | 
| rajathr | 0:34ee385f4d2d | 182 | ((PIN) == GPIO_Pin_3) || \ | 
| rajathr | 0:34ee385f4d2d | 183 | ((PIN) == GPIO_Pin_4) || \ | 
| rajathr | 0:34ee385f4d2d | 184 | ((PIN) == GPIO_Pin_5) || \ | 
| rajathr | 0:34ee385f4d2d | 185 | ((PIN) == GPIO_Pin_6) || \ | 
| rajathr | 0:34ee385f4d2d | 186 | ((PIN) == GPIO_Pin_7) || \ | 
| rajathr | 0:34ee385f4d2d | 187 | ((PIN) == GPIO_Pin_8) || \ | 
| rajathr | 0:34ee385f4d2d | 188 | ((PIN) == GPIO_Pin_9) || \ | 
| rajathr | 0:34ee385f4d2d | 189 | ((PIN) == GPIO_Pin_10) || \ | 
| rajathr | 0:34ee385f4d2d | 190 | ((PIN) == GPIO_Pin_11) || \ | 
| rajathr | 0:34ee385f4d2d | 191 | ((PIN) == GPIO_Pin_12) || \ | 
| rajathr | 0:34ee385f4d2d | 192 | ((PIN) == GPIO_Pin_13) || \ | 
| rajathr | 0:34ee385f4d2d | 193 | ((PIN) == GPIO_Pin_14) || \ | 
| rajathr | 0:34ee385f4d2d | 194 | ((PIN) == GPIO_Pin_15)) | 
| rajathr | 0:34ee385f4d2d | 195 | /** | 
| rajathr | 0:34ee385f4d2d | 196 | * @} | 
| rajathr | 0:34ee385f4d2d | 197 | */ | 
| rajathr | 0:34ee385f4d2d | 198 | |
| rajathr | 0:34ee385f4d2d | 199 | |
| rajathr | 0:34ee385f4d2d | 200 | /** @defgroup GPIO_Pin_sources | 
| rajathr | 0:34ee385f4d2d | 201 | * @{ | 
| rajathr | 0:34ee385f4d2d | 202 | */ | 
| rajathr | 0:34ee385f4d2d | 203 | #define GPIO_PinSource0 ((uint8_t)0x00) | 
| rajathr | 0:34ee385f4d2d | 204 | #define GPIO_PinSource1 ((uint8_t)0x01) | 
| rajathr | 0:34ee385f4d2d | 205 | #define GPIO_PinSource2 ((uint8_t)0x02) | 
| rajathr | 0:34ee385f4d2d | 206 | #define GPIO_PinSource3 ((uint8_t)0x03) | 
| rajathr | 0:34ee385f4d2d | 207 | #define GPIO_PinSource4 ((uint8_t)0x04) | 
| rajathr | 0:34ee385f4d2d | 208 | #define GPIO_PinSource5 ((uint8_t)0x05) | 
| rajathr | 0:34ee385f4d2d | 209 | #define GPIO_PinSource6 ((uint8_t)0x06) | 
| rajathr | 0:34ee385f4d2d | 210 | #define GPIO_PinSource7 ((uint8_t)0x07) | 
| rajathr | 0:34ee385f4d2d | 211 | #define GPIO_PinSource8 ((uint8_t)0x08) | 
| rajathr | 0:34ee385f4d2d | 212 | #define GPIO_PinSource9 ((uint8_t)0x09) | 
| rajathr | 0:34ee385f4d2d | 213 | #define GPIO_PinSource10 ((uint8_t)0x0A) | 
| rajathr | 0:34ee385f4d2d | 214 | #define GPIO_PinSource11 ((uint8_t)0x0B) | 
| rajathr | 0:34ee385f4d2d | 215 | #define GPIO_PinSource12 ((uint8_t)0x0C) | 
| rajathr | 0:34ee385f4d2d | 216 | #define GPIO_PinSource13 ((uint8_t)0x0D) | 
| rajathr | 0:34ee385f4d2d | 217 | #define GPIO_PinSource14 ((uint8_t)0x0E) | 
| rajathr | 0:34ee385f4d2d | 218 | #define GPIO_PinSource15 ((uint8_t)0x0F) | 
| rajathr | 0:34ee385f4d2d | 219 | |
| rajathr | 0:34ee385f4d2d | 220 | #define IS_GPIO_PIN_MORT_SOURCE(PINSOURCE) (((PINSOURCE) == GPIO_PinSource0) || \ | 
| rajathr | 0:34ee385f4d2d | 221 | ((PINSOURCE) == GPIO_PinSource1) || \ | 
| rajathr | 0:34ee385f4d2d | 222 | ((PINSOURCE) == GPIO_PinSource2) || \ | 
| rajathr | 0:34ee385f4d2d | 223 | ((PINSOURCE) == GPIO_PinSource3) || \ | 
| rajathr | 0:34ee385f4d2d | 224 | ((PINSOURCE) == GPIO_PinSource4) || \ | 
| rajathr | 0:34ee385f4d2d | 225 | ((PINSOURCE) == GPIO_PinSource5) || \ | 
| rajathr | 0:34ee385f4d2d | 226 | ((PINSOURCE) == GPIO_PinSource6) || \ | 
| rajathr | 0:34ee385f4d2d | 227 | ((PINSOURCE) == GPIO_PinSource7) || \ | 
| rajathr | 0:34ee385f4d2d | 228 | ((PINSOURCE) == GPIO_PinSource8) || \ | 
| rajathr | 0:34ee385f4d2d | 229 | ((PINSOURCE) == GPIO_PinSource9) || \ | 
| rajathr | 0:34ee385f4d2d | 230 | ((PINSOURCE) == GPIO_PinSource10) || \ | 
| rajathr | 0:34ee385f4d2d | 231 | ((PINSOURCE) == GPIO_PinSource11) || \ | 
| rajathr | 0:34ee385f4d2d | 232 | ((PINSOURCE) == GPIO_PinSource12) || \ | 
| rajathr | 0:34ee385f4d2d | 233 | ((PINSOURCE) == GPIO_PinSource13) || \ | 
| rajathr | 0:34ee385f4d2d | 234 | ((PINSOURCE) == GPIO_PinSource14) || \ | 
| rajathr | 0:34ee385f4d2d | 235 | ((PINSOURCE) == GPIO_PinSource15)) | 
| rajathr | 0:34ee385f4d2d | 236 | /** | 
| rajathr | 0:34ee385f4d2d | 237 | * @} | 
| rajathr | 0:34ee385f4d2d | 238 | */ | 
| rajathr | 0:34ee385f4d2d | 239 | |
| rajathr | 0:34ee385f4d2d | 240 | /** @defgroup GPIO_Alternat_function_selection_define | 
| rajathr | 0:34ee385f4d2d | 241 | * @{ | 
| rajathr | 0:34ee385f4d2d | 242 | */ | 
| rajathr | 0:34ee385f4d2d | 243 | /** | 
| rajathr | 0:34ee385f4d2d | 244 | * @brief AF 0 selection | 
| rajathr | 0:34ee385f4d2d | 245 | */ | 
| rajathr | 0:34ee385f4d2d | 246 | #define GPIO_AF_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 247 | #define GPIO_AF_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 248 | #define GPIO_AF_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 249 | #define GPIO_AF_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 250 | #define GPIO_AF_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 251 | #if defined(STM32F446xx) | 
| rajathr | 0:34ee385f4d2d | 252 | #define GPIO_AF0_TIM2 ((uint8_t)0x00) /* TIM2 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 253 | #endif /* STM32F446xx */ | 
| rajathr | 0:34ee385f4d2d | 254 | |
| rajathr | 0:34ee385f4d2d | 255 | /** | 
| rajathr | 0:34ee385f4d2d | 256 | * @brief AF 1 selection | 
| rajathr | 0:34ee385f4d2d | 257 | */ | 
| rajathr | 0:34ee385f4d2d | 258 | #define GPIO_AF_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 259 | #define GPIO_AF_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 260 | #if defined(STM32F410xx) || defined(STM32F413_423xx) | 
| rajathr | 0:34ee385f4d2d | 261 | #define GPIO_AF_LPTIM ((uint8_t)0x01) /* LPTIM Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 262 | #endif /* STM32F410xx || STM32F413_423xx */ | 
| rajathr | 0:34ee385f4d2d | 263 | /** | 
| rajathr | 0:34ee385f4d2d | 264 | * @brief AF 2 selection | 
| rajathr | 0:34ee385f4d2d | 265 | */ | 
| rajathr | 0:34ee385f4d2d | 266 | #define GPIO_AF_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 267 | #define GPIO_AF_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 268 | #define GPIO_AF_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 269 | |
| rajathr | 0:34ee385f4d2d | 270 | /** | 
| rajathr | 0:34ee385f4d2d | 271 | * @brief AF 3 selection | 
| rajathr | 0:34ee385f4d2d | 272 | */ | 
| rajathr | 0:34ee385f4d2d | 273 | #define GPIO_AF_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 274 | #define GPIO_AF_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 275 | #define GPIO_AF_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 276 | #define GPIO_AF_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 277 | #if defined(STM32F446xx) | 
| rajathr | 0:34ee385f4d2d | 278 | #define GPIO_AF3_CEC ((uint8_t)0x03) /* CEC Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 279 | #endif /* STM32F446xx */ | 
| rajathr | 0:34ee385f4d2d | 280 | #if defined(STM32F413_423xx) | 
| rajathr | 0:34ee385f4d2d | 281 | #define GPIO_AF3_DFSDM2 ((uint8_t)0x03) /* DFSDM2 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 282 | #endif /* STM32F413_423xx */ | 
| rajathr | 0:34ee385f4d2d | 283 | /** | 
| rajathr | 0:34ee385f4d2d | 284 | * @brief AF 4 selection | 
| rajathr | 0:34ee385f4d2d | 285 | */ | 
| rajathr | 0:34ee385f4d2d | 286 | #define GPIO_AF_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 287 | #define GPIO_AF_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 288 | #define GPIO_AF_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 289 | #if defined(STM32F446xx) | 
| rajathr | 0:34ee385f4d2d | 290 | #define GPIO_AF4_CEC ((uint8_t)0x04) /* CEC Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 291 | #endif /* STM32F446xx */ | 
| rajathr | 0:34ee385f4d2d | 292 | #if defined(STM32F410xx) || defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx) | 
| rajathr | 0:34ee385f4d2d | 293 | #define GPIO_AF_FMPI2C ((uint8_t)0x04) /* FMPI2C Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 294 | #endif /* STM32F410xx || STM32F446xx */ | 
| rajathr | 0:34ee385f4d2d | 295 | |
| rajathr | 0:34ee385f4d2d | 296 | /** | 
| rajathr | 0:34ee385f4d2d | 297 | * @brief AF 5 selection | 
| rajathr | 0:34ee385f4d2d | 298 | */ | 
| rajathr | 0:34ee385f4d2d | 299 | #define GPIO_AF_SPI1 ((uint8_t)0x05) /* SPI1/I2S1 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 300 | #define GPIO_AF_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 301 | #define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3/I2S3 Alternate Function mapping (Only for STM32F411xE and STM32F413_423xx Devices) */ | 
| rajathr | 0:34ee385f4d2d | 302 | #define GPIO_AF_SPI4 ((uint8_t)0x05) /* SPI4/I2S4 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 303 | #define GPIO_AF_SPI5 ((uint8_t)0x05) /* SPI5 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 304 | #define GPIO_AF_SPI6 ((uint8_t)0x05) /* SPI6 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 305 | |
| rajathr | 0:34ee385f4d2d | 306 | /** | 
| rajathr | 0:34ee385f4d2d | 307 | * @brief AF 6 selection | 
| rajathr | 0:34ee385f4d2d | 308 | */ | 
| rajathr | 0:34ee385f4d2d | 309 | #define GPIO_AF_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 310 | #define GPIO_AF6_SPI1 ((uint8_t)0x06) /* SPI1 Alternate Function mapping (Only for STM32F410xx Devices) */ | 
| rajathr | 0:34ee385f4d2d | 311 | #define GPIO_AF6_SPI2 ((uint8_t)0x06) /* SPI2 Alternate Function mapping (Only for STM32F410xx/STM32F411xE Devices) */ | 
| rajathr | 0:34ee385f4d2d | 312 | #define GPIO_AF6_SPI4 ((uint8_t)0x06) /* SPI4 Alternate Function mapping (Only for STM32F411xE Devices) */ | 
| rajathr | 0:34ee385f4d2d | 313 | #define GPIO_AF6_SPI5 ((uint8_t)0x06) /* SPI5 Alternate Function mapping (Only for STM32F410xx/STM32F411xE Devices) */ | 
| rajathr | 0:34ee385f4d2d | 314 | #define GPIO_AF_SAI1 ((uint8_t)0x06) /* SAI1 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 315 | #define GPIO_AF_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping (only for STM32F412xG and STM32F413_423xx Devices) */ | 
| rajathr | 0:34ee385f4d2d | 316 | #if defined(STM32F412xG) || defined(STM32F413_423xx) | 
| rajathr | 0:34ee385f4d2d | 317 | #define GPIO_AF6_DFSDM1 ((uint8_t)0x06) /* DFSDM1 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 318 | #endif /* STM32F412xG || STM32F413_423xx */ | 
| rajathr | 0:34ee385f4d2d | 319 | #if defined(STM32F413_423xx) | 
| rajathr | 0:34ee385f4d2d | 320 | #define GPIO_AF6_DFSDM2 ((uint8_t)0x06) /* DFSDM2 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 321 | #endif /* STM32F413_423xx */ | 
| rajathr | 0:34ee385f4d2d | 322 | |
| rajathr | 0:34ee385f4d2d | 323 | /** | 
| rajathr | 0:34ee385f4d2d | 324 | * @brief AF 7 selection | 
| rajathr | 0:34ee385f4d2d | 325 | */ | 
| rajathr | 0:34ee385f4d2d | 326 | #define GPIO_AF_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 327 | #define GPIO_AF_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 328 | #define GPIO_AF_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 329 | #define GPIO_AF7_SPI3 ((uint8_t)0x07) /* SPI3/I2S3ext Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 330 | #if defined(STM32F413_423xx) | 
| rajathr | 0:34ee385f4d2d | 331 | #define GPIO_AF7_DFSDM2 ((uint8_t)0x07) /* DFSDM2 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 332 | #define GPIO_AF7_SAI1 ((uint8_t)0x07) /* SAI1 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 333 | #endif /* STM32F413_423xx */ | 
| rajathr | 0:34ee385f4d2d | 334 | |
| rajathr | 0:34ee385f4d2d | 335 | /** | 
| rajathr | 0:34ee385f4d2d | 336 | * @brief AF 7 selection Legacy | 
| rajathr | 0:34ee385f4d2d | 337 | */ | 
| rajathr | 0:34ee385f4d2d | 338 | #define GPIO_AF_I2S3ext GPIO_AF7_SPI3 | 
| rajathr | 0:34ee385f4d2d | 339 | |
| rajathr | 0:34ee385f4d2d | 340 | /** | 
| rajathr | 0:34ee385f4d2d | 341 | * @brief AF 8 selection | 
| rajathr | 0:34ee385f4d2d | 342 | */ | 
| rajathr | 0:34ee385f4d2d | 343 | #define GPIO_AF_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 344 | #define GPIO_AF_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 345 | #define GPIO_AF_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 346 | #define GPIO_AF_UART7 ((uint8_t)0x08) /* UART7 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 347 | #define GPIO_AF_UART8 ((uint8_t)0x08) /* UART8 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 348 | #if defined(STM32F412xG) || defined(STM32F413_423xx) | 
| rajathr | 0:34ee385f4d2d | 349 | #define GPIO_AF8_USART3 ((uint8_t)0x08) /* USART3 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 350 | #define GPIO_AF8_DFSDM1 ((uint8_t)0x08) /* DFSDM Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 351 | #define GPIO_AF8_CAN1 ((uint8_t)0x08) /* CAN1 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 352 | #endif /* STM32F412xG || STM32F413_423xx */ | 
| rajathr | 0:34ee385f4d2d | 353 | #if defined(STM32F446xx) | 
| rajathr | 0:34ee385f4d2d | 354 | #define GPIO_AF8_SAI2 ((uint8_t)0x08) /* SAI2 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 355 | #define GPIO_AF_SPDIF ((uint8_t)0x08) /* SPDIF Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 356 | #endif /* STM32F446xx */ | 
| rajathr | 0:34ee385f4d2d | 357 | |
| rajathr | 0:34ee385f4d2d | 358 | /** | 
| rajathr | 0:34ee385f4d2d | 359 | * @brief AF 9 selection | 
| rajathr | 0:34ee385f4d2d | 360 | */ | 
| rajathr | 0:34ee385f4d2d | 361 | #define GPIO_AF_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 362 | #define GPIO_AF_CAN2 ((uint8_t)0x09) /* CAN2 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 363 | #define GPIO_AF_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 364 | #define GPIO_AF_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 365 | #define GPIO_AF_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 366 | #define GPIO_AF9_I2C2 ((uint8_t)0x09) /* I2C2 Alternate Function mapping (Only for STM32F401xx/STM32F410xx/STM32F411xE/STM32F412xG/STM32F413_423xx Devices) */ | 
| rajathr | 0:34ee385f4d2d | 367 | #define GPIO_AF9_I2C3 ((uint8_t)0x09) /* I2C3 Alternate Function mapping (Only for STM32F401xx/STM32F411xE/STM32F412xG and STM32F413_423xx Devices) */ | 
| rajathr | 0:34ee385f4d2d | 368 | #if defined(STM32F446xx) | 
| rajathr | 0:34ee385f4d2d | 369 | #define GPIO_AF9_SAI2 ((uint8_t)0x09) /* SAI2 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 370 | #endif /* STM32F446xx */ | 
| rajathr | 0:34ee385f4d2d | 371 | #define GPIO_AF9_LTDC ((uint8_t)0x09) /* LTDC Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 372 | #if defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx) || defined(STM32F469_479xx) | 
| rajathr | 0:34ee385f4d2d | 373 | #define GPIO_AF9_QUADSPI ((uint8_t)0x09) /* QuadSPI Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 374 | #endif /* STM32F412xG || STM32F413_423xx || STM32F446xx || STM32F469_479xx */ | 
| rajathr | 0:34ee385f4d2d | 375 | #if defined(STM32F410xx) || defined(STM32F412xG) || defined(STM32F413_423xx) | 
| rajathr | 0:34ee385f4d2d | 376 | #define GPIO_AF9_FMPI2C ((uint8_t)0x09) /* FMPI2C Alternate Function mapping (Only for STM32F410xx Devices) */ | 
| rajathr | 0:34ee385f4d2d | 377 | #endif /* STM32F410xx || STM32F412xG || STM32F413_423xx */ | 
| rajathr | 0:34ee385f4d2d | 378 | |
| rajathr | 0:34ee385f4d2d | 379 | /** | 
| rajathr | 0:34ee385f4d2d | 380 | * @brief AF 10 selection | 
| rajathr | 0:34ee385f4d2d | 381 | */ | 
| rajathr | 0:34ee385f4d2d | 382 | #define GPIO_AF_OTG_FS ((uint8_t)0xA) /* OTG_FS Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 383 | #define GPIO_AF_OTG_HS ((uint8_t)0xA) /* OTG_HS Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 384 | #if defined(STM32F446xx) | 
| rajathr | 0:34ee385f4d2d | 385 | #define GPIO_AF10_SAI2 ((uint8_t)0x0A) /* SAI2 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 386 | #endif /* STM32F446xx */ | 
| rajathr | 0:34ee385f4d2d | 387 | #if defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx) || defined(STM32F469_479xx) | 
| rajathr | 0:34ee385f4d2d | 388 | #define GPIO_AF10_QUADSPI ((uint8_t)0x0A) /* QuadSPI Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 389 | #endif /* STM32F412xG || STM32F413_423xx || STM32F446xx || STM32F469_479xx */ | 
| rajathr | 0:34ee385f4d2d | 390 | #if defined(STM32F412xG) || defined(STM32F413_423xx) | 
| rajathr | 0:34ee385f4d2d | 391 | #define GPIO_AF10_FMC ((uint8_t)0xA) /* FMC Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 392 | #define GPIO_AF10_DFSDM1 ((uint8_t)0xA) /* DFSDM Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 393 | #endif /* STM32F412xG || STM32F413_423xx */ | 
| rajathr | 0:34ee385f4d2d | 394 | #if defined(STM32F413_423xx) | 
| rajathr | 0:34ee385f4d2d | 395 | #define GPIO_AF10_DFSDM2 ((uint8_t)0x0A) /* DFSDM2 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 396 | #define GPIO_AF10_SAI1 ((uint8_t)0x0A) /* SAI1 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 397 | #endif /* STM32F413_423xx */ | 
| rajathr | 0:34ee385f4d2d | 398 | /** | 
| rajathr | 0:34ee385f4d2d | 399 | * @brief AF 11 selection | 
| rajathr | 0:34ee385f4d2d | 400 | */ | 
| rajathr | 0:34ee385f4d2d | 401 | #define GPIO_AF_ETH ((uint8_t)0x0B) /* ETHERNET Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 402 | #if defined(STM32F413_423xx) | 
| rajathr | 0:34ee385f4d2d | 403 | #define GPIO_AF11_UART4 ((uint8_t)0x0B) /* UART4 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 404 | #define GPIO_AF11_UART5 ((uint8_t)0x0B) /* UART5 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 405 | #define GPIO_AF11_UART9 ((uint8_t)0x0B) /* UART9 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 406 | #define GPIO_AF11_UART10 ((uint8_t)0x0B) /* UART10 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 407 | #define GPIO_AF11_CAN3 ((uint8_t)0x0B) /* CAN3 Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 408 | #endif /* STM32F413_423xx */ | 
| rajathr | 0:34ee385f4d2d | 409 | |
| rajathr | 0:34ee385f4d2d | 410 | /** | 
| rajathr | 0:34ee385f4d2d | 411 | * @brief AF 12 selection | 
| rajathr | 0:34ee385f4d2d | 412 | */ | 
| rajathr | 0:34ee385f4d2d | 413 | #if defined(STM32F40_41xxx) || defined(STM32F412xG) || defined(STM32F413_423xx) | 
| rajathr | 0:34ee385f4d2d | 414 | #define GPIO_AF_FSMC ((uint8_t)0xC) /* FSMC Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 415 | #endif /* STM32F40_41xxx || STM32F412xG || STM32F413_423xx */ | 
| rajathr | 0:34ee385f4d2d | 416 | |
| rajathr | 0:34ee385f4d2d | 417 | #if defined(STM32F427_437xx) || defined(STM32F429_439xx) || defined(STM32F446xx) || defined(STM32F469_479xx) | 
| rajathr | 0:34ee385f4d2d | 418 | #define GPIO_AF_FMC ((uint8_t)0xC) /* FMC Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 419 | #endif /* STM32F427_437xx || STM32F429_439xx || STM32F446xx || STM32F469_479xx */ | 
| rajathr | 0:34ee385f4d2d | 420 | |
| rajathr | 0:34ee385f4d2d | 421 | #define GPIO_AF_OTG_HS_FS ((uint8_t)0xC) /* OTG HS configured in FS, Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 422 | #define GPIO_AF_SDIO ((uint8_t)0xC) /* SDIO Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 423 | |
| rajathr | 0:34ee385f4d2d | 424 | /** | 
| rajathr | 0:34ee385f4d2d | 425 | * @brief AF 13 selection | 
| rajathr | 0:34ee385f4d2d | 426 | */ | 
| rajathr | 0:34ee385f4d2d | 427 | #define GPIO_AF_DCMI ((uint8_t)0x0D) /* DCMI Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 428 | #if defined(STM32F469_479xx) | 
| rajathr | 0:34ee385f4d2d | 429 | #define GPIO_AF_DSI ((uint8_t)0x0D) /* DSI Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 430 | #endif /* STM32F469_479xx */ | 
| rajathr | 0:34ee385f4d2d | 431 | /** | 
| rajathr | 0:34ee385f4d2d | 432 | * @brief AF 14 selection | 
| rajathr | 0:34ee385f4d2d | 433 | */ | 
| rajathr | 0:34ee385f4d2d | 434 | #define GPIO_AF_LTDC ((uint8_t)0x0E) /* LCD-TFT Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 435 | #if defined(STM32F413_423xx) | 
| rajathr | 0:34ee385f4d2d | 436 | #define GPIO_AF14_RNG ((uint8_t)0x0E) /* RNG Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 437 | #endif /* STM32F413_423xx */ | 
| rajathr | 0:34ee385f4d2d | 438 | |
| rajathr | 0:34ee385f4d2d | 439 | /** | 
| rajathr | 0:34ee385f4d2d | 440 | * @brief AF 15 selection | 
| rajathr | 0:34ee385f4d2d | 441 | */ | 
| rajathr | 0:34ee385f4d2d | 442 | #define GPIO_AF_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ | 
| rajathr | 0:34ee385f4d2d | 443 | |
| rajathr | 0:34ee385f4d2d | 444 | #if defined(STM32F40_41xxx) | 
| rajathr | 0:34ee385f4d2d | 445 | #define IS_GPIO_AF_MORT(AF) (((AF) == GPIO_AF_RTC_50Hz) || ((AF) == GPIO_AF_TIM14) || \ | 
| rajathr | 0:34ee385f4d2d | 446 | ((AF) == GPIO_AF_MCO) || ((AF) == GPIO_AF_TAMPER) || \ | 
| rajathr | 0:34ee385f4d2d | 447 | ((AF) == GPIO_AF_SWJ) || ((AF) == GPIO_AF_TRACE) || \ | 
| rajathr | 0:34ee385f4d2d | 448 | ((AF) == GPIO_AF_TIM1) || ((AF) == GPIO_AF_TIM2) || \ | 
| rajathr | 0:34ee385f4d2d | 449 | ((AF) == GPIO_AF_TIM3) || ((AF) == GPIO_AF_TIM4) || \ | 
| rajathr | 0:34ee385f4d2d | 450 | ((AF) == GPIO_AF_TIM5) || ((AF) == GPIO_AF_TIM8) || \ | 
| rajathr | 0:34ee385f4d2d | 451 | ((AF) == GPIO_AF_I2C1) || ((AF) == GPIO_AF_I2C2) || \ | 
| rajathr | 0:34ee385f4d2d | 452 | ((AF) == GPIO_AF_I2C3) || ((AF) == GPIO_AF_SPI1) || \ | 
| rajathr | 0:34ee385f4d2d | 453 | ((AF) == GPIO_AF_SPI2) || ((AF) == GPIO_AF_TIM13) || \ | 
| rajathr | 0:34ee385f4d2d | 454 | ((AF) == GPIO_AF_SPI3) || ((AF) == GPIO_AF_TIM14) || \ | 
| rajathr | 0:34ee385f4d2d | 455 | ((AF) == GPIO_AF_USART1) || ((AF) == GPIO_AF_USART2) || \ | 
| rajathr | 0:34ee385f4d2d | 456 | ((AF) == GPIO_AF_USART3) || ((AF) == GPIO_AF_UART4) || \ | 
| rajathr | 0:34ee385f4d2d | 457 | ((AF) == GPIO_AF_UART5) || ((AF) == GPIO_AF_USART6) || \ | 
| rajathr | 0:34ee385f4d2d | 458 | ((AF) == GPIO_AF_CAN1) || ((AF) == GPIO_AF_CAN2) || \ | 
| rajathr | 0:34ee385f4d2d | 459 | ((AF) == GPIO_AF_OTG_FS) || ((AF) == GPIO_AF_OTG_HS) || \ | 
| rajathr | 0:34ee385f4d2d | 460 | ((AF) == GPIO_AF_ETH) || ((AF) == GPIO_AF_OTG_HS_FS) || \ | 
| rajathr | 0:34ee385f4d2d | 461 | ((AF) == GPIO_AF_SDIO) || ((AF) == GPIO_AF_DCMI) || \ | 
| rajathr | 0:34ee385f4d2d | 462 | ((AF) == GPIO_AF_EVENTOUT) || ((AF) == GPIO_AF_FSMC)) | 
| rajathr | 0:34ee385f4d2d | 463 | #endif /* STM32F40_41xxx */ | 
| rajathr | 0:34ee385f4d2d | 464 | |
| rajathr | 0:34ee385f4d2d | 465 | #if defined(STM32F401xx) | 
| rajathr | 0:34ee385f4d2d | 466 | #define IS_GPIO_AF_MORT(AF) (((AF) == GPIO_AF_RTC_50Hz) || ((AF) == GPIO_AF_TIM14) || \ | 
| rajathr | 0:34ee385f4d2d | 467 | ((AF) == GPIO_AF_MCO) || ((AF) == GPIO_AF_TAMPER) || \ | 
| rajathr | 0:34ee385f4d2d | 468 | ((AF) == GPIO_AF_SWJ) || ((AF) == GPIO_AF_TRACE) || \ | 
| rajathr | 0:34ee385f4d2d | 469 | ((AF) == GPIO_AF_TIM1) || ((AF) == GPIO_AF_TIM2) || \ | 
| rajathr | 0:34ee385f4d2d | 470 | ((AF) == GPIO_AF_TIM3) || ((AF) == GPIO_AF_TIM4) || \ | 
| rajathr | 0:34ee385f4d2d | 471 | ((AF) == GPIO_AF_TIM5) || ((AF) == GPIO_AF_TIM8) || \ | 
| rajathr | 0:34ee385f4d2d | 472 | ((AF) == GPIO_AF_I2C1) || ((AF) == GPIO_AF_I2C2) || \ | 
| rajathr | 0:34ee385f4d2d | 473 | ((AF) == GPIO_AF_I2C3) || ((AF) == GPIO_AF_SPI1) || \ | 
| rajathr | 0:34ee385f4d2d | 474 | ((AF) == GPIO_AF_SPI2) || ((AF) == GPIO_AF_TIM13) || \ | 
| rajathr | 0:34ee385f4d2d | 475 | ((AF) == GPIO_AF_SPI3) || ((AF) == GPIO_AF_TIM14) || \ | 
| rajathr | 0:34ee385f4d2d | 476 | ((AF) == GPIO_AF_USART1) || ((AF) == GPIO_AF_USART2) || \ | 
| rajathr | 0:34ee385f4d2d | 477 | ((AF) == GPIO_AF_SDIO) || ((AF) == GPIO_AF_USART6) || \ | 
| rajathr | 0:34ee385f4d2d | 478 | ((AF) == GPIO_AF_OTG_FS) || ((AF) == GPIO_AF_OTG_HS) || \ | 
| rajathr | 0:34ee385f4d2d | 479 | ((AF) == GPIO_AF_EVENTOUT) || ((AF) == GPIO_AF_SPI4)) | 
| rajathr | 0:34ee385f4d2d | 480 | #endif /* STM32F401xx */ | 
| rajathr | 0:34ee385f4d2d | 481 | |
| rajathr | 0:34ee385f4d2d | 482 | #if defined(STM32F411xE) | 
| rajathr | 0:34ee385f4d2d | 483 | #define IS_GPIO_AF_MORT(AF) (((AF) < 16) && ((AF) != 11) && ((AF) != 13) && ((AF) != 14)) | 
| rajathr | 0:34ee385f4d2d | 484 | #endif /* STM32F411xE */ | 
| rajathr | 0:34ee385f4d2d | 485 | |
| rajathr | 0:34ee385f4d2d | 486 | #if defined(STM32F410xx) | 
| rajathr | 0:34ee385f4d2d | 487 | #define IS_GPIO_AF_MORT(AF) (((AF) < 10) || ((AF) == 15)) | 
| rajathr | 0:34ee385f4d2d | 488 | #endif /* STM32F410xx */ | 
| rajathr | 0:34ee385f4d2d | 489 | |
| rajathr | 0:34ee385f4d2d | 490 | #if defined(STM32F427_437xx) || defined(STM32F429_439xx) | 
| rajathr | 0:34ee385f4d2d | 491 | #define IS_GPIO_AF_MORT(AF) (((AF) == GPIO_AF_RTC_50Hz) || ((AF) == GPIO_AF_TIM14) || \ | 
| rajathr | 0:34ee385f4d2d | 492 | ((AF) == GPIO_AF_MCO) || ((AF) == GPIO_AF_TAMPER) || \ | 
| rajathr | 0:34ee385f4d2d | 493 | ((AF) == GPIO_AF_SWJ) || ((AF) == GPIO_AF_TRACE) || \ | 
| rajathr | 0:34ee385f4d2d | 494 | ((AF) == GPIO_AF_TIM1) || ((AF) == GPIO_AF_TIM2) || \ | 
| rajathr | 0:34ee385f4d2d | 495 | ((AF) == GPIO_AF_TIM3) || ((AF) == GPIO_AF_TIM4) || \ | 
| rajathr | 0:34ee385f4d2d | 496 | ((AF) == GPIO_AF_TIM5) || ((AF) == GPIO_AF_TIM8) || \ | 
| rajathr | 0:34ee385f4d2d | 497 | ((AF) == GPIO_AF_I2C1) || ((AF) == GPIO_AF_I2C2) || \ | 
| rajathr | 0:34ee385f4d2d | 498 | ((AF) == GPIO_AF_I2C3) || ((AF) == GPIO_AF_SPI1) || \ | 
| rajathr | 0:34ee385f4d2d | 499 | ((AF) == GPIO_AF_SPI2) || ((AF) == GPIO_AF_TIM13) || \ | 
| rajathr | 0:34ee385f4d2d | 500 | ((AF) == GPIO_AF_SPI3) || ((AF) == GPIO_AF_TIM14) || \ | 
| rajathr | 0:34ee385f4d2d | 501 | ((AF) == GPIO_AF_USART1) || ((AF) == GPIO_AF_USART2) || \ | 
| rajathr | 0:34ee385f4d2d | 502 | ((AF) == GPIO_AF_USART3) || ((AF) == GPIO_AF_UART4) || \ | 
| rajathr | 0:34ee385f4d2d | 503 | ((AF) == GPIO_AF_UART5) || ((AF) == GPIO_AF_USART6) || \ | 
| rajathr | 0:34ee385f4d2d | 504 | ((AF) == GPIO_AF_CAN1) || ((AF) == GPIO_AF_CAN2) || \ | 
| rajathr | 0:34ee385f4d2d | 505 | ((AF) == GPIO_AF_OTG_FS) || ((AF) == GPIO_AF_OTG_HS) || \ | 
| rajathr | 0:34ee385f4d2d | 506 | ((AF) == GPIO_AF_ETH) || ((AF) == GPIO_AF_OTG_HS_FS) || \ | 
| rajathr | 0:34ee385f4d2d | 507 | ((AF) == GPIO_AF_SDIO) || ((AF) == GPIO_AF_DCMI) || \ | 
| rajathr | 0:34ee385f4d2d | 508 | ((AF) == GPIO_AF_EVENTOUT) || ((AF) == GPIO_AF_SPI4) || \ | 
| rajathr | 0:34ee385f4d2d | 509 | ((AF) == GPIO_AF_SPI5) || ((AF) == GPIO_AF_SPI6) || \ | 
| rajathr | 0:34ee385f4d2d | 510 | ((AF) == GPIO_AF_UART7) || ((AF) == GPIO_AF_UART8) || \ | 
| rajathr | 0:34ee385f4d2d | 511 | ((AF) == GPIO_AF_FMC) || ((AF) == GPIO_AF_SAI1) || \ | 
| rajathr | 0:34ee385f4d2d | 512 | ((AF) == GPIO_AF_LTDC)) | 
| rajathr | 0:34ee385f4d2d | 513 | #endif /* STM32F427_437xx || STM32F429_439xx */ | 
| rajathr | 0:34ee385f4d2d | 514 | |
| rajathr | 0:34ee385f4d2d | 515 | #if defined(STM32F412xG) | 
| rajathr | 0:34ee385f4d2d | 516 | #define IS_GPIO_AF_MORT(AF) (((AF) < 16) && ((AF) != 11) && ((AF) != 14)) | 
| rajathr | 0:34ee385f4d2d | 517 | #endif /* STM32F412xG */ | 
| rajathr | 0:34ee385f4d2d | 518 | |
| rajathr | 0:34ee385f4d2d | 519 | #if defined(STM32F413_423xx) | 
| rajathr | 0:34ee385f4d2d | 520 | #define IS_GPIO_AF_MORT(AF) (((AF) < 16) && ((AF) != 13)) | 
| rajathr | 0:34ee385f4d2d | 521 | #endif /* STM32F413_423xx */ | 
| rajathr | 0:34ee385f4d2d | 522 | |
| rajathr | 0:34ee385f4d2d | 523 | #if defined(STM32F446xx) | 
| rajathr | 0:34ee385f4d2d | 524 | #define IS_GPIO_AF_MORT(AF) (((AF) < 16) && ((AF) != 11) && ((AF) != 14)) | 
| rajathr | 0:34ee385f4d2d | 525 | #endif /* STM32F446xx */ | 
| rajathr | 0:34ee385f4d2d | 526 | |
| rajathr | 0:34ee385f4d2d | 527 | #if defined(STM32F469_479xx) | 
| rajathr | 0:34ee385f4d2d | 528 | #define IS_GPIO_AF_MORT(AF) ((AF) < 16) | 
| rajathr | 0:34ee385f4d2d | 529 | #endif /* STM32F469_479xx */ | 
| rajathr | 0:34ee385f4d2d | 530 | |
| rajathr | 0:34ee385f4d2d | 531 | /** | 
| rajathr | 0:34ee385f4d2d | 532 | * @} | 
| rajathr | 0:34ee385f4d2d | 533 | */ | 
| rajathr | 0:34ee385f4d2d | 534 | |
| rajathr | 0:34ee385f4d2d | 535 | /** @defgroup GPIO_Legacy | 
| rajathr | 0:34ee385f4d2d | 536 | * @{ | 
| rajathr | 0:34ee385f4d2d | 537 | */ | 
| rajathr | 0:34ee385f4d2d | 538 | |
| rajathr | 0:34ee385f4d2d | 539 | #define GPIO_Mode_AIN GPIO_Mode_AN | 
| rajathr | 0:34ee385f4d2d | 540 | |
| rajathr | 0:34ee385f4d2d | 541 | #define GPIO_AF_OTG1_FS GPIO_AF_OTG_FS | 
| rajathr | 0:34ee385f4d2d | 542 | #define GPIO_AF_OTG2_HS GPIO_AF_OTG_HS | 
| rajathr | 0:34ee385f4d2d | 543 | #define GPIO_AF_OTG2_FS GPIO_AF_OTG_HS_FS | 
| rajathr | 0:34ee385f4d2d | 544 | |
| rajathr | 0:34ee385f4d2d | 545 | /** | 
| rajathr | 0:34ee385f4d2d | 546 | * @} | 
| rajathr | 0:34ee385f4d2d | 547 | */ | 
| rajathr | 0:34ee385f4d2d | 548 | |
| rajathr | 0:34ee385f4d2d | 549 | /** | 
| rajathr | 0:34ee385f4d2d | 550 | * @} | 
| rajathr | 0:34ee385f4d2d | 551 | */ | 
| rajathr | 0:34ee385f4d2d | 552 | |
| rajathr | 0:34ee385f4d2d | 553 | /* Exported macro ------------------------------------------------------------*/ | 
| rajathr | 0:34ee385f4d2d | 554 | /* Exported functions --------------------------------------------------------*/ | 
| rajathr | 0:34ee385f4d2d | 555 | |
| rajathr | 0:34ee385f4d2d | 556 | /* Function used to set the GPIO configuration to the default reset state ****/ | 
| rajathr | 0:34ee385f4d2d | 557 | void GPIO_DeInit_mort(GPIO_TypeDef_mort* GPIOx); | 
| rajathr | 0:34ee385f4d2d | 558 | |
| rajathr | 0:34ee385f4d2d | 559 | /* Initialization and Configuration functions *********************************/ | 
| rajathr | 0:34ee385f4d2d | 560 | void GPIO_Init_mort(GPIO_TypeDef_mort* GPIOx, GPIO_InitTypeDef_mort* GPIO_InitStruct); | 
| rajathr | 0:34ee385f4d2d | 561 | void GPIO_StructInit_mort(GPIO_InitTypeDef_mort* GPIO_InitStruct); | 
| rajathr | 0:34ee385f4d2d | 562 | void GPIO_PinLockConfig_mort(GPIO_TypeDef_mort* GPIOx, uint16_t GPIO_Pin); | 
| rajathr | 0:34ee385f4d2d | 563 | |
| rajathr | 0:34ee385f4d2d | 564 | /* GPIO Read and Write functions **********************************************/ | 
| rajathr | 0:34ee385f4d2d | 565 | uint8_t GPIO_ReadInputDataBit_mort(GPIO_TypeDef_mort* GPIOx, uint16_t GPIO_Pin); | 
| rajathr | 0:34ee385f4d2d | 566 | uint16_t GPIO_ReadInputData_mort(GPIO_TypeDef_mort* GPIOx); | 
| rajathr | 0:34ee385f4d2d | 567 | uint8_t GPIO_ReadOutputDataBit_mort(GPIO_TypeDef_mort* GPIOx, uint16_t GPIO_Pin); | 
| rajathr | 0:34ee385f4d2d | 568 | uint16_t GPIO_ReadOutputData_mort(GPIO_TypeDef_mort* GPIOx); | 
| rajathr | 0:34ee385f4d2d | 569 | void GPIO_SetBits_mort(GPIO_TypeDef_mort* GPIOx, uint16_t GPIO_Pin); | 
| rajathr | 0:34ee385f4d2d | 570 | void GPIO_ResetBits_mort(GPIO_TypeDef_mort* GPIOx, uint16_t GPIO_Pin); | 
| rajathr | 0:34ee385f4d2d | 571 | void GPIO_WriteBit_mort(GPIO_TypeDef_mort* GPIOx, uint16_t GPIO_Pin, BitAction BitVal); | 
| rajathr | 0:34ee385f4d2d | 572 | void GPIO_Write_mort(GPIO_TypeDef_mort* GPIOx, uint16_t PortVal); | 
| rajathr | 0:34ee385f4d2d | 573 | void GPIO_ToggleBits_mort(GPIO_TypeDef_mort* GPIOx, uint16_t GPIO_Pin); | 
| rajathr | 0:34ee385f4d2d | 574 | |
| rajathr | 0:34ee385f4d2d | 575 | /* GPIO Alternate functions configuration function ****************************/ | 
| rajathr | 0:34ee385f4d2d | 576 | void GPIO_PinAFConfig_mort(GPIO_TypeDef_mort* GPIOx, uint16_t GPIO_PinSource, uint8_t GPIO_AF); | 
| rajathr | 0:34ee385f4d2d | 577 | |
| rajathr | 0:34ee385f4d2d | 578 | #ifdef __cplusplus | 
| rajathr | 0:34ee385f4d2d | 579 | } | 
| rajathr | 0:34ee385f4d2d | 580 | #endif | 
| rajathr | 0:34ee385f4d2d | 581 | |
| rajathr | 0:34ee385f4d2d | 582 | #endif /*__STM32F4xx_GPIO_H */ | 
| rajathr | 0:34ee385f4d2d | 583 | |
| rajathr | 0:34ee385f4d2d | 584 | /** | 
| rajathr | 0:34ee385f4d2d | 585 | * @} | 
| rajathr | 0:34ee385f4d2d | 586 | */ | 
| rajathr | 0:34ee385f4d2d | 587 | |
| rajathr | 0:34ee385f4d2d | 588 | /** | 
| rajathr | 0:34ee385f4d2d | 589 | * @} | 
| rajathr | 0:34ee385f4d2d | 590 | */ | 
| rajathr | 0:34ee385f4d2d | 591 | |
| rajathr | 0:34ee385f4d2d | 592 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | 
| rajathr | 0:34ee385f4d2d | 593 | |
| rajathr | 0:34ee385f4d2d | 594 | |
| rajathr | 0:34ee385f4d2d | 595 | |
| rajathr | 0:34ee385f4d2d | 596 | |
| rajathr | 0:34ee385f4d2d | 597 |