Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | mjames | 1 | /** |
2 | ****************************************************************************** |
||
3 | * @file stm32l1xx_hal_gpio_ex.h |
||
4 | * @author MCD Application Team |
||
5 | * @brief Header file of GPIO HAL Extension module. |
||
6 | ****************************************************************************** |
||
7 | * @attention |
||
8 | * |
||
28 | mjames | 9 | * <h2><center>© Copyright (c) 2017 STMicroelectronics. |
10 | * All rights reserved.</center></h2> |
||
2 | mjames | 11 | * |
28 | mjames | 12 | * This software component is licensed by ST under BSD 3-Clause license, |
13 | * the "License"; You may not use this file except in compliance with the |
||
14 | * License. You may obtain a copy of the License at: |
||
15 | * opensource.org/licenses/BSD-3-Clause |
||
2 | mjames | 16 | * |
17 | ****************************************************************************** |
||
28 | mjames | 18 | */ |
2 | mjames | 19 | |
20 | /* Define to prevent recursive inclusion -------------------------------------*/ |
||
21 | #ifndef __STM32L1xx_HAL_GPIO_EX_H |
||
22 | #define __STM32L1xx_HAL_GPIO_EX_H |
||
23 | |||
24 | #ifdef __cplusplus |
||
28 | mjames | 25 | extern "C" { |
2 | mjames | 26 | #endif |
27 | |||
28 | /* Includes ------------------------------------------------------------------*/ |
||
29 | #include "stm32l1xx_hal_def.h" |
||
30 | |||
31 | /** @addtogroup STM32L1xx_HAL_Driver |
||
32 | * @{ |
||
33 | */ |
||
34 | |||
35 | /** @defgroup GPIOEx GPIOEx |
||
36 | * @{ |
||
28 | mjames | 37 | */ |
2 | mjames | 38 | |
39 | /* Exported types ------------------------------------------------------------*/ |
||
40 | /* Exported constants --------------------------------------------------------*/ |
||
41 | /** @defgroup GPIOEx_Exported_Constants GPIOEx Exported Constants |
||
42 | * @{ |
||
28 | mjames | 43 | */ |
44 | |||
2 | mjames | 45 | /** @defgroup GPIOEx_Alternate_function_selection GPIOEx Alternate function selection |
46 | * @{ |
||
47 | */ |
||
28 | mjames | 48 | |
49 | /* AF 0 selection */ |
||
2 | mjames | 50 | #define GPIO_AF0_MCO ((uint8_t)0x00) /*!< MCO Alternate Function mapping */ |
51 | #define GPIO_AF0_TAMPER ((uint8_t)0x00) /*!< TAMPER Alternate Function mapping */ |
||
52 | #define GPIO_AF0_SWJ ((uint8_t)0x00) /*!< SWJ (SWD and JTAG) Alternate Function mapping */ |
||
53 | #define GPIO_AF0_TRACE ((uint8_t)0x00) /*!< TRACE Alternate Function mapping */ |
||
54 | #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /*!< RTC_OUT Alternate Function mapping */ |
||
28 | mjames | 55 | |
56 | /* AF 1 selection */ |
||
2 | mjames | 57 | #define GPIO_AF1_TIM2 ((uint8_t)0x01) /*!< TIM2 Alternate Function mapping */ |
58 | |||
28 | mjames | 59 | /* AF 2 selection */ |
2 | mjames | 60 | #define GPIO_AF2_TIM3 ((uint8_t)0x02) /*!< TIM3 Alternate Function mapping */ |
61 | #define GPIO_AF2_TIM4 ((uint8_t)0x02) /*!< TIM4 Alternate Function mapping */ |
||
62 | #if defined (STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined (STM32L151xE) || defined (STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) || defined (STM32L162xC) || defined (STM32L152xC) || defined (STM32L151xC) |
||
63 | #define GPIO_AF2_TIM5 ((uint8_t)0x02) /*!< TIM5 Alternate Function mapping */ |
||
64 | |||
28 | mjames | 65 | #endif /* STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD ...STM32L151xC */ |
2 | mjames | 66 | |
28 | mjames | 67 | /* AF 3 selection */ |
2 | mjames | 68 | #define GPIO_AF3_TIM9 ((uint8_t)0x03) /*!< TIM9 Alternate Function mapping */ |
69 | #define GPIO_AF3_TIM10 ((uint8_t)0x03) /*!< TIM10 Alternate Function mapping */ |
||
70 | #define GPIO_AF3_TIM11 ((uint8_t)0x03) /*!< TIM11 Alternate Function mapping */ |
||
71 | |||
72 | |||
28 | mjames | 73 | /* AF 4 selection */ |
2 | mjames | 74 | #define GPIO_AF4_I2C1 ((uint8_t)0x04) /*!< I2C1 Alternate Function mapping */ |
75 | #define GPIO_AF4_I2C2 ((uint8_t)0x04) /*!< I2C2 Alternate Function mapping */ |
||
76 | |||
28 | mjames | 77 | /* AF 5 selection */ |
2 | mjames | 78 | #define GPIO_AF5_SPI1 ((uint8_t)0x05) /*!< SPI1/I2S1 Alternate Function mapping */ |
79 | #define GPIO_AF5_SPI2 ((uint8_t)0x05) /*!< SPI2/I2S2 Alternate Function mapping */ |
||
80 | |||
28 | mjames | 81 | /* AF 6 selection */ |
2 | mjames | 82 | #if defined (STM32L100xC) || defined (STM32L151xC) || defined (STM32L151xCA) || defined (STM32L151xD) || defined (STM32L151xE) || defined (STM32L151xDX) ||\ |
83 | defined (STM32L152xC) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L152xE) || defined (STM32L152xDX) ||\ |
||
84 | defined (STM32L162xC) || defined (STM32L162xCA) || defined (STM32L162xD) || defined (STM32L162xE) || defined (STM32L162xDX) |
||
28 | mjames | 85 | |
2 | mjames | 86 | #define GPIO_AF6_SPI3 ((uint8_t)0x06) /*!< SPI3/I2S3 Alternate Function mapping */ |
87 | |||
88 | #endif /* STM32L100xC || STM32L151xC || (...) || STM32L162xD || STM32L162xE || STM32L162xDX */ |
||
89 | |||
90 | |||
28 | mjames | 91 | /* AF 7 selection */ |
2 | mjames | 92 | #define GPIO_AF7_USART1 ((uint8_t)0x07) /*!< USART1 Alternate Function mapping */ |
93 | #define GPIO_AF7_USART2 ((uint8_t)0x07) /*!< USART2 Alternate Function mapping */ |
||
94 | #define GPIO_AF7_USART3 ((uint8_t)0x07) /*!< USART3 Alternate Function mapping */ |
||
95 | |||
28 | mjames | 96 | /* AF 8 selection */ |
2 | mjames | 97 | #if defined (STM32L151xD) || defined (STM32L151xE) || defined (STM32L151xDX) ||\ |
98 | defined (STM32L152xD) || defined (STM32L152xE) || defined (STM32L152xDX) ||\ |
||
99 | defined (STM32L162xD) || defined (STM32L162xE) || defined (STM32L162xDX) |
||
28 | mjames | 100 | |
2 | mjames | 101 | #define GPIO_AF8_UART4 ((uint8_t)0x08) /*!< UART4 Alternate Function mapping */ |
102 | #define GPIO_AF8_UART5 ((uint8_t)0x08) /*!< UART5 Alternate Function mapping */ |
||
103 | |||
104 | #endif /* STM32L151xD || STM32L151xE || STM32L151xDX || STM32L152xD || STM32L 152xE || STM32L162xD || STM32L162xE || STM32L162xDX */ |
||
105 | |||
106 | |||
28 | mjames | 107 | /* AF 9 selection */ |
2 | mjames | 108 | |
28 | mjames | 109 | /* AF 10 selection */ |
2 | mjames | 110 | |
28 | mjames | 111 | /* AF 11 selection */ |
2 | mjames | 112 | #if defined (STM32L100xB) || defined (STM32L100xBA) || defined (STM32L100xC) ||\ |
113 | defined (STM32L152xB) || defined (STM32L152xBA) || defined (STM32L152xC) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L152xE) || defined (STM32L152xDX) ||\ |
||
114 | defined (STM32L162xC) || defined (STM32L162xCA) || defined (STM32L162xD) || defined (STM32L162xE) || defined (STM32L162xDX) |
||
115 | |||
116 | #define GPIO_AF11_LCD ((uint8_t)0x0B) /*!< LCD Alternate Function mapping */ |
||
117 | |||
118 | #endif /* STM32L100xB || STM32L100xBA || STM32L100xC || (...) || STM32L162xCA || STM32L162xD || STM32L162xE || STM32L162xDX */ |
||
119 | |||
28 | mjames | 120 | /* AF 12 selection */ |
2 | mjames | 121 | #if defined (STM32L151xD) || defined (STM32L152xD) || defined (STM32L162xD) |
28 | mjames | 122 | |
2 | mjames | 123 | #define GPIO_AF12_FSMC ((uint8_t)0x0C) /*!< FSMC Alternate Function mapping */ |
124 | #define GPIO_AF12_SDIO ((uint8_t)0x0C) /*!< SDIO Alternate Function mapping */ |
||
125 | |||
126 | #endif /* STM32L151xD || STM32L152xD || STM32L162xD */ |
||
28 | mjames | 127 | /* AF 13 selection */ |
2 | mjames | 128 | |
28 | mjames | 129 | /* AF 14 selection */ |
2 | mjames | 130 | #define GPIO_AF14_TIM_IC1 ((uint8_t)0x0E) /*!< TIMER INPUT CAPTURE Alternate Function mapping */ |
131 | #define GPIO_AF14_TIM_IC2 ((uint8_t)0x0E) /*!< TIMER INPUT CAPTURE Alternate Function mapping */ |
||
132 | #define GPIO_AF14_TIM_IC3 ((uint8_t)0x0E) /*!< TIMER INPUT CAPTURE Alternate Function mapping */ |
||
133 | #define GPIO_AF14_TIM_IC4 ((uint8_t)0x0E) /*!< TIMER INPUT CAPTURE Alternate Function mapping */ |
||
134 | |||
28 | mjames | 135 | /* AF 15 selection */ |
2 | mjames | 136 | #define GPIO_AF15_EVENTOUT ((uint8_t)0x0F) /*!< EVENTOUT Alternate Function mapping */ |
137 | |||
138 | /** |
||
139 | * @} |
||
28 | mjames | 140 | */ |
2 | mjames | 141 | |
142 | /** |
||
143 | * @} |
||
144 | */ |
||
145 | |||
146 | /** @defgroup GPIOEx_Private_Macros GPIOEx Private Macros |
||
147 | * @{ |
||
148 | */ |
||
149 | |||
150 | |||
151 | #define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x0F) |
||
152 | |||
153 | |||
154 | #if defined (STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined (STM32L151xE) || defined (STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX) |
||
155 | #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\ |
||
156 | ((__GPIOx__) == (GPIOB))? 1U :\ |
||
157 | ((__GPIOx__) == (GPIOC))? 2U :\ |
||
158 | ((__GPIOx__) == (GPIOD))? 3U :\ |
||
159 | ((__GPIOx__) == (GPIOE))? 4U :\ |
||
160 | ((__GPIOx__) == (GPIOH))? 5U :\ |
||
161 | ((__GPIOx__) == (GPIOF))? 6U : 7U) |
||
28 | mjames | 162 | #endif |
2 | mjames | 163 | |
164 | #if defined (STM32L151xB) || defined (STM32L151xBA) || defined (STM32L151xC) || defined (STM32L152xB) || defined (STM32L152xBA) || defined (STM32L152xC) || defined (STM32L162xC) |
||
165 | #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\ |
||
166 | ((__GPIOx__) == (GPIOB))? 1U :\ |
||
167 | ((__GPIOx__) == (GPIOC))? 2U :\ |
||
168 | ((__GPIOx__) == (GPIOD))? 3U :\ |
||
169 | ((__GPIOx__) == (GPIOE))? 4U : 5U) |
||
28 | mjames | 170 | #endif |
2 | mjames | 171 | |
172 | #if defined (STM32L100xB) || defined (STM32L100xBA) || defined (STM32L100xC) |
||
173 | #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\ |
||
174 | ((__GPIOx__) == (GPIOB))? 1U :\ |
||
175 | ((__GPIOx__) == (GPIOC))? 2U :\ |
||
176 | ((__GPIOx__) == (GPIOD))? 3U : 5U) |
||
28 | mjames | 177 | #endif |
2 | mjames | 178 | |
179 | |||
180 | |||
181 | /** |
||
182 | * @} |
||
183 | */ |
||
184 | |||
185 | |||
186 | |||
187 | /* Exported macro ------------------------------------------------------------*/ |
||
28 | mjames | 188 | /* Exported functions --------------------------------------------------------*/ |
2 | mjames | 189 | |
190 | |||
191 | /** |
||
192 | * @} |
||
28 | mjames | 193 | */ |
2 | mjames | 194 | |
195 | /** |
||
196 | * @} |
||
28 | mjames | 197 | */ |
198 | |||
2 | mjames | 199 | #ifdef __cplusplus |
200 | } |
||
201 | #endif |
||
202 | |||
203 | #endif /* __STM32L1xx_HAL_GPIO_EX_H */ |
||
204 | |||
205 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |