STM32L443xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32l4xx_hal_gpio_ex.h 00004 * @author MCD Application Team 00005 * @brief Header file of GPIO HAL Extended module. 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * Copyright (c) 2017 STMicroelectronics. 00010 * All rights reserved. 00011 * 00012 * This software is licensed under terms that can be found in the LICENSE file 00013 * in the root directory of this software component. 00014 * If no LICENSE file comes with this software, it is provided AS-IS. 00015 * 00016 ****************************************************************************** 00017 */ 00018 00019 /* Define to prevent recursive inclusion -------------------------------------*/ 00020 #ifndef STM32L4xx_HAL_GPIO_EX_H 00021 #define STM32L4xx_HAL_GPIO_EX_H 00022 00023 #ifdef __cplusplus 00024 extern "C" { 00025 #endif 00026 00027 /* Includes ------------------------------------------------------------------*/ 00028 #include "stm32l4xx_hal_def.h" 00029 00030 /** @addtogroup STM32L4xx_HAL_Driver 00031 * @{ 00032 */ 00033 00034 /** @defgroup GPIOEx GPIOEx 00035 * @brief GPIO Extended HAL module driver 00036 * @{ 00037 */ 00038 00039 /* Exported types ------------------------------------------------------------*/ 00040 /* Exported constants --------------------------------------------------------*/ 00041 /** @defgroup GPIOEx_Exported_Constants GPIOEx Exported Constants 00042 * @{ 00043 */ 00044 00045 /** @defgroup GPIOEx_Alternate_function_selection GPIOEx Alternate function selection 00046 * @{ 00047 */ 00048 00049 #if defined(STM32L412xx) || defined(STM32L422xx) 00050 /*--------------STM32L412xx/STM32L422xx---*/ 00051 /** 00052 * @brief AF 0 selection 00053 */ 00054 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */ 00055 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */ 00056 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ 00057 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ 00058 00059 /** 00060 * @brief AF 1 selection 00061 */ 00062 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */ 00063 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ 00064 #define GPIO_AF1_LPTIM1 ((uint8_t)0x01) /* LPTIM1 Alternate Function mapping */ 00065 #define GPIO_AF1_IR ((uint8_t)0x01) /* IR Alternate Function mapping */ 00066 00067 /** 00068 * @brief AF 2 selection 00069 */ 00070 #define GPIO_AF2_TIM1 ((uint8_t)0x02) /* TIM1 Alternate Function mapping */ 00071 #define GPIO_AF2_TIM2 ((uint8_t)0x02) /* TIM2 Alternate Function mapping */ 00072 00073 /** 00074 * @brief AF 3 selection 00075 */ 00076 #define GPIO_AF3_USART2 ((uint8_t)0x03) /* USART1 Alternate Function mapping */ 00077 #define GPIO_AF3_TIM1_COMP1 ((uint8_t)0x03) /* TIM1/COMP1 Break in Alternate Function mapping */ 00078 00079 /** 00080 * @brief AF 4 selection 00081 */ 00082 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ 00083 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ 00084 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */ 00085 00086 /** 00087 * @brief AF 5 selection 00088 */ 00089 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */ 00090 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2 Alternate Function mapping */ 00091 00092 /** 00093 * @brief AF 6 selection 00094 */ 00095 #define GPIO_AF6_COMP1 ((uint8_t)0x06) /* COMP1 Alternate Function mapping */ 00096 00097 /** 00098 * @brief AF 7 selection 00099 */ 00100 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ 00101 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ 00102 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ 00103 00104 /** 00105 * @brief AF 8 selection 00106 */ 00107 #define GPIO_AF8_LPUART1 ((uint8_t)0x08) /* LPUART1 Alternate Function mapping */ 00108 00109 /** 00110 * @brief AF 9 selection 00111 */ 00112 #define GPIO_AF9_TSC ((uint8_t)0x09) /* TSC Alternate Function mapping */ 00113 00114 /** 00115 * @brief AF 10 selection 00116 */ 00117 #define GPIO_AF10_USB_FS ((uint8_t)0x0A) /* USB_FS Alternate Function mapping */ 00118 #define GPIO_AF10_QUADSPI ((uint8_t)0x0A) /* QUADSPI Alternate Function mapping */ 00119 00120 /** 00121 * @brief AF 12 selection 00122 */ 00123 #define GPIO_AF12_COMP1 ((uint8_t)0x0C) /* COMP1 Alternate Function mapping */ 00124 00125 00126 /** 00127 * @brief AF 14 selection 00128 */ 00129 #define GPIO_AF14_TIM2 ((uint8_t)0x0E) /* TIM2 Alternate Function mapping */ 00130 #define GPIO_AF14_TIM15 ((uint8_t)0x0E) /* TIM15 Alternate Function mapping */ 00131 #define GPIO_AF14_TIM16 ((uint8_t)0x0E) /* TIM16 Alternate Function mapping */ 00132 #define GPIO_AF14_LPTIM2 ((uint8_t)0x0E) /* LPTIM2 Alternate Function mapping */ 00133 00134 /** 00135 * @brief AF 15 selection 00136 */ 00137 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ 00138 00139 #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x0F) 00140 00141 #endif /* STM32L412xx || STM32L422xx */ 00142 00143 #if defined(STM32L431xx) || defined(STM32L432xx) || defined(STM32L433xx) || defined(STM32L442xx) || defined(STM32L443xx) 00144 /*--------------STM32L431xx/STM32L432xx/STM32L433xx/STM32L442xx/STM32L443xx---*/ 00145 /** 00146 * @brief AF 0 selection 00147 */ 00148 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */ 00149 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */ 00150 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ 00151 #if defined(STM32L433xx) || defined(STM32L443xx) 00152 #define GPIO_AF0_LCDBIAS ((uint8_t)0x00) /* LCDBIAS Alternate Function mapping */ 00153 #endif /* STM32L433xx || STM32L443xx */ 00154 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ 00155 00156 /** 00157 * @brief AF 1 selection 00158 */ 00159 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */ 00160 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ 00161 #define GPIO_AF1_LPTIM1 ((uint8_t)0x01) /* LPTIM1 Alternate Function mapping */ 00162 #define GPIO_AF1_IR ((uint8_t)0x01) /* IR Alternate Function mapping */ 00163 00164 /** 00165 * @brief AF 2 selection 00166 */ 00167 #define GPIO_AF2_TIM1 ((uint8_t)0x02) /* TIM1 Alternate Function mapping */ 00168 #define GPIO_AF2_TIM2 ((uint8_t)0x02) /* TIM2 Alternate Function mapping */ 00169 00170 /** 00171 * @brief AF 3 selection 00172 */ 00173 #define GPIO_AF3_USART2 ((uint8_t)0x03) /* USART1 Alternate Function mapping */ 00174 #define GPIO_AF3_TIM1_COMP2 ((uint8_t)0x03) /* TIM1/COMP2 Break in Alternate Function mapping */ 00175 #define GPIO_AF3_TIM1_COMP1 ((uint8_t)0x03) /* TIM1/COMP1 Break in Alternate Function mapping */ 00176 00177 /** 00178 * @brief AF 4 selection 00179 */ 00180 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ 00181 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ 00182 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */ 00183 00184 /** 00185 * @brief AF 5 selection 00186 */ 00187 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */ 00188 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2 Alternate Function mapping */ 00189 00190 /** 00191 * @brief AF 6 selection 00192 */ 00193 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3 Alternate Function mapping */ 00194 #define GPIO_AF6_COMP1 ((uint8_t)0x06) /* COMP1 Alternate Function mapping */ 00195 00196 /** 00197 * @brief AF 7 selection 00198 */ 00199 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ 00200 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ 00201 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ 00202 00203 /** 00204 * @brief AF 8 selection 00205 */ 00206 #define GPIO_AF8_LPUART1 ((uint8_t)0x08) /* LPUART1 Alternate Function mapping */ 00207 00208 /** 00209 * @brief AF 9 selection 00210 */ 00211 #define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */ 00212 #define GPIO_AF9_TSC ((uint8_t)0x09) /* TSC Alternate Function mapping */ 00213 00214 /** 00215 * @brief AF 10 selection 00216 */ 00217 #if defined(STM32L432xx) || defined(STM32L433xx) || defined(STM32L442xx) || defined(STM32L443xx) 00218 #define GPIO_AF10_USB_FS ((uint8_t)0x0A) /* USB_FS Alternate Function mapping */ 00219 #endif /* STM32L432xx || STM32L433xx || STM32L442xx || STM32L443xx */ 00220 #define GPIO_AF10_QUADSPI ((uint8_t)0x0A) /* QUADSPI Alternate Function mapping */ 00221 00222 #if defined(STM32L433xx) || defined(STM32L443xx) 00223 /** 00224 * @brief AF 11 selection 00225 */ 00226 #define GPIO_AF11_LCD ((uint8_t)0x0B) /* LCD Alternate Function mapping */ 00227 #endif /* STM32L433xx || STM32L443xx */ 00228 00229 /** 00230 * @brief AF 12 selection 00231 */ 00232 #define GPIO_AF12_SWPMI1 ((uint8_t)0x0C) /* SWPMI1 Alternate Function mapping */ 00233 #define GPIO_AF12_COMP1 ((uint8_t)0x0C) /* COMP1 Alternate Function mapping */ 00234 #define GPIO_AF12_COMP2 ((uint8_t)0x0C) /* COMP2 Alternate Function mapping */ 00235 #define GPIO_AF12_SDMMC1 ((uint8_t)0x0C) /* SDMMC1 Alternate Function mapping */ 00236 00237 /** 00238 * @brief AF 13 selection 00239 */ 00240 #define GPIO_AF13_SAI1 ((uint8_t)0x0D) /* SAI1 Alternate Function mapping */ 00241 00242 /** 00243 * @brief AF 14 selection 00244 */ 00245 #define GPIO_AF14_TIM2 ((uint8_t)0x0E) /* TIM2 Alternate Function mapping */ 00246 #define GPIO_AF14_TIM15 ((uint8_t)0x0E) /* TIM15 Alternate Function mapping */ 00247 #define GPIO_AF14_TIM16 ((uint8_t)0x0E) /* TIM16 Alternate Function mapping */ 00248 #define GPIO_AF14_LPTIM2 ((uint8_t)0x0E) /* LPTIM2 Alternate Function mapping */ 00249 00250 /** 00251 * @brief AF 15 selection 00252 */ 00253 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ 00254 00255 #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x0F) 00256 00257 #endif /* STM32L431xx || STM32L432xx || STM32L433xx || STM32L442xx || STM32L443xx */ 00258 00259 #if defined(STM32L451xx) || defined(STM32L452xx) || defined(STM32L462xx) 00260 /*--------------STM32L451xx/STM32L452xx/STM32L462xx---------------------------*/ 00261 /** 00262 * @brief AF 0 selection 00263 */ 00264 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */ 00265 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */ 00266 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ 00267 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ 00268 00269 /** 00270 * @brief AF 1 selection 00271 */ 00272 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */ 00273 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ 00274 #define GPIO_AF1_LPTIM1 ((uint8_t)0x01) /* LPTIM1 Alternate Function mapping */ 00275 #define GPIO_AF1_IR ((uint8_t)0x01) /* IR Alternate Function mapping */ 00276 00277 /** 00278 * @brief AF 2 selection 00279 */ 00280 #define GPIO_AF2_TIM1 ((uint8_t)0x02) /* TIM1 Alternate Function mapping */ 00281 #define GPIO_AF2_TIM2 ((uint8_t)0x02) /* TIM2 Alternate Function mapping */ 00282 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */ 00283 #define GPIO_AF2_I2C4 ((uint8_t)0x02) /* I2C4 Alternate Function mapping */ 00284 00285 /** 00286 * @brief AF 3 selection 00287 */ 00288 #define GPIO_AF3_TIM1_COMP2 ((uint8_t)0x03) /* TIM1/COMP2 Break in Alternate Function mapping */ 00289 #define GPIO_AF3_TIM1_COMP1 ((uint8_t)0x03) /* TIM1/COMP1 Break in Alternate Function mapping */ 00290 #define GPIO_AF3_USART2 ((uint8_t)0x03) /* USART2 Alternate Function mapping */ 00291 #define GPIO_AF3_CAN1 ((uint8_t)0x03) /* CAN1 Alternate Function mapping */ 00292 #define GPIO_AF3_I2C4 ((uint8_t)0x03) /* I2C4 Alternate Function mapping */ 00293 00294 /** 00295 * @brief AF 4 selection 00296 */ 00297 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ 00298 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ 00299 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */ 00300 #define GPIO_AF4_I2C4 ((uint8_t)0x04) /* I2C4 Alternate Function mapping */ 00301 00302 /** 00303 * @brief AF 5 selection 00304 */ 00305 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */ 00306 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2 Alternate Function mapping */ 00307 #define GPIO_AF5_I2C4 ((uint8_t)0x05) /* I2C4 Alternate Function mapping */ 00308 00309 /** 00310 * @brief AF 6 selection 00311 */ 00312 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3 Alternate Function mapping */ 00313 #define GPIO_AF6_DFSDM1 ((uint8_t)0x06) /* DFSDM1 Alternate Function mapping */ 00314 #define GPIO_AF6_COMP1 ((uint8_t)0x06) /* COMP1 Alternate Function mapping */ 00315 00316 /** 00317 * @brief AF 7 selection 00318 */ 00319 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ 00320 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ 00321 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ 00322 00323 /** 00324 * @brief AF 8 selection 00325 */ 00326 #define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */ 00327 #define GPIO_AF8_LPUART1 ((uint8_t)0x08) /* LPUART1 Alternate Function mapping */ 00328 #define GPIO_AF8_CAN1 ((uint8_t)0x08) /* CAN1 Alternate Function mapping */ 00329 00330 00331 /** 00332 * @brief AF 9 selection 00333 */ 00334 #define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */ 00335 #define GPIO_AF9_TSC ((uint8_t)0x09) /* TSC Alternate Function mapping */ 00336 00337 /** 00338 * @brief AF 10 selection 00339 */ 00340 #if defined(STM32L452xx) || defined(STM32L462xx) 00341 #define GPIO_AF10_USB_FS ((uint8_t)0x0A) /* USB_FS Alternate Function mapping */ 00342 #endif /* STM32L452xx || STM32L462xx */ 00343 #define GPIO_AF10_QUADSPI ((uint8_t)0x0A) /* QUADSPI Alternate Function mapping */ 00344 #define GPIO_AF10_CAN1 ((uint8_t)0x0A) /* CAN1 Alternate Function mapping */ 00345 00346 /** 00347 * @brief AF 11 selection 00348 */ 00349 00350 /** 00351 * @brief AF 12 selection 00352 */ 00353 #define GPIO_AF12_COMP1 ((uint8_t)0x0C) /* COMP1 Alternate Function mapping */ 00354 #define GPIO_AF12_COMP2 ((uint8_t)0x0C) /* COMP2 Alternate Function mapping */ 00355 #define GPIO_AF12_SDMMC1 ((uint8_t)0x0C) /* SDMMC1 Alternate Function mapping */ 00356 00357 /** 00358 * @brief AF 13 selection 00359 */ 00360 #define GPIO_AF13_SAI1 ((uint8_t)0x0D) /* SAI1 Alternate Function mapping */ 00361 00362 /** 00363 * @brief AF 14 selection 00364 */ 00365 #define GPIO_AF14_TIM2 ((uint8_t)0x0E) /* TIM2 Alternate Function mapping */ 00366 #define GPIO_AF14_TIM15 ((uint8_t)0x0E) /* TIM15 Alternate Function mapping */ 00367 #define GPIO_AF14_TIM16 ((uint8_t)0x0E) /* TIM16 Alternate Function mapping */ 00368 #define GPIO_AF14_TIM17 ((uint8_t)0x0E) /* TIM17 Alternate Function mapping */ 00369 #define GPIO_AF14_LPTIM2 ((uint8_t)0x0E) /* LPTIM2 Alternate Function mapping */ 00370 00371 /** 00372 * @brief AF 15 selection 00373 */ 00374 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ 00375 00376 #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x0F) 00377 00378 #endif /* STM32L451xx || STM32L452xx || STM32L462xx */ 00379 00380 #if defined(STM32L471xx) || defined(STM32L475xx) || defined(STM32L476xx) || defined(STM32L485xx) || defined(STM32L486xx) 00381 /*--------------STM32L471xx/STM32L475xx/STM32L476xx/STM32L485xx/STM32L486xx---*/ 00382 /** 00383 * @brief AF 0 selection 00384 */ 00385 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */ 00386 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */ 00387 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ 00388 #if defined(STM32L476xx) || defined(STM32L486xx) 00389 #define GPIO_AF0_LCDBIAS ((uint8_t)0x00) /* LCDBIAS Alternate Function mapping */ 00390 #endif /* STM32L476xx || STM32L486xx */ 00391 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ 00392 00393 /** 00394 * @brief AF 1 selection 00395 */ 00396 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */ 00397 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ 00398 #define GPIO_AF1_TIM5 ((uint8_t)0x01) /* TIM5 Alternate Function mapping */ 00399 #define GPIO_AF1_TIM8 ((uint8_t)0x01) /* TIM8 Alternate Function mapping */ 00400 #define GPIO_AF1_LPTIM1 ((uint8_t)0x01) /* LPTIM1 Alternate Function mapping */ 00401 #define GPIO_AF1_IR ((uint8_t)0x01) /* IR Alternate Function mapping */ 00402 00403 /** 00404 * @brief AF 2 selection 00405 */ 00406 #define GPIO_AF2_TIM1 ((uint8_t)0x02) /* TIM1 Alternate Function mapping */ 00407 #define GPIO_AF2_TIM2 ((uint8_t)0x02) /* TIM2 Alternate Function mapping */ 00408 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */ 00409 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */ 00410 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */ 00411 00412 /** 00413 * @brief AF 3 selection 00414 */ 00415 #define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */ 00416 #define GPIO_AF3_TIM1_COMP2 ((uint8_t)0x03) /* TIM1/COMP2 Break in Alternate Function mapping */ 00417 #define GPIO_AF3_TIM1_COMP1 ((uint8_t)0x03) /* TIM1/COMP1 Break in Alternate Function mapping */ 00418 00419 /** 00420 * @brief AF 4 selection 00421 */ 00422 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ 00423 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ 00424 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */ 00425 00426 /** 00427 * @brief AF 5 selection 00428 */ 00429 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */ 00430 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2 Alternate Function mapping */ 00431 00432 /** 00433 * @brief AF 6 selection 00434 */ 00435 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3 Alternate Function mapping */ 00436 #define GPIO_AF6_DFSDM1 ((uint8_t)0x06) /* DFSDM1 Alternate Function mapping */ 00437 00438 /** 00439 * @brief AF 7 selection 00440 */ 00441 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ 00442 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ 00443 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ 00444 00445 /** 00446 * @brief AF 8 selection 00447 */ 00448 #define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */ 00449 #define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */ 00450 #define GPIO_AF8_LPUART1 ((uint8_t)0x08) /* LPUART1 Alternate Function mapping */ 00451 00452 00453 /** 00454 * @brief AF 9 selection 00455 */ 00456 #define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */ 00457 #define GPIO_AF9_TSC ((uint8_t)0x09) /* TSC Alternate Function mapping */ 00458 00459 /** 00460 * @brief AF 10 selection 00461 */ 00462 #if defined(STM32L475xx) || defined(STM32L476xx) || defined(STM32L485xx) || defined(STM32L486xx) 00463 #define GPIO_AF10_OTG_FS ((uint8_t)0x0A) /* OTG_FS Alternate Function mapping */ 00464 #endif /* STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx */ 00465 #define GPIO_AF10_QUADSPI ((uint8_t)0x0A) /* QUADSPI Alternate Function mapping */ 00466 00467 #if defined(STM32L476xx) || defined(STM32L486xx) 00468 /** 00469 * @brief AF 11 selection 00470 */ 00471 #define GPIO_AF11_LCD ((uint8_t)0x0B) /* LCD Alternate Function mapping */ 00472 #endif /* STM32L476xx || STM32L486xx */ 00473 00474 /** 00475 * @brief AF 12 selection 00476 */ 00477 #define GPIO_AF12_FMC ((uint8_t)0x0C) /* FMC Alternate Function mapping */ 00478 #define GPIO_AF12_SWPMI1 ((uint8_t)0x0C) /* SWPMI1 Alternate Function mapping */ 00479 #define GPIO_AF12_COMP1 ((uint8_t)0x0C) /* COMP1 Alternate Function mapping */ 00480 #define GPIO_AF12_COMP2 ((uint8_t)0x0C) /* COMP2 Alternate Function mapping */ 00481 #define GPIO_AF12_SDMMC1 ((uint8_t)0x0C) /* SDMMC1 Alternate Function mapping */ 00482 00483 /** 00484 * @brief AF 13 selection 00485 */ 00486 #define GPIO_AF13_SAI1 ((uint8_t)0x0D) /* SAI1 Alternate Function mapping */ 00487 #define GPIO_AF13_SAI2 ((uint8_t)0x0D) /* SAI2 Alternate Function mapping */ 00488 #define GPIO_AF13_TIM8_COMP2 ((uint8_t)0x0D) /* TIM8/COMP2 Break in Alternate Function mapping */ 00489 #define GPIO_AF13_TIM8_COMP1 ((uint8_t)0x0D) /* TIM8/COMP1 Break in Alternate Function mapping */ 00490 00491 /** 00492 * @brief AF 14 selection 00493 */ 00494 #define GPIO_AF14_TIM2 ((uint8_t)0x0E) /* TIM2 Alternate Function mapping */ 00495 #define GPIO_AF14_TIM15 ((uint8_t)0x0E) /* TIM15 Alternate Function mapping */ 00496 #define GPIO_AF14_TIM16 ((uint8_t)0x0E) /* TIM16 Alternate Function mapping */ 00497 #define GPIO_AF14_TIM17 ((uint8_t)0x0E) /* TIM17 Alternate Function mapping */ 00498 #define GPIO_AF14_LPTIM2 ((uint8_t)0x0E) /* LPTIM2 Alternate Function mapping */ 00499 #define GPIO_AF14_TIM8_COMP1 ((uint8_t)0x0E) /* TIM8/COMP1 Break in Alternate Function mapping */ 00500 00501 /** 00502 * @brief AF 15 selection 00503 */ 00504 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ 00505 00506 #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x0F) 00507 00508 #endif /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx */ 00509 00510 #if defined(STM32L496xx) || defined(STM32L4A6xx) 00511 /*--------------------------------STM32L496xx/STM32L4A6xx---------------------*/ 00512 /** 00513 * @brief AF 0 selection 00514 */ 00515 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */ 00516 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */ 00517 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ 00518 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ 00519 00520 /** 00521 * @brief AF 1 selection 00522 */ 00523 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */ 00524 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ 00525 #define GPIO_AF1_TIM5 ((uint8_t)0x01) /* TIM5 Alternate Function mapping */ 00526 #define GPIO_AF1_TIM8 ((uint8_t)0x01) /* TIM8 Alternate Function mapping */ 00527 #define GPIO_AF1_LPTIM1 ((uint8_t)0x01) /* LPTIM1 Alternate Function mapping */ 00528 #define GPIO_AF1_IR ((uint8_t)0x01) /* IR Alternate Function mapping */ 00529 00530 /** 00531 * @brief AF 2 selection 00532 */ 00533 #define GPIO_AF2_TIM1 ((uint8_t)0x02) /* TIM1 Alternate Function mapping */ 00534 #define GPIO_AF2_TIM2 ((uint8_t)0x02) /* TIM2 Alternate Function mapping */ 00535 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */ 00536 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */ 00537 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */ 00538 #define GPIO_AF2_I2C4 ((uint8_t)0x02) /* I2C4 Alternate Function mapping */ 00539 00540 /** 00541 * @brief AF 3 selection 00542 */ 00543 #define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */ 00544 #define GPIO_AF3_TIM1_COMP2 ((uint8_t)0x03) /* TIM1/COMP2 Break in Alternate Function mapping */ 00545 #define GPIO_AF3_TIM1_COMP1 ((uint8_t)0x03) /* TIM1/COMP1 Break in Alternate Function mapping */ 00546 #define GPIO_AF3_CAN2 ((uint8_t)0x03) /* CAN2 Alternate Function mapping */ 00547 #define GPIO_AF3_I2C4 ((uint8_t)0x03) /* I2C4 Alternate Function mapping */ 00548 #define GPIO_AF3_QUADSPI ((uint8_t)0x03) /* QUADSPI Alternate Function mapping */ 00549 #define GPIO_AF3_SPI2 ((uint8_t)0x03) /* SPI2 Alternate Function mapping */ 00550 #define GPIO_AF3_USART2 ((uint8_t)0x03) /* USART2 Alternate Function mapping */ 00551 00552 /** 00553 * @brief AF 4 selection 00554 */ 00555 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ 00556 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ 00557 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */ 00558 #define GPIO_AF4_I2C4 ((uint8_t)0x04) /* I2C4 Alternate Function mapping */ 00559 #define GPIO_AF4_DCMI ((uint8_t)0x04) /* DCMI Alternate Function mapping */ 00560 00561 /** 00562 * @brief AF 5 selection 00563 */ 00564 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */ 00565 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2 Alternate Function mapping */ 00566 #define GPIO_AF5_DCMI ((uint8_t)0x05) /* DCMI Alternate Function mapping */ 00567 #define GPIO_AF5_I2C4 ((uint8_t)0x05) /* I2C4 Alternate Function mapping */ 00568 #define GPIO_AF5_QUADSPI ((uint8_t)0x05) /* QUADSPI Alternate Function mapping */ 00569 00570 /** 00571 * @brief AF 6 selection 00572 */ 00573 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3 Alternate Function mapping */ 00574 #define GPIO_AF6_DFSDM1 ((uint8_t)0x06) /* DFSDM1 Alternate Function mapping */ 00575 #define GPIO_AF6_I2C3 ((uint8_t)0x06) /* I2C3 Alternate Function mapping */ 00576 00577 /** 00578 * @brief AF 7 selection 00579 */ 00580 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ 00581 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ 00582 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ 00583 00584 /** 00585 * @brief AF 8 selection 00586 */ 00587 #define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */ 00588 #define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */ 00589 #define GPIO_AF8_LPUART1 ((uint8_t)0x08) /* LPUART1 Alternate Function mapping */ 00590 #define GPIO_AF8_CAN2 ((uint8_t)0x08) /* CAN2 Alternate Function mapping */ 00591 00592 /** 00593 * @brief AF 9 selection 00594 */ 00595 #define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */ 00596 #define GPIO_AF9_TSC ((uint8_t)0x09) /* TSC Alternate Function mapping */ 00597 00598 /** 00599 * @brief AF 10 selection 00600 */ 00601 #define GPIO_AF10_OTG_FS ((uint8_t)0x0A) /* OTG_FS Alternate Function mapping */ 00602 #define GPIO_AF10_QUADSPI ((uint8_t)0x0A) /* QUADSPI Alternate Function mapping */ 00603 #define GPIO_AF10_CAN2 ((uint8_t)0x0A) /* CAN2 Alternate Function mapping */ 00604 #define GPIO_AF10_DCMI ((uint8_t)0x0A) /* DCMI Alternate Function mapping */ 00605 00606 /** 00607 * @brief AF 11 selection 00608 */ 00609 #define GPIO_AF11_LCD ((uint8_t)0x0B) /* LCD Alternate Function mapping */ 00610 00611 /** 00612 * @brief AF 12 selection 00613 */ 00614 #define GPIO_AF12_FMC ((uint8_t)0x0C) /* FMC Alternate Function mapping */ 00615 #define GPIO_AF12_SWPMI1 ((uint8_t)0x0C) /* SWPMI1 Alternate Function mapping */ 00616 #define GPIO_AF12_COMP1 ((uint8_t)0x0C) /* COMP1 Alternate Function mapping */ 00617 #define GPIO_AF12_COMP2 ((uint8_t)0x0C) /* COMP2 Alternate Function mapping */ 00618 #define GPIO_AF12_SDMMC1 ((uint8_t)0x0C) /* SDMMC1 Alternate Function mapping */ 00619 #define GPIO_AF12_TIM1_COMP2 ((uint8_t)0x0C) /* TIM1/COMP2 Break in Alternate Function mapping */ 00620 #define GPIO_AF12_TIM1_COMP1 ((uint8_t)0x0C) /* TIM1/COMP1 Break in Alternate Function mapping */ 00621 #define GPIO_AF12_TIM8_COMP2 ((uint8_t)0x0C) /* TIM8/COMP2 Break in Alternate Function mapping */ 00622 00623 /** 00624 * @brief AF 13 selection 00625 */ 00626 #define GPIO_AF13_SAI1 ((uint8_t)0x0D) /* SAI1 Alternate Function mapping */ 00627 #define GPIO_AF13_SAI2 ((uint8_t)0x0D) /* SAI2 Alternate Function mapping */ 00628 #define GPIO_AF13_TIM8_COMP2 ((uint8_t)0x0D) /* TIM8/COMP2 Break in Alternate Function mapping */ 00629 #define GPIO_AF13_TIM8_COMP1 ((uint8_t)0x0D) /* TIM8/COMP1 Break in Alternate Function mapping */ 00630 00631 /** 00632 * @brief AF 14 selection 00633 */ 00634 #define GPIO_AF14_TIM2 ((uint8_t)0x0E) /* TIM2 Alternate Function mapping */ 00635 #define GPIO_AF14_TIM15 ((uint8_t)0x0E) /* TIM15 Alternate Function mapping */ 00636 #define GPIO_AF14_TIM16 ((uint8_t)0x0E) /* TIM16 Alternate Function mapping */ 00637 #define GPIO_AF14_TIM17 ((uint8_t)0x0E) /* TIM17 Alternate Function mapping */ 00638 #define GPIO_AF14_LPTIM2 ((uint8_t)0x0E) /* LPTIM2 Alternate Function mapping */ 00639 #define GPIO_AF14_TIM8_COMP1 ((uint8_t)0x0E) /* TIM8/COMP1 Break in Alternate Function mapping */ 00640 00641 /** 00642 * @brief AF 15 selection 00643 */ 00644 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ 00645 00646 #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x0F) 00647 00648 #endif /* STM32L496xx || STM32L4A6xx */ 00649 00650 #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) 00651 /*---STM32L4P5xx/STM32L4Q5xx--*/ 00652 /** 00653 * @brief AF 0 selection 00654 */ 00655 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */ 00656 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */ 00657 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ 00658 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ 00659 00660 /** 00661 * @brief AF 1 selection 00662 */ 00663 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */ 00664 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ 00665 #define GPIO_AF1_TIM5 ((uint8_t)0x01) /* TIM5 Alternate Function mapping */ 00666 #define GPIO_AF1_TIM8 ((uint8_t)0x01) /* TIM8 Alternate Function mapping */ 00667 #define GPIO_AF1_LPTIM1 ((uint8_t)0x01) /* LPTIM1 Alternate Function mapping */ 00668 #define GPIO_AF1_IR ((uint8_t)0x01) /* IR Alternate Function mapping */ 00669 00670 /** 00671 * @brief AF 2 selection 00672 */ 00673 #define GPIO_AF2_TIM1 ((uint8_t)0x02) /* TIM1 Alternate Function mapping */ 00674 #define GPIO_AF2_TIM2 ((uint8_t)0x02) /* TIM2 Alternate Function mapping */ 00675 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */ 00676 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */ 00677 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */ 00678 00679 /** 00680 * @brief AF 3 selection 00681 */ 00682 #define GPIO_AF3_I2C4 ((uint8_t)0x03) /* I2C4 Alternate Function mapping */ 00683 #define GPIO_AF3_OCTOSPIM_P1 ((uint8_t)0x03) /* OctoSPI Manager Port 1 Alternate Function mapping */ 00684 #define GPIO_AF3_SAI1 ((uint8_t)0x03) /* SAI1 Alternate Function mapping */ 00685 #define GPIO_AF3_SPI2 ((uint8_t)0x03) /* SPI2 Alternate Function mapping */ 00686 #define GPIO_AF3_TIM1_COMP1 ((uint8_t)0x03) /* TIM1/COMP1 Break in Alternate Function mapping */ 00687 #define GPIO_AF3_TIM1_COMP2 ((uint8_t)0x03) /* TIM1/COMP2 Break in Alternate Function mapping */ 00688 #define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */ 00689 #define GPIO_AF3_TIM8_COMP1 ((uint8_t)0x03) /* TIM8/COMP1 Break in Alternate Function mapping */ 00690 #define GPIO_AF3_TIM8_COMP2 ((uint8_t)0x03) /* TIM8/COMP2 Break in Alternate Function mapping */ 00691 #define GPIO_AF3_USART2 ((uint8_t)0x03) /* USART2 Alternate Function mapping */ 00692 00693 /** 00694 * @brief AF 4 selection 00695 */ 00696 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ 00697 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ 00698 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */ 00699 #define GPIO_AF4_I2C4 ((uint8_t)0x04) /* I2C4 Alternate Function mapping */ 00700 #define GPIO_AF4_DCMI ((uint8_t)0x04) /* DCMI Alternate Function mapping */ 00701 #define GPIO_AF4_PSSI ((uint8_t)0x04) /* PSSI Alternate Function mapping */ 00702 00703 /** 00704 * @brief AF 5 selection 00705 */ 00706 #define GPIO_AF5_DCMI ((uint8_t)0x05) /* DCMI Alternate Function mapping */ 00707 #define GPIO_AF5_PSSI ((uint8_t)0x05) /* PSSI Alternate Function mapping */ 00708 #define GPIO_AF5_DFSDM1 ((uint8_t)0x05) /* DFSDM1 Alternate Function mapping */ 00709 #define GPIO_AF5_I2C4 ((uint8_t)0x05) /* I2C4 Alternate Function mapping */ 00710 #define GPIO_AF5_OCTOSPIM_P1 ((uint8_t)0x05) /* OctoSPI Manager Port 1 Alternate Function mapping */ 00711 #define GPIO_AF5_OCTOSPIM_P2 ((uint8_t)0x05) /* OctoSPI Manager Port 2 Alternate Function mapping */ 00712 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */ 00713 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2 Alternate Function mapping */ 00714 #define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI2 Alternate Function mapping */ 00715 00716 /** 00717 * @brief AF 6 selection 00718 */ 00719 #define GPIO_AF6_DFSDM1 ((uint8_t)0x06) /* DFSDM1 Alternate Function mapping */ 00720 #define GPIO_AF6_I2C3 ((uint8_t)0x06) /* I2C3 Alternate Function mapping */ 00721 #define GPIO_AF6_OCTOSPIM_P1 ((uint8_t)0x06) /* OctoSPI Manager Port 1 Alternate Function mapping */ 00722 #define GPIO_AF6_OCTOSPIM_P2 ((uint8_t)0x06) /* OctoSPI Manager Port 2 Alternate Function mapping */ 00723 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3 Alternate Function mapping */ 00724 00725 /** 00726 * @brief AF 7 selection 00727 */ 00728 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ 00729 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ 00730 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ 00731 #define GPIO_AF7_SDMMC2 ((uint8_t)0x07) /* SDMMC2 Alternate Function mapping */ 00732 00733 /** 00734 * @brief AF 8 selection 00735 */ 00736 #define GPIO_AF8_LPUART1 ((uint8_t)0x08) /* LPUART1 Alternate Function mapping */ 00737 #define GPIO_AF8_SDMMC1 ((uint8_t)0x08) /* SDMMC1 Alternate Function mapping */ 00738 #define GPIO_AF8_SDMMC2 ((uint8_t)0x08) /* SDMMC1 Alternate Function mapping */ 00739 #define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */ 00740 #define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */ 00741 00742 /** 00743 * @brief AF 9 selection 00744 */ 00745 #define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */ 00746 #define GPIO_AF9_LTDC ((uint8_t)0x09) /* LTDC Alternate Function mapping */ 00747 #define GPIO_AF9_TSC ((uint8_t)0x09) /* TSC Alternate Function mapping */ 00748 00749 /** 00750 * @brief AF 10 selection 00751 */ 00752 #define GPIO_AF10_DCMI ((uint8_t)0x0A) /* DCMI Alternate Function mapping */ 00753 #define GPIO_AF10_PSSI ((uint8_t)0x0A) /* PSSI Alternate Function mapping */ 00754 #define GPIO_AF10_OCTOSPIM_P1 ((uint8_t)0x0A) /* OctoSPI Manager Port 1 Alternate Function mapping */ 00755 #define GPIO_AF10_OCTOSPIM_P2 ((uint8_t)0x0A) /* OctoSPI Manager Port 2 Alternate Function mapping */ 00756 #define GPIO_AF10_OTG_FS ((uint8_t)0x0A) /* OTG_FS Alternate Function mapping */ 00757 00758 /** 00759 * @brief AF 11 selection 00760 */ 00761 #define GPIO_AF11_LTDC ((uint8_t)0x0B) /* LTDC Alternate Function mapping */ 00762 #define GPIO_AF11_SDMMC2 ((uint8_t)0x0B) /* SDMMC2 Alternate Function mapping */ 00763 00764 /** 00765 * @brief AF 12 selection 00766 */ 00767 #define GPIO_AF12_COMP1 ((uint8_t)0x0C) /* COMP1 Alternate Function mapping */ 00768 #define GPIO_AF12_COMP2 ((uint8_t)0x0C) /* COMP2 Alternate Function mapping */ 00769 #define GPIO_AF12_FMC ((uint8_t)0x0C) /* FMC Alternate Function mapping */ 00770 #define GPIO_AF12_SDMMC1 ((uint8_t)0x0C) /* SDMMC1 Alternate Function mapping */ 00771 #define GPIO_AF12_SDMMC2 ((uint8_t)0x0C) /* SDMMC2 Alternate Function mapping */ 00772 #define GPIO_AF12_TIM1_COMP1 ((uint8_t)0x0C) /* TIM1/COMP1 Break in Alternate Function mapping */ 00773 #define GPIO_AF12_TIM1_COMP2 ((uint8_t)0x0C) /* TIM1/COMP2 Break in Alternate Function mapping */ 00774 #define GPIO_AF12_TIM8_COMP2 ((uint8_t)0x0C) /* TIM8/COMP2 Break in Alternate Function mapping */ 00775 00776 /** 00777 * @brief AF 13 selection 00778 */ 00779 #define GPIO_AF13_SAI1 ((uint8_t)0x0D) /* SAI1 Alternate Function mapping */ 00780 #define GPIO_AF13_SAI2 ((uint8_t)0x0D) /* SAI2 Alternate Function mapping */ 00781 #define GPIO_AF13_TIM8_COMP1 ((uint8_t)0x0D) /* TIM8/COMP1 Break in Alternate Function mapping */ 00782 00783 /** 00784 * @brief AF 14 selection 00785 */ 00786 #define GPIO_AF14_TIM15 ((uint8_t)0x0E) /* TIM15 Alternate Function mapping */ 00787 #define GPIO_AF14_TIM16 ((uint8_t)0x0E) /* TIM16 Alternate Function mapping */ 00788 #define GPIO_AF14_TIM17 ((uint8_t)0x0E) /* TIM17 Alternate Function mapping */ 00789 #define GPIO_AF14_LPTIM2 ((uint8_t)0x0E) /* LPTIM2 Alternate Function mapping */ 00790 #define GPIO_AF14_TIM8_COMP2 ((uint8_t)0x0E) /* TIM8/COMP2 Break in Alternate Function mapping */ 00791 00792 /** 00793 * @brief AF 15 selection 00794 */ 00795 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ 00796 00797 #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x0F) 00798 00799 #endif /* STM32L4P5xx || STM32L4Q5xx */ 00800 00801 #if defined (STM32L4R5xx) || defined (STM32L4R7xx) || defined (STM32L4R9xx) || defined (STM32L4S5xx) || defined (STM32L4S7xx) || defined (STM32L4S9xx) 00802 /*---STM32L4R5xx/STM32L4R7xx/STM32L4R9xx/STM32L4S5xx/STM32L4S7xx/STM32L4S9xx--*/ 00803 /** 00804 * @brief AF 0 selection 00805 */ 00806 #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */ 00807 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */ 00808 #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ 00809 #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ 00810 00811 /** 00812 * @brief AF 1 selection 00813 */ 00814 #define GPIO_AF1_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */ 00815 #define GPIO_AF1_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */ 00816 #define GPIO_AF1_TIM5 ((uint8_t)0x01) /* TIM5 Alternate Function mapping */ 00817 #define GPIO_AF1_TIM8 ((uint8_t)0x01) /* TIM8 Alternate Function mapping */ 00818 #define GPIO_AF1_LPTIM1 ((uint8_t)0x01) /* LPTIM1 Alternate Function mapping */ 00819 #define GPIO_AF1_IR ((uint8_t)0x01) /* IR Alternate Function mapping */ 00820 00821 /** 00822 * @brief AF 2 selection 00823 */ 00824 #define GPIO_AF2_TIM1 ((uint8_t)0x02) /* TIM1 Alternate Function mapping */ 00825 #define GPIO_AF2_TIM2 ((uint8_t)0x02) /* TIM2 Alternate Function mapping */ 00826 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */ 00827 #define GPIO_AF2_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */ 00828 #define GPIO_AF2_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */ 00829 00830 /** 00831 * @brief AF 3 selection 00832 */ 00833 #define GPIO_AF3_I2C4 ((uint8_t)0x03) /* I2C4 Alternate Function mapping */ 00834 #define GPIO_AF3_OCTOSPIM_P1 ((uint8_t)0x03) /* OctoSPI Manager Port 1 Alternate Function mapping */ 00835 #define GPIO_AF3_SAI1 ((uint8_t)0x03) /* SAI1 Alternate Function mapping */ 00836 #define GPIO_AF3_SPI2 ((uint8_t)0x03) /* SPI2 Alternate Function mapping */ 00837 #define GPIO_AF3_TIM1_COMP1 ((uint8_t)0x03) /* TIM1/COMP1 Break in Alternate Function mapping */ 00838 #define GPIO_AF3_TIM1_COMP2 ((uint8_t)0x03) /* TIM1/COMP2 Break in Alternate Function mapping */ 00839 #define GPIO_AF3_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */ 00840 #define GPIO_AF3_TIM8_COMP1 ((uint8_t)0x03) /* TIM8/COMP1 Break in Alternate Function mapping */ 00841 #define GPIO_AF3_TIM8_COMP2 ((uint8_t)0x03) /* TIM8/COMP2 Break in Alternate Function mapping */ 00842 #define GPIO_AF3_USART2 ((uint8_t)0x03) /* USART2 Alternate Function mapping */ 00843 00844 /** 00845 * @brief AF 4 selection 00846 */ 00847 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */ 00848 #define GPIO_AF4_I2C2 ((uint8_t)0x04) /* I2C2 Alternate Function mapping */ 00849 #define GPIO_AF4_I2C3 ((uint8_t)0x04) /* I2C3 Alternate Function mapping */ 00850 #define GPIO_AF4_I2C4 ((uint8_t)0x04) /* I2C4 Alternate Function mapping */ 00851 #define GPIO_AF4_DCMI ((uint8_t)0x04) /* DCMI Alternate Function mapping */ 00852 00853 /** 00854 * @brief AF 5 selection 00855 */ 00856 #define GPIO_AF5_DCMI ((uint8_t)0x05) /* DCMI Alternate Function mapping */ 00857 #define GPIO_AF5_DFSDM1 ((uint8_t)0x05) /* DFSDM1 Alternate Function mapping */ 00858 #define GPIO_AF5_I2C4 ((uint8_t)0x05) /* I2C4 Alternate Function mapping */ 00859 #define GPIO_AF5_OCTOSPIM_P1 ((uint8_t)0x05) /* OctoSPI Manager Port 1 Alternate Function mapping */ 00860 #define GPIO_AF5_OCTOSPIM_P2 ((uint8_t)0x05) /* OctoSPI Manager Port 2 Alternate Function mapping */ 00861 #define GPIO_AF5_SPI1 ((uint8_t)0x05) /* SPI1 Alternate Function mapping */ 00862 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2 Alternate Function mapping */ 00863 #define GPIO_AF5_SPI3 ((uint8_t)0x05) /* SPI2 Alternate Function mapping */ 00864 00865 /** 00866 * @brief AF 6 selection 00867 */ 00868 #define GPIO_AF6_DFSDM1 ((uint8_t)0x06) /* DFSDM1 Alternate Function mapping */ 00869 #define GPIO_AF6_I2C3 ((uint8_t)0x06) /* I2C3 Alternate Function mapping */ 00870 #define GPIO_AF6_SPI3 ((uint8_t)0x06) /* SPI3 Alternate Function mapping */ 00871 00872 /** 00873 * @brief AF 7 selection 00874 */ 00875 #define GPIO_AF7_USART1 ((uint8_t)0x07) /* USART1 Alternate Function mapping */ 00876 #define GPIO_AF7_USART2 ((uint8_t)0x07) /* USART2 Alternate Function mapping */ 00877 #define GPIO_AF7_USART3 ((uint8_t)0x07) /* USART3 Alternate Function mapping */ 00878 00879 /** 00880 * @brief AF 8 selection 00881 */ 00882 #define GPIO_AF8_LPUART1 ((uint8_t)0x08) /* LPUART1 Alternate Function mapping */ 00883 #define GPIO_AF8_SDMMC1 ((uint8_t)0x08) /* SDMMC1 Alternate Function mapping */ 00884 #define GPIO_AF8_UART4 ((uint8_t)0x08) /* UART4 Alternate Function mapping */ 00885 #define GPIO_AF8_UART5 ((uint8_t)0x08) /* UART5 Alternate Function mapping */ 00886 00887 /** 00888 * @brief AF 9 selection 00889 */ 00890 #define GPIO_AF9_CAN1 ((uint8_t)0x09) /* CAN1 Alternate Function mapping */ 00891 #define GPIO_AF9_LTDC ((uint8_t)0x09) /* LTDC Alternate Function mapping */ 00892 #define GPIO_AF9_TSC ((uint8_t)0x09) /* TSC Alternate Function mapping */ 00893 00894 /** 00895 * @brief AF 10 selection 00896 */ 00897 #define GPIO_AF10_DCMI ((uint8_t)0x0A) /* DCMI Alternate Function mapping */ 00898 #define GPIO_AF10_OCTOSPIM_P1 ((uint8_t)0x0A) /* OctoSPI Manager Port 1 Alternate Function mapping */ 00899 #define GPIO_AF10_OCTOSPIM_P2 ((uint8_t)0x0A) /* OctoSPI Manager Port 2 Alternate Function mapping */ 00900 #define GPIO_AF10_OTG_FS ((uint8_t)0x0A) /* OTG_FS Alternate Function mapping */ 00901 00902 /** 00903 * @brief AF 11 selection 00904 */ 00905 #define GPIO_AF11_DSI ((uint8_t)0x0B) /* DSI Alternate Function mapping */ 00906 #define GPIO_AF11_LTDC ((uint8_t)0x0B) /* LTDC Alternate Function mapping */ 00907 00908 /** 00909 * @brief AF 12 selection 00910 */ 00911 #define GPIO_AF12_COMP1 ((uint8_t)0x0C) /* COMP1 Alternate Function mapping */ 00912 #define GPIO_AF12_COMP2 ((uint8_t)0x0C) /* COMP2 Alternate Function mapping */ 00913 #define GPIO_AF12_DSI ((uint8_t)0x0C) /* DSI Alternate Function mapping */ 00914 #define GPIO_AF12_FMC ((uint8_t)0x0C) /* FMC Alternate Function mapping */ 00915 #define GPIO_AF12_SDMMC1 ((uint8_t)0x0C) /* SDMMC1 Alternate Function mapping */ 00916 #define GPIO_AF12_TIM1_COMP1 ((uint8_t)0x0C) /* TIM1/COMP1 Break in Alternate Function mapping */ 00917 #define GPIO_AF12_TIM1_COMP2 ((uint8_t)0x0C) /* TIM1/COMP2 Break in Alternate Function mapping */ 00918 #define GPIO_AF12_TIM8_COMP2 ((uint8_t)0x0C) /* TIM8/COMP2 Break in Alternate Function mapping */ 00919 00920 /** 00921 * @brief AF 13 selection 00922 */ 00923 #define GPIO_AF13_SAI1 ((uint8_t)0x0D) /* SAI1 Alternate Function mapping */ 00924 #define GPIO_AF13_SAI2 ((uint8_t)0x0D) /* SAI2 Alternate Function mapping */ 00925 #define GPIO_AF13_TIM8_COMP1 ((uint8_t)0x0D) /* TIM8/COMP1 Break in Alternate Function mapping */ 00926 00927 /** 00928 * @brief AF 14 selection 00929 */ 00930 #define GPIO_AF14_TIM2 ((uint8_t)0x0E) /* TIM2 Alternate Function mapping */ 00931 #define GPIO_AF14_TIM15 ((uint8_t)0x0E) /* TIM15 Alternate Function mapping */ 00932 #define GPIO_AF14_TIM16 ((uint8_t)0x0E) /* TIM16 Alternate Function mapping */ 00933 #define GPIO_AF14_TIM17 ((uint8_t)0x0E) /* TIM17 Alternate Function mapping */ 00934 #define GPIO_AF14_LPTIM2 ((uint8_t)0x0E) /* LPTIM2 Alternate Function mapping */ 00935 #define GPIO_AF14_TIM8_COMP2 ((uint8_t)0x0E) /* TIM8/COMP2 Break in Alternate Function mapping */ 00936 00937 /** 00938 * @brief AF 15 selection 00939 */ 00940 #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /* EVENTOUT Alternate Function mapping */ 00941 00942 #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x0F) 00943 00944 #endif /* STM32L4R5xx || STM32L4R7xx || STM32L4R9xx || STM32L4S5xx || STM32L4S7xx || STM32L4S9xx */ 00945 00946 /** 00947 * @} 00948 */ 00949 00950 /** 00951 * @} 00952 */ 00953 00954 /* Exported macro ------------------------------------------------------------*/ 00955 /** @defgroup GPIOEx_Exported_Macros GPIOEx Exported Macros 00956 * @{ 00957 */ 00958 00959 /** @defgroup GPIOEx_Get_Port_Index GPIOEx_Get Port Index 00960 * @{ 00961 */ 00962 #if defined(STM32L412xx) || defined(STM32L422xx) 00963 00964 #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0uL :\ 00965 ((__GPIOx__) == (GPIOB))? 1uL :\ 00966 ((__GPIOx__) == (GPIOC))? 2uL :\ 00967 ((__GPIOx__) == (GPIOD))? 3uL : 7uL) 00968 00969 #endif /* STM32L412xx || STM32L422xx */ 00970 00971 #if defined(STM32L431xx) || defined(STM32L433xx) || defined(STM32L443xx) 00972 00973 #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0uL :\ 00974 ((__GPIOx__) == (GPIOB))? 1uL :\ 00975 ((__GPIOx__) == (GPIOC))? 2uL :\ 00976 ((__GPIOx__) == (GPIOD))? 3uL :\ 00977 ((__GPIOx__) == (GPIOE))? 4uL : 7uL) 00978 00979 #endif /* STM32L431xx || STM32L433xx || STM32L443xx */ 00980 00981 #if defined(STM32L432xx) || defined(STM32L442xx) 00982 00983 #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0uL :\ 00984 ((__GPIOx__) == (GPIOB))? 1uL :\ 00985 ((__GPIOx__) == (GPIOC))? 2uL : 7uL) 00986 00987 #endif /* STM32L432xx || STM32L442xx */ 00988 00989 #if defined(STM32L451xx) || defined(STM32L452xx) || defined(STM32L462xx) 00990 00991 #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0uL :\ 00992 ((__GPIOx__) == (GPIOB))? 1uL :\ 00993 ((__GPIOx__) == (GPIOC))? 2uL :\ 00994 ((__GPIOx__) == (GPIOD))? 3uL :\ 00995 ((__GPIOx__) == (GPIOE))? 4uL : 7uL) 00996 00997 #endif /* STM32L451xx || STM32L452xx || STM32L462xx */ 00998 00999 #if defined(STM32L471xx) || defined(STM32L475xx) || defined(STM32L476xx) || defined(STM32L485xx) || defined(STM32L486xx) 01000 01001 #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0uL :\ 01002 ((__GPIOx__) == (GPIOB))? 1uL :\ 01003 ((__GPIOx__) == (GPIOC))? 2uL :\ 01004 ((__GPIOx__) == (GPIOD))? 3uL :\ 01005 ((__GPIOx__) == (GPIOE))? 4uL :\ 01006 ((__GPIOx__) == (GPIOF))? 5uL :\ 01007 ((__GPIOx__) == (GPIOG))? 6uL : 7uL) 01008 01009 #endif /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx */ 01010 01011 #if defined(STM32L496xx) || defined(STM32L4A6xx) 01012 01013 #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0uL :\ 01014 ((__GPIOx__) == (GPIOB))? 1uL :\ 01015 ((__GPIOx__) == (GPIOC))? 2uL :\ 01016 ((__GPIOx__) == (GPIOD))? 3uL :\ 01017 ((__GPIOx__) == (GPIOE))? 4uL :\ 01018 ((__GPIOx__) == (GPIOF))? 5uL :\ 01019 ((__GPIOx__) == (GPIOG))? 6uL :\ 01020 ((__GPIOx__) == (GPIOH))? 7uL : 8uL) 01021 01022 #endif /* STM32L496xx || STM32L4A6xx */ 01023 01024 #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) || defined (STM32L4R5xx) || defined (STM32L4R7xx) || defined (STM32L4R9xx) || defined (STM32L4S5xx) || defined (STM32L4S7xx) || defined (STM32L4S9xx) 01025 01026 #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0uL :\ 01027 ((__GPIOx__) == (GPIOB))? 1uL :\ 01028 ((__GPIOx__) == (GPIOC))? 2uL :\ 01029 ((__GPIOx__) == (GPIOD))? 3uL :\ 01030 ((__GPIOx__) == (GPIOE))? 4uL :\ 01031 ((__GPIOx__) == (GPIOF))? 5uL :\ 01032 ((__GPIOx__) == (GPIOG))? 6uL :\ 01033 ((__GPIOx__) == (GPIOH))? 7uL : 8uL) 01034 01035 #endif /* STM32L4P5xx || STM32L4Q5xx || STM32L4R5xx || STM32L4R7xx || STM32L4R9xx || STM32L4S5xx || STM32L4S7xx || STM32L4S9xx */ 01036 01037 /** 01038 * @} 01039 */ 01040 01041 /** 01042 * @} 01043 */ 01044 01045 /* Exported functions --------------------------------------------------------*/ 01046 /** 01047 * @} 01048 */ 01049 01050 /** 01051 * @} 01052 */ 01053 01054 #ifdef __cplusplus 01055 } 01056 #endif 01057 01058 #endif /* STM32L4xx_HAL_GPIO_EX_H */ 01059