]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32L1/stm32l1xx_hal_gpio_ex.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_STM / TARGET_STM32L1 / stm32l1xx_hal_gpio_ex.h
1 /**
2   ******************************************************************************
3   * @file    stm32l1xx_hal_gpio_ex.h
4   * @author  MCD Application Team
5   * @version V1.0.0
6   * @date    5-September-2014
7   * @brief   Header file of GPIO HAL Extension module.
8   ******************************************************************************
9   * @attention
10   *
11   * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
12   *
13   * Redistribution and use in source and binary forms, with or without modification,
14   * are permitted provided that the following conditions are met:
15   *   1. Redistributions of source code must retain the above copyright notice,
16   *      this list of conditions and the following disclaimer.
17   *   2. Redistributions in binary form must reproduce the above copyright notice,
18   *      this list of conditions and the following disclaimer in the documentation
19   *      and/or other materials provided with the distribution.
20   *   3. Neither the name of STMicroelectronics nor the names of its contributors
21   *      may be used to endorse or promote products derived from this software
22   *      without specific prior written permission.
23   *
24   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34   *
35   ******************************************************************************
36   */ 
37
38 /* Define to prevent recursive inclusion -------------------------------------*/
39 #ifndef __STM32L1xx_HAL_GPIO_EX_H
40 #define __STM32L1xx_HAL_GPIO_EX_H
41
42 #ifdef __cplusplus
43  extern "C" {
44 #endif
45
46 /* Includes ------------------------------------------------------------------*/
47 #include "stm32l1xx_hal_def.h"
48
49 /** @addtogroup STM32L1xx_HAL_Driver
50   * @{
51   */
52
53 /** @defgroup GPIOEx GPIOEx
54   * @{
55   */ 
56
57 /* Exported types ------------------------------------------------------------*/
58
59 /* Exported constants --------------------------------------------------------*/
60
61 /** @defgroup GPIOEx_Exported_Constants GPIOEx Exported Constants
62   * @{
63   */ 
64   
65 /** @defgroup GPIOEx_Alternate_function_selection GPIOEx Alternate function selection 
66   * @{
67   */
68   
69 /** 
70   * @brief   AF 0 selection  
71   */ 
72 #define GPIO_AF0_MCO           ((uint8_t)0x00)  /* MCO Alternate Function mapping                 */
73 #define GPIO_AF0_TAMPER        ((uint8_t)0x00)  /* TAMPER  Alternate Function mapping             */
74 #define GPIO_AF0_SWJ           ((uint8_t)0x00)  /* SWJ (SWD and JTAG) Alternate Function mapping  */
75 #define GPIO_AF0_TRACE         ((uint8_t)0x00)  /* TRACE Alternate Function mapping               */
76 #define GPIO_AF0_RTC_50Hz      ((uint8_t)0x00)  /* RTC_OUT Alternate Function mapping             */
77    
78 /** 
79   * @brief   AF 1 selection  
80   */ 
81 #define GPIO_AF1_TIM2           ((uint8_t)0x01)  /* TIM2 Alternate Function mapping */
82
83 /** 
84   * @brief   AF 2 selection  
85   */ 
86 #define GPIO_AF2_TIM3           ((uint8_t)0x02)  /* TIM3 Alternate Function mapping */
87 #define GPIO_AF2_TIM4           ((uint8_t)0x02)  /* TIM4 Alternate Function mapping */
88 #if defined (STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined (STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE) || defined (STM32L162xC) || defined (STM32L152xC) || defined (STM32L151xC)
89 #define GPIO_AF2_TIM5           ((uint8_t)0x02)  /* TIM5 Alternate Function mapping */
90
91 #endif /*  STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD ...STM32L151xC */ 
92
93 /** 
94   * @brief   AF 3 selection  
95   */ 
96 #define GPIO_AF3_TIM9            ((uint8_t)0x03)  /* TIM9 Alternate Function mapping */
97 #define GPIO_AF3_TIM10           ((uint8_t)0x03)  /* TIM10 Alternate Function mapping */
98 #define GPIO_AF3_TIM11           ((uint8_t)0x03)  /* TIM11 Alternate Function mapping */
99
100
101 /** 
102   * @brief   AF 4 selection  
103   */ 
104 #define GPIO_AF4_I2C1          ((uint8_t)0x04)  /* I2C1 Alternate Function mapping */
105 #define GPIO_AF4_I2C2          ((uint8_t)0x04)  /* I2C2 Alternate Function mapping */
106
107 /** 
108   * @brief   AF 5 selection  
109   */ 
110 #define GPIO_AF5_SPI1          ((uint8_t)0x05)  /* SPI1/I2S1 Alternate Function mapping      */
111 #define GPIO_AF5_SPI2          ((uint8_t)0x05)  /* SPI2/I2S2 Alternate Function mapping */
112
113 /** 
114   * @brief   AF 6 selection  
115   */ 
116 #if defined (STM32L100xC) || defined (STM32L151xC) || defined (STM32L151xCA) || defined (STM32L151xD) || defined (STM32L151xE) ||\
117     defined (STM32L152xC) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L152xE) ||\
118     defined (STM32L162xC) || defined (STM32L162xCA) || defined (STM32L162xD) || defined (STM32L162xE)
119     
120 #define GPIO_AF6_SPI3          ((uint8_t)0x06)  /* SPI3/I2S3 Alternate Function mapping */
121
122 #endif /* STM32L100xC || STM32L151xC || (...) || STM32L162xD || STM32L162xE */
123
124
125 /** 
126   * @brief   AF 7 selection  
127   */ 
128 #define GPIO_AF7_USART1        ((uint8_t)0x07)  /* USART1 Alternate Function mapping  */
129 #define GPIO_AF7_USART2        ((uint8_t)0x07)  /* USART2 Alternate Function mapping  */
130 #define GPIO_AF7_USART3        ((uint8_t)0x07)  /* USART3 Alternate Function mapping  */
131
132 /** 
133   * @brief   AF 8 selection  
134   */ 
135 #if defined (STM32L151xD) || defined (STM32L151xE) ||\
136     defined (STM32L152xD) || defined (STM32L152xE) ||\
137     defined (STM32L162xD) || defined (STM32L162xE)
138    
139 #define GPIO_AF8_UART4        ((uint8_t)0x08)  /* UART4 Alternate Function mapping  */
140 #define GPIO_AF8_UART5        ((uint8_t)0x08)  /* UART5 Alternate Function mapping  */
141
142 #endif /* STM32L151xD || STM32L151xE || STM32L152xD || STM32L 152xE || STM32L162xD || STM32L162xE */
143
144
145 /** 
146   * @brief   AF 9 selection 
147   */ 
148
149 /** 
150   * @brief   AF 10 selection  
151   */ 
152
153 /** 
154   * @brief   AF 11 selection  
155   */ 
156 #if defined (STM32L100xB) || defined (STM32L100xBA) || defined (STM32L100xC) ||\
157     defined (STM32L152xB) || defined (STM32L152xBA) || defined (STM32L152xC) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L152xE) ||\
158     defined (STM32L162xC) || defined (STM32L162xCA) || defined (STM32L162xD) || defined (STM32L162xE)
159
160 #define GPIO_AF11_LCD            ((uint8_t)0x0B)  /* LCD Alternate Function mapping */
161
162 #endif /* STM32L100xB || STM32L100xBA || STM32L100xC || (...) || STM32L162xCA || STM32L162xD || STM32L162xE */
163
164 /** 
165   * @brief   AF 12 selection  
166   */ 
167 #if defined (STM32L151xD) || defined (STM32L152xD) || defined (STM32L162xD)
168     
169 #define GPIO_AF12_FSMC            ((uint8_t)0x0C)  /* FSMC Alternate Function mapping */
170 #define GPIO_AF12_SDIO            ((uint8_t)0x0C)  /* SDIO Alternate Function mapping */
171
172 #endif /* STM32L151xD || STM32L152xD || STM32L162xD */
173 /** 
174   * @brief   AF 13 selection  
175   */ 
176
177 /** 
178   * @brief   AF 14 selection  
179   */ 
180 #define GPIO_AF14_TIM_IC1         ((uint8_t)0x0E)  /* TIMER INPUT CAPTURE Alternate Function mapping */
181 #define GPIO_AF14_TIM_IC2         ((uint8_t)0x0E)  /* TIMER INPUT CAPTURE Alternate Function mapping */
182 #define GPIO_AF14_TIM_IC3         ((uint8_t)0x0E)  /* TIMER INPUT CAPTURE Alternate Function mapping */
183 #define GPIO_AF14_TIM_IC4         ((uint8_t)0x0E)  /* TIMER INPUT CAPTURE Alternate Function mapping */
184
185 /** 
186   * @brief   AF 15 selection  
187   */ 
188 #define GPIO_AF15_EVENTOUT      ((uint8_t)0x0F)  /* EVENTOUT Alternate Function mapping */
189
190 /**
191   * @}
192   */ 
193
194 /**
195   * @}
196   */
197
198 /** @defgroup GPIOEx_Private_Macros GPIOEx Private Macros
199   * @{
200   */
201
202
203 #define IS_GPIO_AF(AF)   ((AF) <= (uint8_t)0x0F)
204
205
206 #if defined (STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined (STM32L151xE) || defined (STM32L152xE) || defined (STM32L162xE)
207 #define GET_GPIO_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
208                                    ((__GPIOx__) == (GPIOB))? 1U :\
209                                    ((__GPIOx__) == (GPIOC))? 2U :\
210                                    ((__GPIOx__) == (GPIOD))? 3U :\
211                                    ((__GPIOx__) == (GPIOE))? 4U :\
212                                    ((__GPIOx__) == (GPIOF))? 5U :\
213                                    ((__GPIOx__) == (GPIOG))? 6U :\
214                                    ((__GPIOx__) == (GPIOH))? 7U : 8U)
215 #endif 
216
217 #if defined (STM32L151xB) || defined (STM32L151xBA) || defined (STM32L151xC) || defined (STM32L152xB) || defined (STM32L152xBA) || defined (STM32L152xC) || defined (STM32L162xC)
218 #define GET_GPIO_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
219                                    ((__GPIOx__) == (GPIOB))? 1U :\
220                                    ((__GPIOx__) == (GPIOC))? 2U :\
221                                    ((__GPIOx__) == (GPIOD))? 3U :\
222                                    ((__GPIOx__) == (GPIOE))? 4U :\
223                                    ((__GPIOx__) == (GPIOH))? 7U : 8U)
224 #endif 
225
226 #if defined (STM32L100xB) || defined (STM32L100xBA) || defined (STM32L100xC)
227 #define GET_GPIO_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
228                                    ((__GPIOx__) == (GPIOB))? 1U :\
229                                    ((__GPIOx__) == (GPIOC))? 2U :\
230                                    ((__GPIOx__) == (GPIOD))? 3U :\
231                                    ((__GPIOx__) == (GPIOH))? 7U : 8U)
232 #endif 
233
234
235
236 /**
237   * @}
238   */
239
240
241
242 /* Exported macro ------------------------------------------------------------*/
243 /* Exported functions --------------------------------------------------------*/ 
244
245
246 /**
247   * @}
248   */ 
249
250 /**
251   * @}
252   */ 
253   
254 #ifdef __cplusplus
255 }
256 #endif
257
258 #endif /* __STM32L1xx_HAL_GPIO_EX_H */
259
260 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/