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
00001 /** 00002 ****************************************************************************** 00003 * @file stm32f4xx_gpio.h 00004 * @author MCD Application Team 00005 * @version V1.8.0 00006 * @date 04-November-2016 00007 * @brief This file contains all the functions prototypes for the GPIO firmware 00008 * library. 00009 ****************************************************************************** 00010 * @attention 00011 * 00012 * <h2><center>© COPYRIGHT 2016 STMicroelectronics</center></h2> 00013 * 00014 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 00015 * You may not use this file except in compliance with the License. 00016 * You may obtain a copy of the License at: 00017 * 00018 * http://www.st.com/software_license_agreement_liberty_v2 00019 * 00020 * Unless required by applicable law or agreed to in writing, software 00021 * distributed under the License is distributed on an "AS IS" BASIS, 00022 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00023 * See the License for the specific language governing permissions and 00024 * limitations under the License. 00025 * 00026 ****************************************************************************** 00027 */ 00028 00029 /* Define to prevent recursive inclusion -------------------------------------*/ 00030 #ifndef __STM32F4xx_GPIO_H_MORT 00031 #define __STM32F4xx_GPIO_H_MORT 00032 00033 #ifdef __cplusplus 00034 extern "C" { 00035 #endif 00036 00037 /* Includes ------------------------------------------------------------------*/ 00038 #include "stm32f4xx_mort2.h" 00039 00040 /** @addtogroup STM32F4xx_StdPeriph_Driver 00041 * @{ 00042 */ 00043 00044 /** @addtogroup GPIO 00045 * @{ 00046 */ 00047 00048 /* Exported types ------------------------------------------------------------*/ 00049 00050 #define IS_GPIO_ALL_PERIPH(PERIPH) (((PERIPH) == GPIOA) || \ 00051 ((PERIPH) == GPIOB) || \ 00052 ((PERIPH) == GPIOC) || \ 00053 ((PERIPH) == GPIOD) || \ 00054 ((PERIPH) == GPIOE) || \ 00055 ((PERIPH) == GPIOF) || \ 00056 ((PERIPH) == GPIOG) || \ 00057 ((PERIPH) == GPIOH) || \ 00058 ((PERIPH) == GPIOI) || \ 00059 ((PERIPH) == GPIOJ) || \ 00060 ((PERIPH) == GPIOK)) 00061 00062 /** 00063 * @brief GPIO Configuration Mode enumeration 00064 */ 00065 typedef enum 00066 { 00067 GPIO_Mode_IN = 0x00, /*!< GPIO Input Mode */ 00068 GPIO_Mode_OUT = 0x01, /*!< GPIO Output Mode */ 00069 GPIO_Mode_AF = 0x02, /*!< GPIO Alternate function Mode */ 00070 GPIO_Mode_AN = 0x03 /*!< GPIO Analog Mode */ 00071 }GPIOMode_TypeDef_mort; 00072 #define IS_GPIO_MODE_MORT(MODE) (((MODE) == GPIO_Mode_IN) || ((MODE) == GPIO_Mode_OUT) || \ 00073 ((MODE) == GPIO_Mode_AF)|| ((MODE) == GPIO_Mode_AN)) 00074 00075 /** 00076 * @brief GPIO Output type enumeration 00077 */ 00078 typedef enum 00079 { 00080 GPIO_OType_PP = 0x00, 00081 GPIO_OType_OD = 0x01 00082 }GPIOOType_TypeDef_mort; 00083 #define IS_GPIO_OTYPE(OTYPE) (((OTYPE) == GPIO_OType_PP) || ((OTYPE) == GPIO_OType_OD)) 00084 00085 00086 /** 00087 * @brief GPIO Output Maximum frequency enumeration 00088 */ 00089 typedef enum 00090 { 00091 GPIO_Low_Speed = 0x00, /*!< Low speed */ 00092 GPIO_Medium_Speed = 0x01, /*!< Medium speed */ 00093 GPIO_Fast_Speed = 0x02, /*!< Fast speed */ 00094 GPIO_High_Speed = 0x03 /*!< High speed */ 00095 }GPIOSpeed_TypeDef_mort; 00096 00097 /* Add legacy definition */ 00098 #define GPIO_Speed_2MHz GPIO_Low_Speed 00099 #define GPIO_Speed_25MHz GPIO_Medium_Speed 00100 #define GPIO_Speed_50MHz GPIO_Fast_Speed 00101 #define GPIO_Speed_100MHz GPIO_High_Speed 00102 00103 #define IS_GPIO_SPEED_MORT(SPEED) (((SPEED) == GPIO_Low_Speed) || ((SPEED) == GPIO_Medium_Speed) || \ 00104 ((SPEED) == GPIO_Fast_Speed)|| ((SPEED) == GPIO_High_Speed)) 00105 00106 /** 00107 * @brief GPIO Configuration PullUp PullDown enumeration 00108 */ 00109 typedef enum 00110 { 00111 GPIO_PuPd_NOPULL = 0x00, 00112 GPIO_PuPd_UP = 0x01, 00113 GPIO_PuPd_DOWN = 0x02 00114 }GPIOPuPd_TypeDef_mort; 00115 #define IS_GPIO_PUPD(PUPD) (((PUPD) == GPIO_PuPd_NOPULL) || ((PUPD) == GPIO_PuPd_UP) || \ 00116 ((PUPD) == GPIO_PuPd_DOWN)) 00117 00118 /** 00119 * @brief GPIO Bit SET and Bit RESET enumeration 00120 */ 00121 typedef enum 00122 { 00123 Bit_RESET = 0, 00124 Bit_SET 00125 }BitAction; 00126 #define IS_GPIO_BIT_ACTION(ACTION) (((ACTION) == Bit_RESET) || ((ACTION) == Bit_SET)) 00127 00128 00129 /** 00130 * @brief GPIO Init structure definition 00131 */ 00132 typedef struct 00133 { 00134 uint32_t GPIO_Pin; /*!< Specifies the GPIO pins to be configured. 00135 This parameter can be any value of @ref GPIO_pins_define */ 00136 00137 GPIOMode_TypeDef_mort GPIO_Mode; /*!< Specifies the operating mode for the selected pins. 00138 This parameter can be a value of @ref GPIOMode_TypeDef */ 00139 00140 GPIOSpeed_TypeDef_mort GPIO_Speed; /*!< Specifies the speed for the selected pins. 00141 This parameter can be a value of @ref GPIOSpeed_TypeDef */ 00142 00143 GPIOOType_TypeDef_mort GPIO_OType; /*!< Specifies the operating output type for the selected pins. 00144 This parameter can be a value of @ref GPIOOType_TypeDef */ 00145 00146 GPIOPuPd_TypeDef_mort GPIO_PuPd; /*!< Specifies the operating Pull-up/Pull down for the selected pins. 00147 This parameter can be a value of @ref GPIOPuPd_TypeDef */ 00148 }GPIO_InitTypeDef_mort; 00149 00150 /* Exported constants --------------------------------------------------------*/ 00151 00152 /** @defgroup GPIO_Exported_Constants 00153 * @{ 00154 */ 00155 00156 /** @defgroup GPIO_pins_define 00157 * @{ 00158 */ 00159 #define GPIO_Pin_0 ((uint16_t)0x0001) /* Pin 0 selected */ 00160 #define GPIO_Pin_1 ((uint16_t)0x0002) /* Pin 1 selected */ 00161 #define GPIO_Pin_2 ((uint16_t)0x0004) /* Pin 2 selected */ 00162 #define GPIO_Pin_3 ((uint16_t)0x0008) /* Pin 3 selected */ 00163 #define GPIO_Pin_4 ((uint16_t)0x0010) /* Pin 4 selected */ 00164 #define GPIO_Pin_5 ((uint16_t)0x0020) /* Pin 5 selected */ 00165 #define GPIO_Pin_6 ((uint16_t)0x0040) /* Pin 6 selected */ 00166 #define GPIO_Pin_7 ((uint16_t)0x0080) /* Pin 7 selected */ 00167 #define GPIO_Pin_8 ((uint16_t)0x0100) /* Pin 8 selected */ 00168 #define GPIO_Pin_9 ((uint16_t)0x0200) /* Pin 9 selected */ 00169 #define GPIO_Pin_10 ((uint16_t)0x0400) /* Pin 10 selected */ 00170 #define GPIO_Pin_11 ((uint16_t)0x0800) /* Pin 11 selected */ 00171 #define GPIO_Pin_12 ((uint16_t)0x1000) /* Pin 12 selected */ 00172 #define GPIO_Pin_13 ((uint16_t)0x2000) /* Pin 13 selected */ 00173 #define GPIO_Pin_14 ((uint16_t)0x4000) /* Pin 14 selected */ 00174 #define GPIO_Pin_15 ((uint16_t)0x8000) /* Pin 15 selected */ 00175 #define GPIO_Pin_All ((uint16_t)0xFFFF) /* All pins selected */ 00176 00177 #define GPIO_PIN_MASK_MORT ((uint32_t)0x0000FFFF) /* PIN mask for assert test */ 00178 #define IS_GPIO_PIN_MORT(PIN) (((PIN) & GPIO_PIN_MASK_MORT ) != (uint32_t)0x00) 00179 #define IS_GET_GPIO_PIN(PIN) (((PIN) == GPIO_Pin_0) || \ 00180 ((PIN) == GPIO_Pin_1) || \ 00181 ((PIN) == GPIO_Pin_2) || \ 00182 ((PIN) == GPIO_Pin_3) || \ 00183 ((PIN) == GPIO_Pin_4) || \ 00184 ((PIN) == GPIO_Pin_5) || \ 00185 ((PIN) == GPIO_Pin_6) || \ 00186 ((PIN) == GPIO_Pin_7) || \ 00187 ((PIN) == GPIO_Pin_8) || \ 00188 ((PIN) == GPIO_Pin_9) || \ 00189 ((PIN) == GPIO_Pin_10) || \ 00190 ((PIN) == GPIO_Pin_11) || \ 00191 ((PIN) == GPIO_Pin_12) || \ 00192 ((PIN) == GPIO_Pin_13) || \ 00193 ((PIN) == GPIO_Pin_14) || \ 00194 ((PIN) == GPIO_Pin_15)) 00195 /** 00196 * @} 00197 */ 00198 00199 00200 /** @defgroup GPIO_Pin_sources 00201 * @{ 00202 */ 00203 #define GPIO_PinSource0 ((uint8_t)0x00) 00204 #define GPIO_PinSource1 ((uint8_t)0x01) 00205 #define GPIO_PinSource2 ((uint8_t)0x02) 00206 #define GPIO_PinSource3 ((uint8_t)0x03) 00207 #define GPIO_PinSource4 ((uint8_t)0x04) 00208 #define GPIO_PinSource5 ((uint8_t)0x05) 00209 #define GPIO_PinSource6 ((uint8_t)0x06) 00210 #define GPIO_PinSource7 ((uint8_t)0x07) 00211 #define GPIO_PinSource8 ((uint8_t)0x08) 00212 #define GPIO_PinSource9 ((uint8_t)0x09) 00213 #define GPIO_PinSource10 ((uint8_t)0x0A) 00214 #define GPIO_PinSource11 ((uint8_t)0x0B) 00215 #define GPIO_PinSource12 ((uint8_t)0x0C) 00216 #define GPIO_PinSource13 ((uint8_t)0x0D) 00217 #define GPIO_PinSource14 ((uint8_t)0x0E) 00218 #define GPIO_PinSource15 ((uint8_t)0x0F) 00219 00220 #define IS_GPIO_PIN_MORT_SOURCE(PINSOURCE) (((PINSOURCE) == GPIO_PinSource0) || \ 00221 ((PINSOURCE) == GPIO_PinSource1) || \ 00222 ((PINSOURCE) == GPIO_PinSource2) || \ 00223 ((PINSOURCE) == GPIO_PinSource3) || \ 00224 ((PINSOURCE) == GPIO_PinSource4) || \ 00225 ((PINSOURCE) == GPIO_PinSource5) || \ 00226 ((PINSOURCE) == GPIO_PinSource6) || \ 00227 ((PINSOURCE) == GPIO_PinSource7) || \ 00228 ((PINSOURCE) == GPIO_PinSource8) || \ 00229 ((PINSOURCE) == GPIO_PinSource9) || \ 00230 ((PINSOURCE) == GPIO_PinSource10) || \ 00231 ((PINSOURCE) == GPIO_PinSource11) || \ 00232 ((PINSOURCE) == GPIO_PinSource12) || \ 00233 ((PINSOURCE) == GPIO_PinSource13) || \ 00234 ((PINSOURCE) == GPIO_PinSource14) || \ 00235 ((PINSOURCE) == GPIO_PinSource15)) 00236 /** 00237 * @} 00238 */ 00239 00240 /** @defgroup GPIO_Alternat_function_selection_define 00241 * @{ 00242 */ 00243 /** 00244 * @brief AF 0 selection 00245 */ 00246 #define GPIO_AF_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */ 00247 #define GPIO_AF_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */ 00248 #define GPIO_AF_TAMPER ((uint8_t)0x00) /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */ 00249 #define GPIO_AF_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ 00250 #define GPIO_AF_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ 00251 #if defined(STM32F446xx) 00252 #define GPIO_AF0_TIM2 ((uint8_t)0x00) /* TIM2 Alternate Function mapping */ 00253 #endif /* STM32F446xx */ 00254 00255 /** 00256 * @brief AF 1 selection 00257 */ 00258 #define GPIO_AF_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */ 00259 #define GPIO_AF_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ 00260 #if defined(STM32F410xx) || defined(STM32F413_423xx) 00261 #define GPIO_AF_LPTIM ((uint8_t)0x01) /* LPTIM Alternate Function mapping */ 00262 #endif /* STM32F410xx || STM32F413_423xx */ 00263 /** 00264 * @brief AF 2 selection 00265 */ 00266 #define GPIO_AF_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */ 00267 #define GPIO_AF_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */ 00268 #define GPIO_AF_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */ 00269 00270 /** 00271 * @brief AF 3 selection 00272 */ 00273 #define GPIO_AF_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */ 00274 #define GPIO_AF_TIM9 ((uint8_t)0x03) /* TIM9 Alternate Function mapping */ 00275 #define GPIO_AF_TIM10 ((uint8_t)0x03) /* TIM10 Alternate Function mapping */ 00276 #define GPIO_AF_TIM11 ((uint8_t)0x03) /* TIM11 Alternate Function mapping */ 00277 #if defined(STM32F446xx) 00278 #define GPIO_AF3_CEC ((uint8_t)0x03) /* CEC Alternate Function mapping */ 00279 #endif /* STM32F446xx */ 00280 #if defined(STM32F413_423xx) 00281 #define GPIO_AF3_DFSDM2 ((uint8_t)0x03) /* DFSDM2 Alternate Function mapping */ 00282 #endif /* STM32F413_423xx */ 00283 /** 00284 * @brief AF 4 selection 00285 */ 00286 #define GPIO_AF_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ 00287 #define GPIO_AF_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ 00288 #define GPIO_AF_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */ 00289 #if defined(STM32F446xx) 00290 #define GPIO_AF4_CEC ((uint8_t)0x04) /* CEC Alternate Function mapping */ 00291 #endif /* STM32F446xx */ 00292 #if defined(STM32F410xx) || defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx) 00293 #define GPIO_AF_FMPI2C ((uint8_t)0x04) /* FMPI2C Alternate Function mapping */ 00294 #endif /* STM32F410xx || STM32F446xx */ 00295 00296 /** 00297 * @brief AF 5 selection 00298 */ 00299 #define GPIO_AF_SPI1 ((uint8_t)0x05) /* SPI1/I2S1 Alternate Function mapping */ 00300 #define GPIO_AF_SPI2 ((uint8_t)0x05) /* SPI2/I2S2 Alternate Function mapping */ 00301 #define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI3/I2S3 Alternate Function mapping (Only for STM32F411xE and STM32F413_423xx Devices) */ 00302 #define GPIO_AF_SPI4 ((uint8_t)0x05) /* SPI4/I2S4 Alternate Function mapping */ 00303 #define GPIO_AF_SPI5 ((uint8_t)0x05) /* SPI5 Alternate Function mapping */ 00304 #define GPIO_AF_SPI6 ((uint8_t)0x05) /* SPI6 Alternate Function mapping */ 00305 00306 /** 00307 * @brief AF 6 selection 00308 */ 00309 #define GPIO_AF_SPI3 ((uint8_t)0x06) /* SPI3/I2S3 Alternate Function mapping */ 00310 #define GPIO_AF6_SPI1 ((uint8_t)0x06) /* SPI1 Alternate Function mapping (Only for STM32F410xx Devices) */ 00311 #define GPIO_AF6_SPI2 ((uint8_t)0x06) /* SPI2 Alternate Function mapping (Only for STM32F410xx/STM32F411xE Devices) */ 00312 #define GPIO_AF6_SPI4 ((uint8_t)0x06) /* SPI4 Alternate Function mapping (Only for STM32F411xE Devices) */ 00313 #define GPIO_AF6_SPI5 ((uint8_t)0x06) /* SPI5 Alternate Function mapping (Only for STM32F410xx/STM32F411xE Devices) */ 00314 #define GPIO_AF_SAI1 ((uint8_t)0x06) /* SAI1 Alternate Function mapping */ 00315 #define GPIO_AF_I2S2ext ((uint8_t)0x06) /* I2S2ext_SD Alternate Function mapping (only for STM32F412xG and STM32F413_423xx Devices) */ 00316 #if defined(STM32F412xG) || defined(STM32F413_423xx) 00317 #define GPIO_AF6_DFSDM1 ((uint8_t)0x06) /* DFSDM1 Alternate Function mapping */ 00318 #endif /* STM32F412xG || STM32F413_423xx */ 00319 #if defined(STM32F413_423xx) 00320 #define GPIO_AF6_DFSDM2 ((uint8_t)0x06) /* DFSDM2 Alternate Function mapping */ 00321 #endif /* STM32F413_423xx */ 00322 00323 /** 00324 * @brief AF 7 selection 00325 */ 00326 #define GPIO_AF_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ 00327 #define GPIO_AF_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ 00328 #define GPIO_AF_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ 00329 #define GPIO_AF7_SPI3 ((uint8_t)0x07) /* SPI3/I2S3ext Alternate Function mapping */ 00330 #if defined(STM32F413_423xx) 00331 #define GPIO_AF7_DFSDM2 ((uint8_t)0x07) /* DFSDM2 Alternate Function mapping */ 00332 #define GPIO_AF7_SAI1 ((uint8_t)0x07) /* SAI1 Alternate Function mapping */ 00333 #endif /* STM32F413_423xx */ 00334 00335 /** 00336 * @brief AF 7 selection Legacy 00337 */ 00338 #define GPIO_AF_I2S3ext GPIO_AF7_SPI3 00339 00340 /** 00341 * @brief AF 8 selection 00342 */ 00343 #define GPIO_AF_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */ 00344 #define GPIO_AF_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */ 00345 #define GPIO_AF_USART6 ((uint8_t)0x08) /* USART6 Alternate Function mapping */ 00346 #define GPIO_AF_UART7 ((uint8_t)0x08) /* UART7 Alternate Function mapping */ 00347 #define GPIO_AF_UART8 ((uint8_t)0x08) /* UART8 Alternate Function mapping */ 00348 #if defined(STM32F412xG) || defined(STM32F413_423xx) 00349 #define GPIO_AF8_USART3 ((uint8_t)0x08) /* USART3 Alternate Function mapping */ 00350 #define GPIO_AF8_DFSDM1 ((uint8_t)0x08) /* DFSDM Alternate Function mapping */ 00351 #define GPIO_AF8_CAN1 ((uint8_t)0x08) /* CAN1 Alternate Function mapping */ 00352 #endif /* STM32F412xG || STM32F413_423xx */ 00353 #if defined(STM32F446xx) 00354 #define GPIO_AF8_SAI2 ((uint8_t)0x08) /* SAI2 Alternate Function mapping */ 00355 #define GPIO_AF_SPDIF ((uint8_t)0x08) /* SPDIF Alternate Function mapping */ 00356 #endif /* STM32F446xx */ 00357 00358 /** 00359 * @brief AF 9 selection 00360 */ 00361 #define GPIO_AF_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */ 00362 #define GPIO_AF_CAN2 ((uint8_t)0x09) /* CAN2 Alternate Function mapping */ 00363 #define GPIO_AF_TIM12 ((uint8_t)0x09) /* TIM12 Alternate Function mapping */ 00364 #define GPIO_AF_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */ 00365 #define GPIO_AF_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */ 00366 #define GPIO_AF9_I2C2 ((uint8_t)0x09) /* I2C2 Alternate Function mapping (Only for STM32F401xx/STM32F410xx/STM32F411xE/STM32F412xG/STM32F413_423xx Devices) */ 00367 #define GPIO_AF9_I2C3 ((uint8_t)0x09) /* I2C3 Alternate Function mapping (Only for STM32F401xx/STM32F411xE/STM32F412xG and STM32F413_423xx Devices) */ 00368 #if defined(STM32F446xx) 00369 #define GPIO_AF9_SAI2 ((uint8_t)0x09) /* SAI2 Alternate Function mapping */ 00370 #endif /* STM32F446xx */ 00371 #define GPIO_AF9_LTDC ((uint8_t)0x09) /* LTDC Alternate Function mapping */ 00372 #if defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx) || defined(STM32F469_479xx) 00373 #define GPIO_AF9_QUADSPI ((uint8_t)0x09) /* QuadSPI Alternate Function mapping */ 00374 #endif /* STM32F412xG || STM32F413_423xx || STM32F446xx || STM32F469_479xx */ 00375 #if defined(STM32F410xx) || defined(STM32F412xG) || defined(STM32F413_423xx) 00376 #define GPIO_AF9_FMPI2C ((uint8_t)0x09) /* FMPI2C Alternate Function mapping (Only for STM32F410xx Devices) */ 00377 #endif /* STM32F410xx || STM32F412xG || STM32F413_423xx */ 00378 00379 /** 00380 * @brief AF 10 selection 00381 */ 00382 #define GPIO_AF_OTG_FS ((uint8_t)0xA) /* OTG_FS Alternate Function mapping */ 00383 #define GPIO_AF_OTG_HS ((uint8_t)0xA) /* OTG_HS Alternate Function mapping */ 00384 #if defined(STM32F446xx) 00385 #define GPIO_AF10_SAI2 ((uint8_t)0x0A) /* SAI2 Alternate Function mapping */ 00386 #endif /* STM32F446xx */ 00387 #if defined(STM32F412xG) || defined(STM32F413_423xx) || defined(STM32F446xx) || defined(STM32F469_479xx) 00388 #define GPIO_AF10_QUADSPI ((uint8_t)0x0A) /* QuadSPI Alternate Function mapping */ 00389 #endif /* STM32F412xG || STM32F413_423xx || STM32F446xx || STM32F469_479xx */ 00390 #if defined(STM32F412xG) || defined(STM32F413_423xx) 00391 #define GPIO_AF10_FMC ((uint8_t)0xA) /* FMC Alternate Function mapping */ 00392 #define GPIO_AF10_DFSDM1 ((uint8_t)0xA) /* DFSDM Alternate Function mapping */ 00393 #endif /* STM32F412xG || STM32F413_423xx */ 00394 #if defined(STM32F413_423xx) 00395 #define GPIO_AF10_DFSDM2 ((uint8_t)0x0A) /* DFSDM2 Alternate Function mapping */ 00396 #define GPIO_AF10_SAI1 ((uint8_t)0x0A) /* SAI1 Alternate Function mapping */ 00397 #endif /* STM32F413_423xx */ 00398 /** 00399 * @brief AF 11 selection 00400 */ 00401 #define GPIO_AF_ETH ((uint8_t)0x0B) /* ETHERNET Alternate Function mapping */ 00402 #if defined(STM32F413_423xx) 00403 #define GPIO_AF11_UART4 ((uint8_t)0x0B) /* UART4 Alternate Function mapping */ 00404 #define GPIO_AF11_UART5 ((uint8_t)0x0B) /* UART5 Alternate Function mapping */ 00405 #define GPIO_AF11_UART9 ((uint8_t)0x0B) /* UART9 Alternate Function mapping */ 00406 #define GPIO_AF11_UART10 ((uint8_t)0x0B) /* UART10 Alternate Function mapping */ 00407 #define GPIO_AF11_CAN3 ((uint8_t)0x0B) /* CAN3 Alternate Function mapping */ 00408 #endif /* STM32F413_423xx */ 00409 00410 /** 00411 * @brief AF 12 selection 00412 */ 00413 #if defined(STM32F40_41xxx) || defined(STM32F412xG) || defined(STM32F413_423xx) 00414 #define GPIO_AF_FSMC ((uint8_t)0xC) /* FSMC Alternate Function mapping */ 00415 #endif /* STM32F40_41xxx || STM32F412xG || STM32F413_423xx */ 00416 00417 #if defined(STM32F427_437xx) || defined(STM32F429_439xx) || defined(STM32F446xx) || defined(STM32F469_479xx) 00418 #define GPIO_AF_FMC ((uint8_t)0xC) /* FMC Alternate Function mapping */ 00419 #endif /* STM32F427_437xx || STM32F429_439xx || STM32F446xx || STM32F469_479xx */ 00420 00421 #define GPIO_AF_OTG_HS_FS ((uint8_t)0xC) /* OTG HS configured in FS, Alternate Function mapping */ 00422 #define GPIO_AF_SDIO ((uint8_t)0xC) /* SDIO Alternate Function mapping */ 00423 00424 /** 00425 * @brief AF 13 selection 00426 */ 00427 #define GPIO_AF_DCMI ((uint8_t)0x0D) /* DCMI Alternate Function mapping */ 00428 #if defined(STM32F469_479xx) 00429 #define GPIO_AF_DSI ((uint8_t)0x0D) /* DSI Alternate Function mapping */ 00430 #endif /* STM32F469_479xx */ 00431 /** 00432 * @brief AF 14 selection 00433 */ 00434 #define GPIO_AF_LTDC ((uint8_t)0x0E) /* LCD-TFT Alternate Function mapping */ 00435 #if defined(STM32F413_423xx) 00436 #define GPIO_AF14_RNG ((uint8_t)0x0E) /* RNG Alternate Function mapping */ 00437 #endif /* STM32F413_423xx */ 00438 00439 /** 00440 * @brief AF 15 selection 00441 */ 00442 #define GPIO_AF_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ 00443 00444 #if defined(STM32F40_41xxx) 00445 #define IS_GPIO_AF_MORT(AF) (((AF) == GPIO_AF_RTC_50Hz) || ((AF) == GPIO_AF_TIM14) || \ 00446 ((AF) == GPIO_AF_MCO) || ((AF) == GPIO_AF_TAMPER) || \ 00447 ((AF) == GPIO_AF_SWJ) || ((AF) == GPIO_AF_TRACE) || \ 00448 ((AF) == GPIO_AF_TIM1) || ((AF) == GPIO_AF_TIM2) || \ 00449 ((AF) == GPIO_AF_TIM3) || ((AF) == GPIO_AF_TIM4) || \ 00450 ((AF) == GPIO_AF_TIM5) || ((AF) == GPIO_AF_TIM8) || \ 00451 ((AF) == GPIO_AF_I2C1) || ((AF) == GPIO_AF_I2C2) || \ 00452 ((AF) == GPIO_AF_I2C3) || ((AF) == GPIO_AF_SPI1) || \ 00453 ((AF) == GPIO_AF_SPI2) || ((AF) == GPIO_AF_TIM13) || \ 00454 ((AF) == GPIO_AF_SPI3) || ((AF) == GPIO_AF_TIM14) || \ 00455 ((AF) == GPIO_AF_USART1) || ((AF) == GPIO_AF_USART2) || \ 00456 ((AF) == GPIO_AF_USART3) || ((AF) == GPIO_AF_UART4) || \ 00457 ((AF) == GPIO_AF_UART5) || ((AF) == GPIO_AF_USART6) || \ 00458 ((AF) == GPIO_AF_CAN1) || ((AF) == GPIO_AF_CAN2) || \ 00459 ((AF) == GPIO_AF_OTG_FS) || ((AF) == GPIO_AF_OTG_HS) || \ 00460 ((AF) == GPIO_AF_ETH) || ((AF) == GPIO_AF_OTG_HS_FS) || \ 00461 ((AF) == GPIO_AF_SDIO) || ((AF) == GPIO_AF_DCMI) || \ 00462 ((AF) == GPIO_AF_EVENTOUT) || ((AF) == GPIO_AF_FSMC)) 00463 #endif /* STM32F40_41xxx */ 00464 00465 #if defined(STM32F401xx) 00466 #define IS_GPIO_AF_MORT(AF) (((AF) == GPIO_AF_RTC_50Hz) || ((AF) == GPIO_AF_TIM14) || \ 00467 ((AF) == GPIO_AF_MCO) || ((AF) == GPIO_AF_TAMPER) || \ 00468 ((AF) == GPIO_AF_SWJ) || ((AF) == GPIO_AF_TRACE) || \ 00469 ((AF) == GPIO_AF_TIM1) || ((AF) == GPIO_AF_TIM2) || \ 00470 ((AF) == GPIO_AF_TIM3) || ((AF) == GPIO_AF_TIM4) || \ 00471 ((AF) == GPIO_AF_TIM5) || ((AF) == GPIO_AF_TIM8) || \ 00472 ((AF) == GPIO_AF_I2C1) || ((AF) == GPIO_AF_I2C2) || \ 00473 ((AF) == GPIO_AF_I2C3) || ((AF) == GPIO_AF_SPI1) || \ 00474 ((AF) == GPIO_AF_SPI2) || ((AF) == GPIO_AF_TIM13) || \ 00475 ((AF) == GPIO_AF_SPI3) || ((AF) == GPIO_AF_TIM14) || \ 00476 ((AF) == GPIO_AF_USART1) || ((AF) == GPIO_AF_USART2) || \ 00477 ((AF) == GPIO_AF_SDIO) || ((AF) == GPIO_AF_USART6) || \ 00478 ((AF) == GPIO_AF_OTG_FS) || ((AF) == GPIO_AF_OTG_HS) || \ 00479 ((AF) == GPIO_AF_EVENTOUT) || ((AF) == GPIO_AF_SPI4)) 00480 #endif /* STM32F401xx */ 00481 00482 #if defined(STM32F411xE) 00483 #define IS_GPIO_AF_MORT(AF) (((AF) < 16) && ((AF) != 11) && ((AF) != 13) && ((AF) != 14)) 00484 #endif /* STM32F411xE */ 00485 00486 #if defined(STM32F410xx) 00487 #define IS_GPIO_AF_MORT(AF) (((AF) < 10) || ((AF) == 15)) 00488 #endif /* STM32F410xx */ 00489 00490 #if defined(STM32F427_437xx) || defined(STM32F429_439xx) 00491 #define IS_GPIO_AF_MORT(AF) (((AF) == GPIO_AF_RTC_50Hz) || ((AF) == GPIO_AF_TIM14) || \ 00492 ((AF) == GPIO_AF_MCO) || ((AF) == GPIO_AF_TAMPER) || \ 00493 ((AF) == GPIO_AF_SWJ) || ((AF) == GPIO_AF_TRACE) || \ 00494 ((AF) == GPIO_AF_TIM1) || ((AF) == GPIO_AF_TIM2) || \ 00495 ((AF) == GPIO_AF_TIM3) || ((AF) == GPIO_AF_TIM4) || \ 00496 ((AF) == GPIO_AF_TIM5) || ((AF) == GPIO_AF_TIM8) || \ 00497 ((AF) == GPIO_AF_I2C1) || ((AF) == GPIO_AF_I2C2) || \ 00498 ((AF) == GPIO_AF_I2C3) || ((AF) == GPIO_AF_SPI1) || \ 00499 ((AF) == GPIO_AF_SPI2) || ((AF) == GPIO_AF_TIM13) || \ 00500 ((AF) == GPIO_AF_SPI3) || ((AF) == GPIO_AF_TIM14) || \ 00501 ((AF) == GPIO_AF_USART1) || ((AF) == GPIO_AF_USART2) || \ 00502 ((AF) == GPIO_AF_USART3) || ((AF) == GPIO_AF_UART4) || \ 00503 ((AF) == GPIO_AF_UART5) || ((AF) == GPIO_AF_USART6) || \ 00504 ((AF) == GPIO_AF_CAN1) || ((AF) == GPIO_AF_CAN2) || \ 00505 ((AF) == GPIO_AF_OTG_FS) || ((AF) == GPIO_AF_OTG_HS) || \ 00506 ((AF) == GPIO_AF_ETH) || ((AF) == GPIO_AF_OTG_HS_FS) || \ 00507 ((AF) == GPIO_AF_SDIO) || ((AF) == GPIO_AF_DCMI) || \ 00508 ((AF) == GPIO_AF_EVENTOUT) || ((AF) == GPIO_AF_SPI4) || \ 00509 ((AF) == GPIO_AF_SPI5) || ((AF) == GPIO_AF_SPI6) || \ 00510 ((AF) == GPIO_AF_UART7) || ((AF) == GPIO_AF_UART8) || \ 00511 ((AF) == GPIO_AF_FMC) || ((AF) == GPIO_AF_SAI1) || \ 00512 ((AF) == GPIO_AF_LTDC)) 00513 #endif /* STM32F427_437xx || STM32F429_439xx */ 00514 00515 #if defined(STM32F412xG) 00516 #define IS_GPIO_AF_MORT(AF) (((AF) < 16) && ((AF) != 11) && ((AF) != 14)) 00517 #endif /* STM32F412xG */ 00518 00519 #if defined(STM32F413_423xx) 00520 #define IS_GPIO_AF_MORT(AF) (((AF) < 16) && ((AF) != 13)) 00521 #endif /* STM32F413_423xx */ 00522 00523 #if defined(STM32F446xx) 00524 #define IS_GPIO_AF_MORT(AF) (((AF) < 16) && ((AF) != 11) && ((AF) != 14)) 00525 #endif /* STM32F446xx */ 00526 00527 #if defined(STM32F469_479xx) 00528 #define IS_GPIO_AF_MORT(AF) ((AF) < 16) 00529 #endif /* STM32F469_479xx */ 00530 00531 /** 00532 * @} 00533 */ 00534 00535 /** @defgroup GPIO_Legacy 00536 * @{ 00537 */ 00538 00539 #define GPIO_Mode_AIN GPIO_Mode_AN 00540 00541 #define GPIO_AF_OTG1_FS GPIO_AF_OTG_FS 00542 #define GPIO_AF_OTG2_HS GPIO_AF_OTG_HS 00543 #define GPIO_AF_OTG2_FS GPIO_AF_OTG_HS_FS 00544 00545 /** 00546 * @} 00547 */ 00548 00549 /** 00550 * @} 00551 */ 00552 00553 /* Exported macro ------------------------------------------------------------*/ 00554 /* Exported functions --------------------------------------------------------*/ 00555 00556 /* Function used to set the GPIO configuration to the default reset state ****/ 00557 void GPIO_DeInit_mort(GPIO_TypeDef_mort* GPIOx); 00558 00559 /* Initialization and Configuration functions *********************************/ 00560 void GPIO_Init_mort(GPIO_TypeDef_mort* GPIOx, GPIO_InitTypeDef_mort* GPIO_InitStruct); 00561 void GPIO_StructInit_mort(GPIO_InitTypeDef_mort* GPIO_InitStruct); 00562 void GPIO_PinLockConfig_mort(GPIO_TypeDef_mort* GPIOx, uint16_t GPIO_Pin); 00563 00564 /* GPIO Read and Write functions **********************************************/ 00565 uint8_t GPIO_ReadInputDataBit_mort(GPIO_TypeDef_mort* GPIOx, uint16_t GPIO_Pin); 00566 uint16_t GPIO_ReadInputData_mort(GPIO_TypeDef_mort* GPIOx); 00567 uint8_t GPIO_ReadOutputDataBit_mort(GPIO_TypeDef_mort* GPIOx, uint16_t GPIO_Pin); 00568 uint16_t GPIO_ReadOutputData_mort(GPIO_TypeDef_mort* GPIOx); 00569 void GPIO_SetBits_mort(GPIO_TypeDef_mort* GPIOx, uint16_t GPIO_Pin); 00570 void GPIO_ResetBits_mort(GPIO_TypeDef_mort* GPIOx, uint16_t GPIO_Pin); 00571 void GPIO_WriteBit_mort(GPIO_TypeDef_mort* GPIOx, uint16_t GPIO_Pin, BitAction BitVal); 00572 void GPIO_Write_mort(GPIO_TypeDef_mort* GPIOx, uint16_t PortVal); 00573 void GPIO_ToggleBits_mort(GPIO_TypeDef_mort* GPIOx, uint16_t GPIO_Pin); 00574 00575 /* GPIO Alternate functions configuration function ****************************/ 00576 void GPIO_PinAFConfig_mort(GPIO_TypeDef_mort* GPIOx, uint16_t GPIO_PinSource, uint8_t GPIO_AF); 00577 00578 #ifdef __cplusplus 00579 } 00580 #endif 00581 00582 #endif /*__STM32F4xx_GPIO_H */ 00583 00584 /** 00585 * @} 00586 */ 00587 00588 /** 00589 * @} 00590 */ 00591 00592 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 00593 00594 00595 00596 00597
Generated on Sat Oct 21 2023 04:38:55 by
1.7.2