STM32F103xB HAL User Manual
stm32f1xx_hal_gpio.c
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32f1xx_hal_gpio.c
00004   * @author  MCD Application Team
00005   * @brief   GPIO HAL module driver.
00006   *          This file provides firmware functions to manage the following
00007   *          functionalities of the General Purpose Input/Output (GPIO) peripheral:
00008   *           + Initialization and de-initialization functions
00009   *           + IO operation functions
00010   *
00011   @verbatim
00012   ==============================================================================
00013                     ##### GPIO Peripheral features #####
00014   ==============================================================================
00015   [..]
00016   Subject to the specific hardware characteristics of each I/O port listed in the datasheet, each
00017   port bit of the General Purpose IO (GPIO) Ports, can be individually configured by software
00018   in several modes:
00019   (+) Input mode
00020   (+) Analog mode
00021   (+) Output mode
00022   (+) Alternate function mode
00023   (+) External interrupt/event lines
00024 
00025   [..]
00026   During and just after reset, the alternate functions and external interrupt
00027   lines are not active and the I/O ports are configured in input floating mode.
00028 
00029   [..]
00030   All GPIO pins have weak internal pull-up and pull-down resistors, which can be
00031   activated or not.
00032 
00033   [..]
00034   In Output or Alternate mode, each IO can be configured on open-drain or push-pull
00035   type and the IO speed can be selected depending on the VDD value.
00036 
00037   [..]
00038   All ports have external interrupt/event capability. To use external interrupt
00039   lines, the port must be configured in input mode. All available GPIO pins are
00040   connected to the 16 external interrupt/event lines from EXTI0 to EXTI15.
00041 
00042   [..]
00043   The external interrupt/event controller consists of up to 20 edge detectors in connectivity
00044   line devices, or 19 edge detectors in other devices for generating event/interrupt requests.
00045   Each input line can be independently configured to select the type (event or interrupt) and
00046   the corresponding trigger event (rising or falling or both). Each line can also masked
00047   independently. A pending register maintains the status line of the interrupt requests
00048 
00049                      ##### How to use this driver #####
00050   ==============================================================================
00051  [..]
00052    (#) Enable the GPIO APB2 clock using the following function : __HAL_RCC_GPIOx_CLK_ENABLE().
00053 
00054    (#) Configure the GPIO pin(s) using HAL_GPIO_Init().
00055        (++) Configure the IO mode using "Mode" member from GPIO_InitTypeDef structure
00056        (++) Activate Pull-up, Pull-down resistor using "Pull" member from GPIO_InitTypeDef
00057             structure.
00058        (++) In case of Output or alternate function mode selection: the speed is
00059             configured through "Speed" member from GPIO_InitTypeDef structure
00060        (++) Analog mode is required when a pin is to be used as ADC channel
00061             or DAC output.
00062        (++) In case of external interrupt/event selection the "Mode" member from
00063             GPIO_InitTypeDef structure select the type (interrupt or event) and
00064             the corresponding trigger event (rising or falling or both).
00065 
00066    (#) In case of external interrupt/event mode selection, configure NVIC IRQ priority
00067        mapped to the EXTI line using HAL_NVIC_SetPriority() and enable it using
00068        HAL_NVIC_EnableIRQ().
00069 
00070    (#) To get the level of a pin configured in input mode use HAL_GPIO_ReadPin().
00071 
00072    (#) To set/reset the level of a pin configured in output mode use
00073        HAL_GPIO_WritePin()/HAL_GPIO_TogglePin().
00074 
00075    (#) To lock pin configuration until next reset use HAL_GPIO_LockPin().
00076 
00077    (#) During and just after reset, the alternate functions are not
00078        active and the GPIO pins are configured in input floating mode (except JTAG
00079        pins).
00080 
00081    (#) The LSE oscillator pins OSC32_IN and OSC32_OUT can be used as general purpose
00082        (PC14 and PC15, respectively) when the LSE oscillator is off. The LSE has
00083        priority over the GPIO function.
00084 
00085    (#) The HSE oscillator pins OSC_IN/OSC_OUT can be used as
00086        general purpose PD0 and PD1, respectively, when the HSE oscillator is off.
00087        The HSE has priority over the GPIO function.
00088 
00089   @endverbatim
00090   ******************************************************************************
00091   * @attention
00092   *
00093   * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
00094   * All rights reserved.</center></h2>
00095   *
00096   * This software component is licensed by ST under BSD 3-Clause license,
00097   * the "License"; You may not use this file except in compliance with the
00098   * License. You may obtain a copy of the License at:
00099   *                        opensource.org/licenses/BSD-3-Clause
00100   *
00101   ******************************************************************************
00102   */
00103 
00104 /* Includes ------------------------------------------------------------------*/
00105 #include "stm32f1xx_hal.h"
00106 
00107 /** @addtogroup STM32F1xx_HAL_Driver
00108   * @{
00109   */
00110 
00111 /** @defgroup GPIO GPIO
00112   * @brief GPIO HAL module driver
00113   * @{
00114   */
00115 
00116 #ifdef HAL_GPIO_MODULE_ENABLED
00117 
00118 /* Private typedef -----------------------------------------------------------*/
00119 /* Private define ------------------------------------------------------------*/
00120 /** @addtogroup GPIO_Private_Constants GPIO Private Constants
00121   * @{
00122   */
00123 #define GPIO_MODE             0x00000003u
00124 #define EXTI_MODE             0x10000000u
00125 #define GPIO_MODE_IT          0x00010000u
00126 #define GPIO_MODE_EVT         0x00020000u
00127 #define RISING_EDGE           0x00100000u
00128 #define FALLING_EDGE          0x00200000u
00129 #define GPIO_OUTPUT_TYPE      0x00000010u
00130 
00131 #define GPIO_NUMBER           16u
00132 
00133 /* Definitions for bit manipulation of CRL and CRH register */
00134 #define  GPIO_CR_MODE_INPUT         0x00000000u /*!< 00: Input mode (reset state)  */
00135 #define  GPIO_CR_CNF_ANALOG         0x00000000u /*!< 00: Analog mode  */
00136 #define  GPIO_CR_CNF_INPUT_FLOATING 0x00000004u /*!< 01: Floating input (reset state)  */
00137 #define  GPIO_CR_CNF_INPUT_PU_PD    0x00000008u /*!< 10: Input with pull-up / pull-down  */
00138 #define  GPIO_CR_CNF_GP_OUTPUT_PP   0x00000000u /*!< 00: General purpose output push-pull  */
00139 #define  GPIO_CR_CNF_GP_OUTPUT_OD   0x00000004u /*!< 01: General purpose output Open-drain  */
00140 #define  GPIO_CR_CNF_AF_OUTPUT_PP   0x00000008u /*!< 10: Alternate function output Push-pull  */
00141 #define  GPIO_CR_CNF_AF_OUTPUT_OD   0x0000000Cu /*!< 11: Alternate function output Open-drain  */
00142 
00143 /**
00144   * @}
00145   */
00146 /* Private macro -------------------------------------------------------------*/
00147 /* Private variables ---------------------------------------------------------*/
00148 /* Private function prototypes -----------------------------------------------*/
00149 /* Private functions ---------------------------------------------------------*/
00150 /* Exported functions --------------------------------------------------------*/
00151 /** @defgroup GPIO_Exported_Functions GPIO Exported Functions
00152   * @{
00153   */
00154 
00155 /** @defgroup GPIO_Exported_Functions_Group1 Initialization and de-initialization functions
00156  *  @brief    Initialization and Configuration functions
00157  *
00158 @verbatim
00159  ===============================================================================
00160               ##### Initialization and de-initialization functions #####
00161  ===============================================================================
00162   [..]
00163     This section provides functions allowing to initialize and de-initialize the GPIOs
00164     to be ready for use.
00165 
00166 @endverbatim
00167   * @{
00168   */
00169 
00170 
00171 /**
00172   * @brief  Initializes the GPIOx peripheral according to the specified parameters in the GPIO_Init.
00173   * @param  GPIOx: where x can be (A..G depending on device used) to select the GPIO peripheral
00174   * @param  GPIO_Init: pointer to a GPIO_InitTypeDef structure that contains
00175   *         the configuration information for the specified GPIO peripheral.
00176   * @retval None
00177   */
00178 void HAL_GPIO_Init(GPIO_TypeDef  *GPIOx, GPIO_InitTypeDef *GPIO_Init)
00179 {
00180   uint32_t position = 0x00u;
00181   uint32_t ioposition;
00182   uint32_t iocurrent;
00183   uint32_t temp;
00184   uint32_t config = 0x00u;
00185   __IO uint32_t *configregister; /* Store the address of CRL or CRH register based on pin number */
00186   uint32_t registeroffset;       /* offset used during computation of CNF and MODE bits placement inside CRL or CRH register */
00187 
00188   /* Check the parameters */
00189   assert_param(IS_GPIO_ALL_INSTANCE(GPIOx));
00190   assert_param(IS_GPIO_PIN(GPIO_Init->Pin));
00191   assert_param(IS_GPIO_MODE(GPIO_Init->Mode));
00192 
00193   /* Configure the port pins */
00194   while (((GPIO_Init->Pin) >> position) != 0x00u)
00195   {
00196     /* Get the IO position */
00197     ioposition = (0x01uL << position);
00198 
00199     /* Get the current IO position */
00200     iocurrent = (uint32_t)(GPIO_Init->Pin) & ioposition;
00201 
00202     if (iocurrent == ioposition)
00203     {
00204       /* Check the Alternate function parameters */
00205       assert_param(IS_GPIO_AF_INSTANCE(GPIOx));
00206 
00207       /* Based on the required mode, filling config variable with MODEy[1:0] and CNFy[3:2] corresponding bits */
00208       switch (GPIO_Init->Mode)
00209       {
00210         /* If we are configuring the pin in OUTPUT push-pull mode */
00211         case GPIO_MODE_OUTPUT_PP:
00212           /* Check the GPIO speed parameter */
00213           assert_param(IS_GPIO_SPEED(GPIO_Init->Speed));
00214           config = GPIO_Init->Speed + GPIO_CR_CNF_GP_OUTPUT_PP;
00215           break;
00216 
00217         /* If we are configuring the pin in OUTPUT open-drain mode */
00218         case GPIO_MODE_OUTPUT_OD:
00219           /* Check the GPIO speed parameter */
00220           assert_param(IS_GPIO_SPEED(GPIO_Init->Speed));
00221           config = GPIO_Init->Speed + GPIO_CR_CNF_GP_OUTPUT_OD;
00222           break;
00223 
00224         /* If we are configuring the pin in ALTERNATE FUNCTION push-pull mode */
00225         case GPIO_MODE_AF_PP:
00226           /* Check the GPIO speed parameter */
00227           assert_param(IS_GPIO_SPEED(GPIO_Init->Speed));
00228           config = GPIO_Init->Speed + GPIO_CR_CNF_AF_OUTPUT_PP;
00229           break;
00230 
00231         /* If we are configuring the pin in ALTERNATE FUNCTION open-drain mode */
00232         case GPIO_MODE_AF_OD:
00233           /* Check the GPIO speed parameter */
00234           assert_param(IS_GPIO_SPEED(GPIO_Init->Speed));
00235           config = GPIO_Init->Speed + GPIO_CR_CNF_AF_OUTPUT_OD;
00236           break;
00237 
00238         /* If we are configuring the pin in INPUT (also applicable to EVENT and IT mode) */
00239         case GPIO_MODE_INPUT:
00240         case GPIO_MODE_IT_RISING:
00241         case GPIO_MODE_IT_FALLING:
00242         case GPIO_MODE_IT_RISING_FALLING:
00243         case GPIO_MODE_EVT_RISING:
00244         case GPIO_MODE_EVT_FALLING:
00245         case GPIO_MODE_EVT_RISING_FALLING:
00246           /* Check the GPIO pull parameter */
00247           assert_param(IS_GPIO_PULL(GPIO_Init->Pull));
00248           if (GPIO_Init->Pull == GPIO_NOPULL)
00249           {
00250             config = GPIO_CR_MODE_INPUT + GPIO_CR_CNF_INPUT_FLOATING;
00251           }
00252           else if (GPIO_Init->Pull == GPIO_PULLUP)
00253           {
00254             config = GPIO_CR_MODE_INPUT + GPIO_CR_CNF_INPUT_PU_PD;
00255 
00256             /* Set the corresponding ODR bit */
00257             GPIOx->BSRR = ioposition;
00258           }
00259           else /* GPIO_PULLDOWN */
00260           {
00261             config = GPIO_CR_MODE_INPUT + GPIO_CR_CNF_INPUT_PU_PD;
00262 
00263             /* Reset the corresponding ODR bit */
00264             GPIOx->BRR = ioposition;
00265           }
00266           break;
00267 
00268         /* If we are configuring the pin in INPUT analog mode */
00269         case GPIO_MODE_ANALOG:
00270           config = GPIO_CR_MODE_INPUT + GPIO_CR_CNF_ANALOG;
00271           break;
00272 
00273         /* Parameters are checked with assert_param */
00274         default:
00275           break;
00276       }
00277 
00278       /* Check if the current bit belongs to first half or last half of the pin count number
00279        in order to address CRH or CRL register*/
00280       configregister = (iocurrent < GPIO_PIN_8) ? &GPIOx->CRL     : &GPIOx->CRH;
00281       registeroffset = (iocurrent < GPIO_PIN_8) ? (position << 2u) : ((position - 8u) << 2u);
00282 
00283       /* Apply the new configuration of the pin to the register */
00284       MODIFY_REG((*configregister), ((GPIO_CRL_MODE0 | GPIO_CRL_CNF0) << registeroffset), (config << registeroffset));
00285 
00286       /*--------------------- EXTI Mode Configuration ------------------------*/
00287       /* Configure the External Interrupt or event for the current IO */
00288       if ((GPIO_Init->Mode & EXTI_MODE) == EXTI_MODE)
00289       {
00290         /* Enable AFIO Clock */
00291         __HAL_RCC_AFIO_CLK_ENABLE();
00292         temp = AFIO->EXTICR[position >> 2u];
00293         CLEAR_BIT(temp, (0x0Fu) << (4u * (position & 0x03u)));
00294         SET_BIT(temp, (GPIO_GET_INDEX(GPIOx)) << (4u * (position & 0x03u)));
00295         AFIO->EXTICR[position >> 2u] = temp;
00296 
00297 
00298         /* Configure the interrupt mask */
00299         if ((GPIO_Init->Mode & GPIO_MODE_IT) == GPIO_MODE_IT)
00300         {
00301           SET_BIT(EXTI->IMR, iocurrent);
00302         }
00303         else
00304         {
00305           CLEAR_BIT(EXTI->IMR, iocurrent);
00306         }
00307 
00308         /* Configure the event mask */
00309         if ((GPIO_Init->Mode & GPIO_MODE_EVT) == GPIO_MODE_EVT)
00310         {
00311           SET_BIT(EXTI->EMR, iocurrent);
00312         }
00313         else
00314         {
00315           CLEAR_BIT(EXTI->EMR, iocurrent);
00316         }
00317 
00318         /* Enable or disable the rising trigger */
00319         if ((GPIO_Init->Mode & RISING_EDGE) == RISING_EDGE)
00320         {
00321           SET_BIT(EXTI->RTSR, iocurrent);
00322         }
00323         else
00324         {
00325           CLEAR_BIT(EXTI->RTSR, iocurrent);
00326         }
00327 
00328         /* Enable or disable the falling trigger */
00329         if ((GPIO_Init->Mode & FALLING_EDGE) == FALLING_EDGE)
00330         {
00331           SET_BIT(EXTI->FTSR, iocurrent);
00332         }
00333         else
00334         {
00335           CLEAR_BIT(EXTI->FTSR, iocurrent);
00336         }
00337       }
00338     }
00339 
00340         position++;
00341   }
00342 }
00343 
00344 /**
00345   * @brief  De-initializes the GPIOx peripheral registers to their default reset values.
00346   * @param  GPIOx: where x can be (A..G depending on device used) to select the GPIO peripheral
00347   * @param  GPIO_Pin: specifies the port bit to be written.
00348   *         This parameter can be one of GPIO_PIN_x where x can be (0..15).
00349   * @retval None
00350   */
00351 void HAL_GPIO_DeInit(GPIO_TypeDef  *GPIOx, uint32_t GPIO_Pin)
00352 {
00353   uint32_t position = 0x00u;
00354   uint32_t iocurrent;
00355   uint32_t tmp;
00356   __IO uint32_t *configregister; /* Store the address of CRL or CRH register based on pin number */
00357   uint32_t registeroffset;
00358 
00359   /* Check the parameters */
00360   assert_param(IS_GPIO_ALL_INSTANCE(GPIOx));
00361   assert_param(IS_GPIO_PIN(GPIO_Pin));
00362 
00363   /* Configure the port pins */
00364   while ((GPIO_Pin >> position) != 0u)
00365   {
00366     /* Get current io position */
00367     iocurrent = (GPIO_Pin) & (1uL << position);
00368 
00369     if (iocurrent)
00370     {
00371       /*------------------------- EXTI Mode Configuration --------------------*/
00372       /* Clear the External Interrupt or Event for the current IO */
00373 
00374       tmp = AFIO->EXTICR[position >> 2u];
00375       tmp &= 0x0FuL << (4u * (position & 0x03u));
00376       if (tmp == (GPIO_GET_INDEX(GPIOx) << (4u * (position & 0x03u))))
00377       {
00378         tmp = 0x0FuL << (4u * (position & 0x03u));
00379         CLEAR_BIT(AFIO->EXTICR[position >> 2u], tmp);
00380 
00381         /* Clear EXTI line configuration */
00382         CLEAR_BIT(EXTI->IMR, (uint32_t)iocurrent);
00383         CLEAR_BIT(EXTI->EMR, (uint32_t)iocurrent);
00384 
00385         /* Clear Rising Falling edge configuration */
00386         CLEAR_BIT(EXTI->RTSR, (uint32_t)iocurrent);
00387         CLEAR_BIT(EXTI->FTSR, (uint32_t)iocurrent);
00388       }
00389       /*------------------------- GPIO Mode Configuration --------------------*/
00390       /* Check if the current bit belongs to first half or last half of the pin count number
00391        in order to address CRH or CRL register */
00392       configregister = (iocurrent < GPIO_PIN_8) ? &GPIOx->CRL     : &GPIOx->CRH;
00393       registeroffset = (iocurrent < GPIO_PIN_8) ? (position << 2u) : ((position - 8u) << 2u);
00394 
00395       /* CRL/CRH default value is floating input(0x04) shifted to correct position */
00396       MODIFY_REG(*configregister, ((GPIO_CRL_MODE0 | GPIO_CRL_CNF0) << registeroffset), GPIO_CRL_CNF0_0 << registeroffset);
00397 
00398       /* ODR default value is 0 */
00399       CLEAR_BIT(GPIOx->ODR, iocurrent);
00400     }
00401 
00402     position++;
00403   }
00404 }
00405 
00406 /**
00407   * @}
00408   */
00409 
00410 /** @defgroup GPIO_Exported_Functions_Group2 IO operation functions
00411  *  @brief   GPIO Read and Write
00412  *
00413 @verbatim
00414  ===============================================================================
00415                        ##### IO operation functions #####
00416  ===============================================================================
00417   [..]
00418     This subsection provides a set of functions allowing to manage the GPIOs.
00419 
00420 @endverbatim
00421   * @{
00422   */
00423 
00424 /**
00425   * @brief  Reads the specified input port pin.
00426   * @param  GPIOx: where x can be (A..G depending on device used) to select the GPIO peripheral
00427   * @param  GPIO_Pin: specifies the port bit to read.
00428   *         This parameter can be GPIO_PIN_x where x can be (0..15).
00429   * @retval The input port pin value.
00430   */
00431 GPIO_PinState HAL_GPIO_ReadPin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
00432 {
00433   GPIO_PinState bitstatus;
00434 
00435   /* Check the parameters */
00436   assert_param(IS_GPIO_PIN(GPIO_Pin));
00437 
00438   if ((GPIOx->IDR & GPIO_Pin) != (uint32_t)GPIO_PIN_RESET)
00439   {
00440     bitstatus = GPIO_PIN_SET;
00441   }
00442   else
00443   {
00444     bitstatus = GPIO_PIN_RESET;
00445   }
00446   return bitstatus;
00447 }
00448 
00449 /**
00450   * @brief  Sets or clears the selected data port bit.
00451   *
00452   * @note   This function uses GPIOx_BSRR register to allow atomic read/modify
00453   *         accesses. In this way, there is no risk of an IRQ occurring between
00454   *         the read and the modify access.
00455   *
00456   * @param  GPIOx: where x can be (A..G depending on device used) to select the GPIO peripheral
00457   * @param  GPIO_Pin: specifies the port bit to be written.
00458   *          This parameter can be one of GPIO_PIN_x where x can be (0..15).
00459   * @param  PinState: specifies the value to be written to the selected bit.
00460   *          This parameter can be one of the GPIO_PinState enum values:
00461   *            @arg GPIO_PIN_RESET: to clear the port pin
00462   *            @arg GPIO_PIN_SET: to set the port pin
00463   * @retval None
00464   */
00465 void HAL_GPIO_WritePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState)
00466 {
00467   /* Check the parameters */
00468   assert_param(IS_GPIO_PIN(GPIO_Pin));
00469   assert_param(IS_GPIO_PIN_ACTION(PinState));
00470 
00471   if (PinState != GPIO_PIN_RESET)
00472   {
00473     GPIOx->BSRR = GPIO_Pin;
00474   }
00475   else
00476   {
00477     GPIOx->BSRR = (uint32_t)GPIO_Pin << 16u;
00478   }
00479 }
00480 
00481 /**
00482   * @brief  Toggles the specified GPIO pin
00483   * @param  GPIOx: where x can be (A..G depending on device used) to select the GPIO peripheral
00484   * @param  GPIO_Pin: Specifies the pins to be toggled.
00485   * @retval None
00486   */
00487 void HAL_GPIO_TogglePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
00488 {
00489   uint32_t odr;
00490 
00491   /* Check the parameters */
00492   assert_param(IS_GPIO_PIN(GPIO_Pin));
00493 
00494   /* get current Ouput Data Register value */
00495   odr = GPIOx->ODR;
00496 
00497   /* Set selected pins that were at low level, and reset ones that were high */
00498   GPIOx->BSRR = ((odr & GPIO_Pin) << GPIO_NUMBER) | (~odr & GPIO_Pin);
00499 }
00500 
00501 /**
00502 * @brief  Locks GPIO Pins configuration registers.
00503 * @note   The locking mechanism allows the IO configuration to be frozen. When the LOCK sequence
00504 *         has been applied on a port bit, it is no longer possible to modify the value of the port bit until
00505 *         the next reset.
00506 * @param  GPIOx: where x can be (A..G depending on device used) to select the GPIO peripheral
00507 * @param  GPIO_Pin: specifies the port bit to be locked.
00508 *         This parameter can be any combination of GPIO_Pin_x where x can be (0..15).
00509 * @retval None
00510 */
00511 HAL_StatusTypeDef HAL_GPIO_LockPin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
00512 {
00513   __IO uint32_t tmp = GPIO_LCKR_LCKK;
00514 
00515   /* Check the parameters */
00516   assert_param(IS_GPIO_LOCK_INSTANCE(GPIOx));
00517   assert_param(IS_GPIO_PIN(GPIO_Pin));
00518 
00519   /* Apply lock key write sequence */
00520   SET_BIT(tmp, GPIO_Pin);
00521   /* Set LCKx bit(s): LCKK='1' + LCK[15-0] */
00522   GPIOx->LCKR = tmp;
00523   /* Reset LCKx bit(s): LCKK='0' + LCK[15-0] */
00524   GPIOx->LCKR = GPIO_Pin;
00525   /* Set LCKx bit(s): LCKK='1' + LCK[15-0] */
00526   GPIOx->LCKR = tmp;
00527   /* Read LCKK register. This read is mandatory to complete key lock sequence */
00528   tmp = GPIOx->LCKR;
00529 
00530   /* read again in order to confirm lock is active */
00531   if ((uint32_t)(GPIOx->LCKR & GPIO_LCKR_LCKK))
00532   {
00533     return HAL_OK;
00534   }
00535   else
00536   {
00537     return HAL_ERROR;
00538   }
00539 }
00540 
00541 /**
00542   * @brief  This function handles EXTI interrupt request.
00543   * @param  GPIO_Pin: Specifies the pins connected EXTI line
00544   * @retval None
00545   */
00546 void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin)
00547 {
00548   /* EXTI line interrupt detected */
00549   if (__HAL_GPIO_EXTI_GET_IT(GPIO_Pin) != 0x00u)
00550   {
00551     __HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin);
00552     HAL_GPIO_EXTI_Callback(GPIO_Pin);
00553   }
00554 }
00555 
00556 /**
00557   * @brief  EXTI line detection callbacks.
00558   * @param  GPIO_Pin: Specifies the pins connected EXTI line
00559   * @retval None
00560   */
00561 __weak void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
00562 {
00563   /* Prevent unused argument(s) compilation warning */
00564   UNUSED(GPIO_Pin);
00565   /* NOTE: This function Should not be modified, when the callback is needed,
00566            the HAL_GPIO_EXTI_Callback could be implemented in the user file
00567    */
00568 }
00569 
00570 /**
00571   * @}
00572   */
00573 
00574 /**
00575   * @}
00576   */
00577 
00578 #endif /* HAL_GPIO_MODULE_ENABLED */
00579 /**
00580   * @}
00581   */
00582 
00583 /**
00584   * @}
00585   */
00586 
00587 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/