TUKS MCU Introductory course / TUKS-COURSE-THERMOMETER

Fork of TUKS-COURSE-TIMER by TUKS MCU Introductory course

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers stm32l4xx_hal_gpio_ex.h Source File

stm32l4xx_hal_gpio_ex.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32l4xx_hal_gpio_ex.h
00004   * @author  MCD Application Team
00005   * @version V1.5.1
00006   * @date    31-May-2016
00007   * @brief   Header file of GPIO HAL Extended module.
00008   ******************************************************************************
00009   * @attention
00010   *
00011   * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
00012   *
00013   * Redistribution and use in source and binary forms, with or without modification,
00014   * are permitted provided that the following conditions are met:
00015   *   1. Redistributions of source code must retain the above copyright notice,
00016   *      this list of conditions and the following disclaimer.
00017   *   2. Redistributions in binary form must reproduce the above copyright notice,
00018   *      this list of conditions and the following disclaimer in the documentation
00019   *      and/or other materials provided with the distribution.
00020   *   3. Neither the name of STMicroelectronics nor the names of its contributors
00021   *      may be used to endorse or promote products derived from this software
00022   *      without specific prior written permission.
00023   *
00024   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00025   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00026   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00027   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00028   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00029   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00030   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00031   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00032   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00033   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00034   *
00035   ******************************************************************************
00036   */
00037 
00038 /* Define to prevent recursive inclusion -------------------------------------*/
00039 #ifndef __STM32L4xx_HAL_GPIO_EX_H
00040 #define __STM32L4xx_HAL_GPIO_EX_H
00041 
00042 #ifdef __cplusplus
00043  extern "C" {
00044 #endif
00045 
00046 /* Includes ------------------------------------------------------------------*/
00047 #include "stm32l4xx_hal_def.h"
00048 
00049 /** @addtogroup STM32L4xx_HAL_Driver
00050   * @{
00051   */
00052 
00053 /** @defgroup GPIOEx GPIOEx
00054   * @brief GPIO Extended HAL module driver
00055   * @{
00056   */
00057 
00058 /* Exported types ------------------------------------------------------------*/
00059 /* Exported constants --------------------------------------------------------*/
00060 /** @defgroup GPIOEx_Exported_Constants GPIOEx Exported Constants
00061   * @{
00062   */
00063 
00064 /** @defgroup GPIOEx_Alternate_function_selection GPIOEx Alternate function selection
00065   * @{
00066   */
00067 
00068 #if defined(STM32L471xx) || defined(STM32L475xx) || defined(STM32L476xx) || defined(STM32L485xx) || defined(STM32L486xx)
00069 /*--------------STM32L471xx/STM32L475xx/STM32L476xx/STM32L485xx/STM32L486xx---*/
00070 /**
00071   * @brief   AF 0 selection
00072   */
00073 #define GPIO_AF0_RTC_50Hz      ((uint8_t)0x00)  /* RTC_50Hz Alternate Function mapping                       */
00074 #define GPIO_AF0_MCO           ((uint8_t)0x00)  /* MCO (MCO1 and MCO2) Alternate Function mapping            */
00075 #define GPIO_AF0_SWJ           ((uint8_t)0x00)  /* SWJ (SWD and JTAG) Alternate Function mapping             */
00076 #if defined(STM32L476xx) || defined(STM32L486xx)
00077 #define GPIO_AF0_LCDBIAS       ((uint8_t)0x00)  /* LCDBIAS Alternate Function mapping                        */
00078 #endif /* STM32L476xx || STM32L486xx */
00079 #define GPIO_AF0_TRACE         ((uint8_t)0x00)  /* TRACE Alternate Function mapping                          */
00080 
00081 /**
00082   * @brief   AF 1 selection
00083   */
00084 #define GPIO_AF1_TIM1          ((uint8_t)0x01)  /* TIM1 Alternate Function mapping */
00085 #define GPIO_AF1_TIM2          ((uint8_t)0x01)  /* TIM2 Alternate Function mapping */
00086 #define GPIO_AF1_TIM5          ((uint8_t)0x01)  /* TIM5 Alternate Function mapping */
00087 #define GPIO_AF1_TIM8          ((uint8_t)0x01)  /* TIM8 Alternate Function mapping */
00088 #define GPIO_AF1_LPTIM1        ((uint8_t)0x01)  /* LPTIM1 Alternate Function mapping */
00089 #define GPIO_AF1_IR            ((uint8_t)0x01)  /* IR Alternate Function mapping */
00090 
00091 /**
00092   * @brief   AF 2 selection
00093   */
00094 #define GPIO_AF2_TIM1          ((uint8_t)0x02)  /* TIM1 Alternate Function mapping */
00095 #define GPIO_AF2_TIM2          ((uint8_t)0x02)  /* TIM2 Alternate Function mapping */
00096 #define GPIO_AF2_TIM3          ((uint8_t)0x02)  /* TIM3 Alternate Function mapping */
00097 #define GPIO_AF2_TIM4          ((uint8_t)0x02)  /* TIM4 Alternate Function mapping */
00098 #define GPIO_AF2_TIM5          ((uint8_t)0x02)  /* TIM5 Alternate Function mapping */
00099 
00100 /**
00101   * @brief   AF 3 selection
00102   */
00103 #define GPIO_AF3_TIM8          ((uint8_t)0x03)  /* TIM8 Alternate Function mapping  */
00104 #define GPIO_AF3_TIM1_COMP2    ((uint8_t)0x03)  /* TIM1/COMP2 Break in Alternate Function mapping  */
00105 #define GPIO_AF3_TIM1_COMP1    ((uint8_t)0x03)  /* TIM1/COMP1 Break in Alternate Function mapping  */
00106 
00107 /**
00108   * @brief   AF 4 selection
00109   */
00110 #define GPIO_AF4_I2C1          ((uint8_t)0x04)  /* I2C1 Alternate Function mapping   */
00111 #define GPIO_AF4_I2C2          ((uint8_t)0x04)  /* I2C2 Alternate Function mapping   */
00112 #define GPIO_AF4_I2C3          ((uint8_t)0x04)  /* I2C3 Alternate Function mapping   */
00113 
00114 /**
00115   * @brief   AF 5 selection
00116   */
00117 #define GPIO_AF5_SPI1          ((uint8_t)0x05)  /* SPI1 Alternate Function mapping   */
00118 #define GPIO_AF5_SPI2          ((uint8_t)0x05)  /* SPI2 Alternate Function mapping   */
00119 
00120 /**
00121   * @brief   AF 6 selection
00122   */
00123 #define GPIO_AF6_SPI3          ((uint8_t)0x06)  /* SPI3 Alternate Function mapping   */
00124 #define GPIO_AF6_DFSDM1        ((uint8_t)0x06)  /* DFSDM1 Alternate Function mapping */
00125 
00126 /**
00127   * @brief   AF 7 selection
00128   */
00129 #define GPIO_AF7_USART1        ((uint8_t)0x07)  /* USART1 Alternate Function mapping     */
00130 #define GPIO_AF7_USART2        ((uint8_t)0x07)  /* USART2 Alternate Function mapping     */
00131 #define GPIO_AF7_USART3        ((uint8_t)0x07)  /* USART3 Alternate Function mapping     */
00132 
00133 /**
00134   * @brief   AF 8 selection
00135   */
00136 #define GPIO_AF8_UART4         ((uint8_t)0x08)  /* UART4 Alternate Function mapping   */
00137 #define GPIO_AF8_UART5         ((uint8_t)0x08)  /* UART5 Alternate Function mapping   */
00138 #define GPIO_AF8_LPUART1       ((uint8_t)0x08)  /* LPUART1 Alternate Function mapping */
00139 
00140 
00141 /**
00142   * @brief   AF 9 selection
00143   */
00144 #define GPIO_AF9_CAN1          ((uint8_t)0x09)  /* CAN1 Alternate Function mapping  */
00145 #define GPIO_AF9_TSC           ((uint8_t)0x09)  /* TSC Alternate Function mapping   */
00146 
00147 /**
00148   * @brief   AF 10 selection
00149   */
00150 #if defined(STM32L475xx) || defined(STM32L476xx) || defined(STM32L485xx) || defined(STM32L486xx)
00151 #define GPIO_AF10_OTG_FS       ((uint8_t)0xA)  /* OTG_FS Alternate Function mapping */
00152 #endif /* STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx */
00153 #define GPIO_AF10_QUADSPI      ((uint8_t)0xA)  /* QUADSPI Alternate Function mapping */
00154 
00155 #if defined(STM32L476xx) || defined(STM32L486xx)
00156 /**
00157   * @brief   AF 11 selection
00158   */
00159 #define GPIO_AF11_LCD           ((uint8_t)0x0B)  /* LCD Alternate Function mapping */
00160 #endif /* STM32L476xx || STM32L486xx */
00161 
00162 /**
00163   * @brief   AF 12 selection
00164   */
00165 #define GPIO_AF12_FMC           ((uint8_t)0xC)  /* FMC Alternate Function mapping     */
00166 #define GPIO_AF12_SWPMI1        ((uint8_t)0xC)  /* SWPMI1 Alternate Function mapping  */
00167 #define GPIO_AF12_COMP1         ((uint8_t)0xC)  /* COMP1 Alternate Function mapping   */
00168 #define GPIO_AF12_COMP2         ((uint8_t)0xC)  /* COMP2 Alternate Function mapping   */
00169 #define GPIO_AF12_SDMMC1        ((uint8_t)0xC)  /* SDMMC1 Alternate Function mapping  */
00170 
00171 /**
00172   * @brief   AF 13 selection
00173   */
00174 #define GPIO_AF13_SAI1          ((uint8_t)0x0D)   /* SAI1 Alternate Function mapping */
00175 #define GPIO_AF13_SAI2          ((uint8_t)0x0D)   /* SAI2 Alternate Function mapping */
00176 #define GPIO_AF13_TIM8_COMP2    ((uint8_t)0x0D)   /* TIM8/COMP2 Break in Alternate Function mapping  */
00177 #define GPIO_AF13_TIM8_COMP1    ((uint8_t)0x0D)   /* TIM8/COMP1 Break in Alternate Function mapping  */
00178 
00179 /**
00180   * @brief   AF 14 selection
00181   */
00182 #define GPIO_AF14_TIM2          ((uint8_t)0x0E)   /* TIM2 Alternate Function mapping */
00183 #define GPIO_AF14_TIM15         ((uint8_t)0x0E)   /* TIM15 Alternate Function mapping */
00184 #define GPIO_AF14_TIM16         ((uint8_t)0x0E)   /* TIM16 Alternate Function mapping */
00185 #define GPIO_AF14_TIM17         ((uint8_t)0x0E)   /* TIM17 Alternate Function mapping */
00186 #define GPIO_AF14_LPTIM2        ((uint8_t)0x0E)   /* LPTIM2 Alternate Function mapping */
00187 #define GPIO_AF14_TIM8_COMP1    ((uint8_t)0x0E)   /* TIM8/COMP1 Break in Alternate Function mapping  */
00188 
00189 /**
00190   * @brief   AF 15 selection
00191   */
00192 #define GPIO_AF15_EVENTOUT      ((uint8_t)0x0F)  /* EVENTOUT Alternate Function mapping */
00193 
00194 #define IS_GPIO_AF(AF)   ((AF) <= (uint8_t)0x0F)
00195 
00196 #endif /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx */
00197 
00198 #if defined(STM32L431xx) || defined(STM32L432xx) || defined(STM32L433xx) || defined(STM32L442xx) || defined(STM32L443xx)
00199 /*--------------STM32L431xx/STM32L432xx/STM32L433xx/STM32L442xx/STM32L443xx---*/
00200 /**
00201   * @brief   AF 0 selection
00202   */
00203 #define GPIO_AF0_RTC_50Hz      ((uint8_t)0x00)  /* RTC_50Hz Alternate Function mapping                       */
00204 #define GPIO_AF0_MCO           ((uint8_t)0x00)  /* MCO (MCO1 and MCO2) Alternate Function mapping            */
00205 #define GPIO_AF0_SWJ           ((uint8_t)0x00)  /* SWJ (SWD and JTAG) Alternate Function mapping             */
00206 #if defined(STM32L433xx) || defined(STM32L443xx)
00207 #define GPIO_AF0_LCDBIAS       ((uint8_t)0x00)  /* LCDBIAS Alternate Function mapping                          */
00208 #endif /* STM32L433xx || STM32L443xx */
00209 #define GPIO_AF0_TRACE         ((uint8_t)0x00)  /* TRACE Alternate Function mapping                          */
00210 
00211 /**
00212   * @brief   AF 1 selection
00213   */
00214 #define GPIO_AF1_TIM1          ((uint8_t)0x01)  /* TIM1 Alternate Function mapping */
00215 #define GPIO_AF1_TIM2          ((uint8_t)0x01)  /* TIM2 Alternate Function mapping */
00216 #define GPIO_AF1_LPTIM1        ((uint8_t)0x01)  /* LPTIM1 Alternate Function mapping */
00217 #define GPIO_AF1_IR            ((uint8_t)0x01)  /* IR Alternate Function mapping */
00218 
00219 /**
00220   * @brief   AF 2 selection
00221   */
00222 #define GPIO_AF2_TIM1          ((uint8_t)0x02)  /* TIM1 Alternate Function mapping */
00223 #define GPIO_AF2_TIM2          ((uint8_t)0x02)  /* TIM2 Alternate Function mapping */
00224 
00225 /**
00226   * @brief   AF 3 selection
00227   */
00228 #define GPIO_AF3_USART2        ((uint8_t)0x03)  /* USART1 Alternate Function mapping */
00229 #define GPIO_AF3_TIM1_COMP2    ((uint8_t)0x03)  /* TIM1/COMP2 Break in Alternate Function mapping  */
00230 #define GPIO_AF3_TIM1_COMP1    ((uint8_t)0x03)  /* TIM1/COMP1 Break in Alternate Function mapping  */
00231 
00232 /**
00233   * @brief   AF 4 selection
00234   */
00235 #define GPIO_AF4_I2C1          ((uint8_t)0x04)  /* I2C1 Alternate Function mapping   */
00236 #define GPIO_AF4_I2C2          ((uint8_t)0x04)  /* I2C2 Alternate Function mapping   */
00237 #define GPIO_AF4_I2C3          ((uint8_t)0x04)  /* I2C3 Alternate Function mapping   */
00238 
00239 /**
00240   * @brief   AF 5 selection
00241   */
00242 #define GPIO_AF5_SPI1          ((uint8_t)0x05)  /* SPI1 Alternate Function mapping   */
00243 #define GPIO_AF5_SPI2          ((uint8_t)0x05)  /* SPI2 Alternate Function mapping   */
00244 
00245 /**
00246   * @brief   AF 6 selection
00247   */
00248 #define GPIO_AF6_SPI3          ((uint8_t)0x06)  /* SPI3 Alternate Function mapping   */
00249 #define GPIO_AF6_COMP1         ((uint8_t)0x06)  /* COMP1 Alternate Function mapping   */
00250 
00251 /**
00252   * @brief   AF 7 selection
00253   */
00254 #define GPIO_AF7_USART1        ((uint8_t)0x07)  /* USART1 Alternate Function mapping     */
00255 #define GPIO_AF7_USART2        ((uint8_t)0x07)  /* USART2 Alternate Function mapping     */
00256 #define GPIO_AF7_USART3        ((uint8_t)0x07)  /* USART3 Alternate Function mapping     */
00257 
00258 /**
00259   * @brief   AF 8 selection
00260   */
00261 #define GPIO_AF8_LPUART1       ((uint8_t)0x08)  /* LPUART1 Alternate Function mapping */
00262 
00263 /**
00264   * @brief   AF 9 selection
00265   */
00266 #define GPIO_AF9_CAN1          ((uint8_t)0x09)  /* CAN1 Alternate Function mapping    */
00267 #define GPIO_AF9_TSC           ((uint8_t)0x09)  /* TSC Alternate Function mapping   */
00268 
00269 /**
00270   * @brief   AF 10 selection
00271   */
00272 #if defined(STM32L432xx) || defined(STM32L433xx) || defined(STM32L442xx) || defined(STM32L443xx)
00273 #define GPIO_AF10_USB_FS        ((uint8_t)0xA)  /* USB_FS Alternate Function mapping */
00274 #endif /* STM32L432xx || STM32L433xx || STM32L442xx || STM32L443xx */
00275 #define GPIO_AF10_QUADSPI       ((uint8_t)0xA)  /* QUADSPI Alternate Function mapping */
00276 
00277 #if defined(STM32L433xx) || defined(STM32L443xx)
00278 /**
00279   * @brief   AF 11 selection
00280   */
00281 #define GPIO_AF11_LCD           ((uint8_t)0x0B)  /* LCD Alternate Function mapping */
00282 #endif /* STM32L433xx || STM32L443xx */
00283 
00284 /**
00285   * @brief   AF 12 selection
00286   */
00287 #define GPIO_AF12_SWPMI1        ((uint8_t)0xC)  /* SWPMI1 Alternate Function mapping  */
00288 #define GPIO_AF12_COMP1         ((uint8_t)0xC)  /* COMP1 Alternate Function mapping   */
00289 #define GPIO_AF12_COMP2         ((uint8_t)0xC)  /* COMP2 Alternate Function mapping   */
00290 #define GPIO_AF12_SDMMC1        ((uint8_t)0xC)  /* SDMMC1 Alternate Function mapping  */
00291 
00292 /**
00293   * @brief   AF 13 selection
00294   */
00295 #define GPIO_AF13_SAI1          ((uint8_t)0x0D)   /* SAI1 Alternate Function mapping */
00296 
00297 /**
00298   * @brief   AF 14 selection
00299   */
00300 #define GPIO_AF14_TIM2          ((uint8_t)0x0E)   /* TIM2 Alternate Function mapping */
00301 #define GPIO_AF14_TIM15         ((uint8_t)0x0E)   /* TIM15 Alternate Function mapping */
00302 #define GPIO_AF14_TIM16         ((uint8_t)0x0E)   /* TIM16 Alternate Function mapping */
00303 #define GPIO_AF14_LPTIM2        ((uint8_t)0x0E)   /* LPTIM2 Alternate Function mapping */
00304 
00305 /**
00306   * @brief   AF 15 selection
00307   */
00308 #define GPIO_AF15_EVENTOUT      ((uint8_t)0x0F)  /* EVENTOUT Alternate Function mapping */
00309 
00310 #define IS_GPIO_AF(AF)   ((AF) <= (uint8_t)0x0F)
00311 
00312 #endif /* STM32L431xx || STM32L432xx || STM32L433xx || STM32L442xx || STM32L443xx */
00313 
00314 /**
00315   * @}
00316   */ 
00317 
00318 /**
00319   * @}
00320   */
00321 
00322 /* Exported macro ------------------------------------------------------------*/
00323 /** @defgroup GPIOEx_Exported_Macros GPIOEx Exported Macros
00324   * @{
00325   */
00326 
00327 /** @defgroup GPIOEx_Get_Port_Index GPIOEx_Get Port Index
00328 * @{
00329   */
00330 #if defined(STM32L431xx) || defined(STM32L433xx) || defined(STM32L443xx)
00331 
00332 #define GPIO_GET_INDEX(__GPIOx__)    (((__GPIOx__) == (GPIOA))? 0U :\
00333                                       ((__GPIOx__) == (GPIOB))? 1U :\
00334                                       ((__GPIOx__) == (GPIOC))? 2U :\
00335                                       ((__GPIOx__) == (GPIOD))? 3U :\
00336                                       ((__GPIOx__) == (GPIOE))? 4U : 7U)
00337 
00338 #endif /* STM32L431xx || STM32L433xx || STM32L443xx */
00339 
00340 #if defined(STM32L432xx) || defined(STM32L442xx)
00341 
00342 #define GPIO_GET_INDEX(__GPIOx__)    (((__GPIOx__) == (GPIOA))? 0U :\
00343                                       ((__GPIOx__) == (GPIOB))? 1U :\
00344                                       ((__GPIOx__) == (GPIOC))? 2U : 7U)
00345 
00346 #endif /* STM32L432xx || STM32L442xx */
00347 
00348 #if defined(STM32L471xx) || defined(STM32L475xx) || defined(STM32L476xx) || defined(STM32L485xx) || defined(STM32L486xx)
00349 
00350 #define GPIO_GET_INDEX(__GPIOx__)    (((__GPIOx__) == (GPIOA))? 0U :\
00351                                       ((__GPIOx__) == (GPIOB))? 1U :\
00352                                       ((__GPIOx__) == (GPIOC))? 2U :\
00353                                       ((__GPIOx__) == (GPIOD))? 3U :\
00354                                       ((__GPIOx__) == (GPIOE))? 4U :\
00355                                       ((__GPIOx__) == (GPIOF))? 5U :\
00356                                       ((__GPIOx__) == (GPIOG))? 6U : 7U)
00357 
00358 #endif /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx */
00359 
00360 /**
00361   * @}
00362   */
00363 
00364 /**
00365   * @}
00366   */
00367 
00368 /* Exported functions --------------------------------------------------------*/ 
00369 /**
00370   * @}
00371   */
00372 
00373 /**
00374   * @}
00375   */
00376 
00377 #ifdef __cplusplus
00378 }
00379 #endif
00380 
00381 #endif /* __STM32L4xx_HAL_GPIO_EX_H */
00382 
00383 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/