]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL/ST_Library/stm32f7xx_hal_gpio.c
Update version number ready for V8.2.1 release.
[freertos] / FreeRTOS / Demo / CORTEX_M7_STM32F7_STM32756G-EVAL / ST_Library / stm32f7xx_hal_gpio.c
1 /**\r
2   ******************************************************************************\r
3   * @file    stm32f7xx_hal_gpio.c\r
4   * @author  MCD Application Team\r
5   * @version V0.3.0\r
6   * @date    06-March-2015\r
7   * @brief   GPIO HAL module driver.\r
8   *          This file provides firmware functions to manage the following \r
9   *          functionalities of the General Purpose Input/Output (GPIO) peripheral:\r
10   *           + Initialization and de-initialization functions\r
11   *           + IO operation functions\r
12   *\r
13   @verbatim\r
14   ==============================================================================\r
15                     ##### GPIO Peripheral features #####\r
16   ==============================================================================\r
17   [..] \r
18   Subject to the specific hardware characteristics of each I/O port listed in the datasheet, each\r
19   port bit of the General Purpose IO (GPIO) Ports, can be individually configured by software\r
20   in several modes:\r
21   (+) Input mode \r
22   (+) Analog mode\r
23   (+) Output mode\r
24   (+) Alternate function mode\r
25   (+) External interrupt/event lines\r
26 \r
27   [..]  \r
28   During and just after reset, the alternate functions and external interrupt  \r
29   lines are not active and the I/O ports are configured in input floating mode.\r
30   \r
31   [..]   \r
32   All GPIO pins have weak internal pull-up and pull-down resistors, which can be \r
33   activated or not.\r
34 \r
35   [..]\r
36   In Output or Alternate mode, each IO can be configured on open-drain or push-pull\r
37   type and the IO speed can be selected depending on the VDD value.\r
38 \r
39   [..]  \r
40   All ports have external interrupt/event capability. To use external interrupt \r
41   lines, the port must be configured in input mode. All available GPIO pins are \r
42   connected to the 16 external interrupt/event lines from EXTI0 to EXTI15.\r
43   \r
44   [..]\r
45   The external interrupt/event controller consists of up to 23 edge detectors \r
46   (16 lines are connected to GPIO) for generating event/interrupt requests (each \r
47   input line can be independently configured to select the type (interrupt or event) \r
48   and the corresponding trigger event (rising or falling or both). Each line can \r
49   also be masked independently. \r
50 \r
51                      ##### How to use this driver #####\r
52   ==============================================================================  \r
53   [..]\r
54     (#) Enable the GPIO AHB clock using the following function: __HAL_RCC_GPIOx_CLK_ENABLE(). \r
55 \r
56     (#) Configure the GPIO pin(s) using HAL_GPIO_Init().\r
57         (++) Configure the IO mode using "Mode" member from GPIO_InitTypeDef structure\r
58         (++) Activate Pull-up, Pull-down resistor using "Pull" member from GPIO_InitTypeDef \r
59              structure.\r
60         (++) In case of Output or alternate function mode selection: the speed is \r
61              configured through "Speed" member from GPIO_InitTypeDef structure.\r
62         (++) In alternate mode is selection, the alternate function connected to the IO\r
63              is configured through "Alternate" member from GPIO_InitTypeDef structure.\r
64         (++) Analog mode is required when a pin is to be used as ADC channel \r
65              or DAC output.\r
66         (++) In case of external interrupt/event selection the "Mode" member from \r
67              GPIO_InitTypeDef structure select the type (interrupt or event) and \r
68              the corresponding trigger event (rising or falling or both).\r
69 \r
70     (#) In case of external interrupt/event mode selection, configure NVIC IRQ priority \r
71         mapped to the EXTI line using HAL_NVIC_SetPriority() and enable it using\r
72         HAL_NVIC_EnableIRQ().\r
73          \r
74     (#) To get the level of a pin configured in input mode use HAL_GPIO_ReadPin().\r
75             \r
76     (#) To set/reset the level of a pin configured in output mode use \r
77         HAL_GPIO_WritePin()/HAL_GPIO_TogglePin().\r
78     \r
79     (#) To lock pin configuration until next reset use HAL_GPIO_LockPin().\r
80 \r
81                  \r
82     (#) During and just after reset, the alternate functions are not \r
83         active and the GPIO pins are configured in input floating mode (except JTAG\r
84         pins).\r
85   \r
86     (#) The LSE oscillator pins OSC32_IN and OSC32_OUT can be used as general purpose \r
87         (PC14 and PC15, respectively) when the LSE oscillator is off. The LSE has \r
88         priority over the GPIO function.\r
89   \r
90     (#) The HSE oscillator pins OSC_IN/OSC_OUT can be used as \r
91         general purpose PH0 and PH1, respectively, when the HSE oscillator is off. \r
92         The HSE has priority over the GPIO function.\r
93   \r
94   @endverbatim\r
95   ******************************************************************************\r
96   * @attention\r
97   *\r
98   * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>\r
99   *\r
100   * Redistribution and use in source and binary forms, with or without modification,\r
101   * are permitted provided that the following conditions are met:\r
102   *   1. Redistributions of source code must retain the above copyright notice,\r
103   *      this list of conditions and the following disclaimer.\r
104   *   2. Redistributions in binary form must reproduce the above copyright notice,\r
105   *      this list of conditions and the following disclaimer in the documentation\r
106   *      and/or other materials provided with the distribution.\r
107   *   3. Neither the name of STMicroelectronics nor the names of its contributors\r
108   *      may be used to endorse or promote products derived from this software\r
109   *      without specific prior written permission.\r
110   *\r
111   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\r
112   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
113   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r
114   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\r
115   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
116   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\r
117   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\r
118   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\r
119   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
120   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
121   *\r
122   ******************************************************************************\r
123   */ \r
124 \r
125 /* Includes ------------------------------------------------------------------*/\r
126 #include "stm32f7xx_hal.h"\r
127 \r
128 /** @addtogroup STM32F7xx_HAL_Driver\r
129   * @{\r
130   */\r
131 \r
132 /** @defgroup GPIO GPIO\r
133   * @brief GPIO HAL module driver\r
134   * @{\r
135   */\r
136 \r
137 #ifdef HAL_GPIO_MODULE_ENABLED\r
138 \r
139 /* Private typedef -----------------------------------------------------------*/\r
140 /* Private define ------------------------------------------------------------*/\r
141 /** @addtogroup GPIO_Private_Constants GPIO Private Constants\r
142   * @{\r
143   */\r
144 #define GPIO_MODE             ((uint32_t)0x00000003)\r
145 #define EXTI_MODE             ((uint32_t)0x10000000)\r
146 #define GPIO_MODE_IT          ((uint32_t)0x00010000)\r
147 #define GPIO_MODE_EVT         ((uint32_t)0x00020000)\r
148 #define RISING_EDGE           ((uint32_t)0x00100000)\r
149 #define FALLING_EDGE          ((uint32_t)0x00200000)\r
150 #define GPIO_OUTPUT_TYPE      ((uint32_t)0x00000010)\r
151 \r
152 #define GPIO_NUMBER           ((uint32_t)16)\r
153 /**\r
154   * @}\r
155   */\r
156 /* Private macro -------------------------------------------------------------*/\r
157 /* Private variables ---------------------------------------------------------*/\r
158 /* Private function prototypes -----------------------------------------------*/\r
159 /* Private functions ---------------------------------------------------------*/\r
160 /* Exported functions --------------------------------------------------------*/\r
161 /** @defgroup GPIO_Exported_Functions GPIO Exported Functions\r
162   * @{\r
163   */\r
164 \r
165 /** @defgroup GPIO_Exported_Functions_Group1 Initialization and de-initialization functions\r
166  *  @brief    Initialization and Configuration functions\r
167  *\r
168 @verbatim\r
169  ===============================================================================\r
170               ##### Initialization and de-initialization functions #####\r
171  ===============================================================================\r
172   [..]\r
173     This section provides functions allowing to initialize and de-initialize the GPIOs\r
174     to be ready for use.\r
175  \r
176 @endverbatim\r
177   * @{\r
178   */\r
179 \r
180 /**\r
181   * @brief  Initializes the GPIOx peripheral according to the specified parameters in the GPIO_Init.\r
182   * @param  GPIOx: where x can be (A..K) to select the GPIO peripheral.\r
183   * @param  GPIO_Init: pointer to a GPIO_InitTypeDef structure that contains\r
184   *         the configuration information for the specified GPIO peripheral.\r
185   * @retval None\r
186   */\r
187 void HAL_GPIO_Init(GPIO_TypeDef  *GPIOx, GPIO_InitTypeDef *GPIO_Init)\r
188 {\r
189   uint32_t position = 0x00;\r
190   uint32_t ioposition = 0x00;\r
191   uint32_t iocurrent = 0x00;\r
192   uint32_t temp = 0x00;\r
193 \r
194   /* Check the parameters */\r
195   assert_param(IS_GPIO_ALL_INSTANCE(GPIOx));\r
196   assert_param(IS_GPIO_PIN(GPIO_Init->Pin));\r
197   assert_param(IS_GPIO_MODE(GPIO_Init->Mode));\r
198   assert_param(IS_GPIO_PULL(GPIO_Init->Pull));\r
199 \r
200   /* Configure the port pins */\r
201   for(position = 0; position < GPIO_NUMBER; position++)\r
202   {\r
203     /* Get the IO position */\r
204     ioposition = ((uint32_t)0x01) << position;\r
205     /* Get the current IO position */\r
206     iocurrent = (uint32_t)(GPIO_Init->Pin) & ioposition;\r
207 \r
208     if(iocurrent == ioposition)\r
209     {\r
210       /*--------------------- GPIO Mode Configuration ------------------------*/\r
211       /* In case of Alternate function mode selection */\r
212       if((GPIO_Init->Mode == GPIO_MODE_AF_PP) || (GPIO_Init->Mode == GPIO_MODE_AF_OD))\r
213       {\r
214         /* Check the Alternate function parameter */\r
215         assert_param(IS_GPIO_AF(GPIO_Init->Alternate));\r
216         \r
217         /* Configure Alternate function mapped with the current IO */\r
218         temp = GPIOx->AFR[position >> 3];\r
219         temp &= ~((uint32_t)0xF << ((uint32_t)(position & (uint32_t)0x07) * 4)) ;\r
220         temp |= ((uint32_t)(GPIO_Init->Alternate) << (((uint32_t)position & (uint32_t)0x07) * 4));\r
221         GPIOx->AFR[position >> 3] = temp;\r
222       }\r
223 \r
224       /* Configure IO Direction mode (Input, Output, Alternate or Analog) */\r
225       temp = GPIOx->MODER;\r
226       temp &= ~(GPIO_MODER_MODER0 << (position * 2));\r
227       temp |= ((GPIO_Init->Mode & GPIO_MODE) << (position * 2));\r
228       GPIOx->MODER = temp;\r
229 \r
230       /* In case of Output or Alternate function mode selection */\r
231       if((GPIO_Init->Mode == GPIO_MODE_OUTPUT_PP) || (GPIO_Init->Mode == GPIO_MODE_AF_PP) ||\r
232          (GPIO_Init->Mode == GPIO_MODE_OUTPUT_OD) || (GPIO_Init->Mode == GPIO_MODE_AF_OD))\r
233       {\r
234         /* Check the Speed parameter */\r
235         assert_param(IS_GPIO_SPEED(GPIO_Init->Speed));\r
236         /* Configure the IO Speed */\r
237         temp = GPIOx->OSPEEDR; \r
238         temp &= ~(GPIO_OSPEEDER_OSPEEDR0 << (position * 2));\r
239         temp |= (GPIO_Init->Speed << (position * 2));\r
240         GPIOx->OSPEEDR = temp;\r
241 \r
242         /* Configure the IO Output Type */\r
243         temp = GPIOx->OTYPER;\r
244         temp &= ~(GPIO_OTYPER_OT_0 << position) ;\r
245         temp |= (((GPIO_Init->Mode & GPIO_OUTPUT_TYPE) >> 4) << position);\r
246         GPIOx->OTYPER = temp;\r
247       }\r
248 \r
249       /* Activate the Pull-up or Pull down resistor for the current IO */\r
250       temp = GPIOx->PUPDR;\r
251       temp &= ~(GPIO_PUPDR_PUPDR0 << (position * 2));\r
252       temp |= ((GPIO_Init->Pull) << (position * 2));\r
253       GPIOx->PUPDR = temp;\r
254 \r
255       /*--------------------- EXTI Mode Configuration ------------------------*/\r
256       /* Configure the External Interrupt or event for the current IO */\r
257       if((GPIO_Init->Mode & EXTI_MODE) == EXTI_MODE)\r
258       {\r
259         /* Enable SYSCFG Clock */\r
260         __HAL_RCC_SYSCFG_CLK_ENABLE();\r
261 \r
262         temp = SYSCFG->EXTICR[position >> 2];\r
263         temp &= ~(((uint32_t)0x0F) << (4 * (position & 0x03)));\r
264         temp |= ((uint32_t)(GPIO_GET_INDEX(GPIOx)) << (4 * (position & 0x03)));\r
265         SYSCFG->EXTICR[position >> 2] = temp;\r
266 \r
267         /* Clear EXTI line configuration */\r
268         temp = EXTI->IMR;\r
269         temp &= ~((uint32_t)iocurrent);\r
270         if((GPIO_Init->Mode & GPIO_MODE_IT) == GPIO_MODE_IT)\r
271         {\r
272           temp |= iocurrent;\r
273         }\r
274         EXTI->IMR = temp;\r
275 \r
276         temp = EXTI->EMR;\r
277         temp &= ~((uint32_t)iocurrent);\r
278         if((GPIO_Init->Mode & GPIO_MODE_EVT) == GPIO_MODE_EVT)\r
279         {\r
280           temp |= iocurrent;\r
281         }\r
282         EXTI->EMR = temp;\r
283 \r
284         /* Clear Rising Falling edge configuration */\r
285         temp = EXTI->RTSR;\r
286         temp &= ~((uint32_t)iocurrent);\r
287         if((GPIO_Init->Mode & RISING_EDGE) == RISING_EDGE)\r
288         {\r
289           temp |= iocurrent;\r
290         }\r
291         EXTI->RTSR = temp;\r
292 \r
293         temp = EXTI->FTSR;\r
294         temp &= ~((uint32_t)iocurrent);\r
295         if((GPIO_Init->Mode & FALLING_EDGE) == FALLING_EDGE)\r
296         {\r
297           temp |= iocurrent;\r
298         }\r
299         EXTI->FTSR = temp;\r
300       }\r
301     }\r
302   }\r
303 }\r
304 \r
305 /**\r
306   * @brief  De-initializes the GPIOx peripheral registers to their default reset values.\r
307   * @param  GPIOx: where x can be (A..K) to select the GPIO peripheral.\r
308   * @param  GPIO_Pin: specifies the port bit to be written.\r
309   *          This parameter can be one of GPIO_PIN_x where x can be (0..15).\r
310   * @retval None\r
311   */\r
312 void HAL_GPIO_DeInit(GPIO_TypeDef  *GPIOx, uint32_t GPIO_Pin)\r
313 {\r
314   uint32_t position;\r
315   uint32_t ioposition = 0x00;\r
316   uint32_t iocurrent = 0x00;\r
317   uint32_t tmp = 0x00;\r
318 \r
319   /* Check the parameters */\r
320   assert_param(IS_GPIO_ALL_INSTANCE(GPIOx));\r
321   \r
322   /* Configure the port pins */\r
323   for(position = 0; position < GPIO_NUMBER; position++)\r
324   {\r
325     /* Get the IO position */\r
326     ioposition = ((uint32_t)0x01) << position;\r
327     /* Get the current IO position */\r
328     iocurrent = (GPIO_Pin) & ioposition;\r
329 \r
330     if(iocurrent == ioposition)\r
331     {\r
332       /*------------------------- GPIO Mode Configuration --------------------*/\r
333       /* Configure IO Direction in Input Floating Mode */\r
334       GPIOx->MODER &= ~(GPIO_MODER_MODER0 << (position * 2));\r
335 \r
336       /* Configure the default Alternate Function in current IO */\r
337       GPIOx->AFR[position >> 3] &= ~((uint32_t)0xF << ((uint32_t)(position & (uint32_t)0x07) * 4)) ;\r
338 \r
339       /* Configure the default value for IO Speed */\r
340       GPIOx->OSPEEDR &= ~(GPIO_OSPEEDER_OSPEEDR0 << (position * 2));\r
341 \r
342       /* Configure the default value IO Output Type */\r
343       GPIOx->OTYPER  &= ~(GPIO_OTYPER_OT_0 << position) ;\r
344 \r
345       /* Deactivate the Pull-up and Pull-down resistor for the current IO */\r
346       GPIOx->PUPDR &= ~(GPIO_PUPDR_PUPDR0 << (position * 2));\r
347 \r
348       /*------------------------- EXTI Mode Configuration --------------------*/\r
349       tmp = SYSCFG->EXTICR[position >> 2];\r
350       tmp &= (((uint32_t)0x0F) << (4 * (position & 0x03)));\r
351       if(tmp == ((uint32_t)(GET_GPIO_SOURCE(GPIOx)) << (4 * (position & 0x03))))\r
352       {\r
353         /* Configure the External Interrupt or event for the current IO */\r
354         tmp = ((uint32_t)0x0F) << (4 * (position & 0x03));\r
355         SYSCFG->EXTICR[position >> 2] &= ~tmp;\r
356 \r
357         /* Clear EXTI line configuration */\r
358         EXTI->IMR &= ~((uint32_t)iocurrent);\r
359         EXTI->EMR &= ~((uint32_t)iocurrent);\r
360 \r
361         /* Clear Rising Falling edge configuration */\r
362         EXTI->RTSR &= ~((uint32_t)iocurrent);\r
363         EXTI->FTSR &= ~((uint32_t)iocurrent);\r
364           }\r
365     }\r
366   }\r
367 }\r
368 \r
369 /**\r
370   * @}\r
371   */\r
372 \r
373 /** @defgroup GPIO_Exported_Functions_Group2 IO operation functions \r
374  *  @brief   GPIO Read and Write\r
375  *\r
376 @verbatim\r
377  ===============================================================================\r
378                        ##### IO operation functions #####\r
379  ===============================================================================\r
380 \r
381 @endverbatim\r
382   * @{\r
383   */\r
384 \r
385 /**\r
386   * @brief  Reads the specified input port pin.\r
387   * @param  GPIOx: where x can be (A..K) to select the GPIO peripheral.\r
388   * @param  GPIO_Pin: specifies the port bit to read.\r
389   *         This parameter can be GPIO_PIN_x where x can be (0..15).\r
390   * @retval The input port pin value.\r
391   */\r
392 GPIO_PinState HAL_GPIO_ReadPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)\r
393 {\r
394   GPIO_PinState bitstatus;\r
395 \r
396   /* Check the parameters */\r
397   assert_param(IS_GPIO_PIN(GPIO_Pin));\r
398 \r
399   if((GPIOx->IDR & GPIO_Pin) != (uint32_t)GPIO_PIN_RESET)\r
400   {\r
401     bitstatus = GPIO_PIN_SET;\r
402   }\r
403   else\r
404   {\r
405     bitstatus = GPIO_PIN_RESET;\r
406   }\r
407   return bitstatus;\r
408 }\r
409 \r
410 /**\r
411   * @brief  Sets or clears the selected data port bit.\r
412   *\r
413   * @note   This function uses GPIOx_BSRR register to allow atomic read/modify\r
414   *         accesses. In this way, there is no risk of an IRQ occurring between\r
415   *         the read and the modify access.\r
416   *\r
417   * @param  GPIOx: where x can be (A..K) to select the GPIO peripheral.\r
418   * @param  GPIO_Pin: specifies the port bit to be written.\r
419   *          This parameter can be one of GPIO_PIN_x where x can be (0..15).\r
420   * @param  PinState: specifies the value to be written to the selected bit.\r
421   *          This parameter can be one of the GPIO_PinState enum values:\r
422   *            @arg GPIO_PIN_RESET: to clear the port pin\r
423   *            @arg GPIO_PIN_SET: to set the port pin\r
424   * @retval None\r
425   */\r
426 void HAL_GPIO_WritePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState)\r
427 {\r
428   /* Check the parameters */\r
429   assert_param(IS_GPIO_PIN(GPIO_Pin));\r
430   assert_param(IS_GPIO_PIN_ACTION(PinState));\r
431 \r
432   if(PinState != GPIO_PIN_RESET)\r
433   {\r
434     GPIOx->BSRR = GPIO_Pin;\r
435   }\r
436   else\r
437   {\r
438     GPIOx->BSRR = (uint32_t)GPIO_Pin << 16;\r
439   }\r
440 }\r
441 \r
442 /**\r
443   * @brief  Toggles the specified GPIO pins.\r
444   * @param  GPIOx: Where x can be (A..I) to select the GPIO peripheral.\r
445   * @param  GPIO_Pin: Specifies the pins to be toggled.\r
446   * @retval None\r
447   */\r
448 void HAL_GPIO_TogglePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)\r
449 {\r
450   /* Check the parameters */\r
451   assert_param(IS_GPIO_PIN(GPIO_Pin));\r
452 \r
453   GPIOx->ODR ^= GPIO_Pin;\r
454 }\r
455 \r
456 /**\r
457   * @brief  Locks GPIO Pins configuration registers.\r
458   * @note   The locked registers are GPIOx_MODER, GPIOx_OTYPER, GPIOx_OSPEEDR,\r
459   *         GPIOx_PUPDR, GPIOx_AFRL and GPIOx_AFRH.\r
460   * @note   The configuration of the locked GPIO pins can no longer be modified\r
461   *         until the next reset.\r
462   * @param  GPIOx: where x can be (A..F) to select the GPIO peripheral for STM32F7 family\r
463   * @param  GPIO_Pin: specifies the port bit to be locked.\r
464   *         This parameter can be any combination of GPIO_PIN_x where x can be (0..15).\r
465   * @retval None\r
466   */\r
467 HAL_StatusTypeDef HAL_GPIO_LockPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)\r
468 {\r
469   __IO uint32_t tmp = GPIO_LCKR_LCKK;\r
470 \r
471   /* Check the parameters */\r
472   assert_param(IS_GPIO_PIN(GPIO_Pin));\r
473 \r
474   /* Apply lock key write sequence */\r
475   tmp |= GPIO_Pin;\r
476   /* Set LCKx bit(s): LCKK='1' + LCK[15-0] */\r
477   GPIOx->LCKR = tmp;\r
478   /* Reset LCKx bit(s): LCKK='0' + LCK[15-0] */\r
479   GPIOx->LCKR = GPIO_Pin;\r
480   /* Set LCKx bit(s): LCKK='1' + LCK[15-0] */\r
481   GPIOx->LCKR = tmp;\r
482   /* Read LCKK bit*/\r
483   tmp = GPIOx->LCKR;\r
484 \r
485  if((GPIOx->LCKR & GPIO_LCKR_LCKK) != RESET)\r
486   {\r
487     return HAL_OK;\r
488   }\r
489   else\r
490   {\r
491     return HAL_ERROR;\r
492   }\r
493 }\r
494 \r
495 /**\r
496   * @brief  This function handles EXTI interrupt request.\r
497   * @param  GPIO_Pin: Specifies the pins connected EXTI line\r
498   * @retval None\r
499   */\r
500 void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin)\r
501 {\r
502   /* EXTI line interrupt detected */\r
503   if(__HAL_GPIO_EXTI_GET_IT(GPIO_Pin) != RESET)\r
504   {\r
505     __HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin);\r
506     HAL_GPIO_EXTI_Callback(GPIO_Pin);\r
507   }\r
508 }\r
509 \r
510 /**\r
511   * @brief  EXTI line detection callbacks.\r
512   * @param  GPIO_Pin: Specifies the pins connected EXTI line\r
513   * @retval None\r
514   */\r
515 __weak void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)\r
516 {\r
517   /* NOTE: This function Should not be modified, when the callback is needed,\r
518            the HAL_GPIO_EXTI_Callback could be implemented in the user file\r
519    */\r
520 }\r
521 \r
522 /**\r
523   * @}\r
524   */\r
525 \r
526 \r
527 /**\r
528   * @}\r
529   */\r
530 \r
531 #endif /* HAL_GPIO_MODULE_ENABLED */\r
532 /**\r
533   * @}\r
534   */\r
535 \r
536 /**\r
537   * @}\r
538   */\r
539 \r
540 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r