STM32L486xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32l4xx_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 (+) Each port bit of the general-purpose I/O (GPIO) ports can be individually 00017 configured by software in several modes: 00018 (++) Input mode 00019 (++) Analog mode 00020 (++) Output mode 00021 (++) Alternate function mode 00022 (++) External interrupt/event lines 00023 00024 (+) During and just after reset, the alternate functions and external interrupt 00025 lines are not active and the I/O ports are configured in input floating mode. 00026 00027 (+) All GPIO pins have weak internal pull-up and pull-down resistors, which can be 00028 activated or not. 00029 00030 (+) In Output or Alternate mode, each IO can be configured on open-drain or push-pull 00031 type and the IO speed can be selected depending on the VDD value. 00032 00033 (+) The microcontroller IO pins are connected to onboard peripherals/modules through a 00034 multiplexer that allows only one peripheral alternate function (AF) connected 00035 to an IO pin at a time. In this way, there can be no conflict between peripherals 00036 sharing the same IO pin. 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 (+) The external interrupt/event controller consists of up to 39 edge detectors 00043 (16 lines are connected to GPIO) for generating event/interrupt requests (each 00044 input line can be independently configured to select the type (interrupt or event) 00045 and the corresponding trigger event (rising or falling or both). Each line can 00046 also be masked independently. 00047 00048 ##### How to use this driver ##### 00049 ============================================================================== 00050 [..] 00051 (#) Enable the GPIO AHB clock using the following function: __HAL_RCC_GPIOx_CLK_ENABLE(). 00052 00053 (#) Configure the GPIO pin(s) using HAL_GPIO_Init(). 00054 (++) Configure the IO mode using "Mode" member from GPIO_InitTypeDef structure 00055 (++) Activate Pull-up, Pull-down resistor using "Pull" member from GPIO_InitTypeDef 00056 structure. 00057 (++) In case of Output or alternate function mode selection: the speed is 00058 configured through "Speed" member from GPIO_InitTypeDef structure. 00059 (++) In alternate mode is selection, the alternate function connected to the IO 00060 is configured through "Alternate" member from GPIO_InitTypeDef structure. 00061 (++) Analog mode is required when a pin is to be used as ADC channel 00062 or DAC output. 00063 (++) In case of external interrupt/event selection the "Mode" member from 00064 GPIO_InitTypeDef structure select the type (interrupt or event) and 00065 the corresponding trigger event (rising or falling or both). 00066 00067 (#) In case of external interrupt/event mode selection, configure NVIC IRQ priority 00068 mapped to the EXTI line using HAL_NVIC_SetPriority() and enable it using 00069 HAL_NVIC_EnableIRQ(). 00070 00071 (#) To get the level of a pin configured in input mode use HAL_GPIO_ReadPin(). 00072 00073 (#) To set/reset the level of a pin configured in output mode use 00074 HAL_GPIO_WritePin()/HAL_GPIO_TogglePin(). 00075 00076 (#) To lock pin configuration until next reset use HAL_GPIO_LockPin(). 00077 00078 (#) During and just after reset, the alternate functions are not 00079 active and the GPIO pins are configured in input floating mode (except JTAG 00080 pins). 00081 00082 (#) The LSE oscillator pins OSC32_IN and OSC32_OUT can be used as general purpose 00083 (PC14 and PC15, respectively) when the LSE oscillator is off. The LSE has 00084 priority over the GPIO function. 00085 00086 (#) The HSE oscillator pins OSC_IN/OSC_OUT can be used as 00087 general purpose PH0 and PH1, respectively, when the HSE oscillator is off. 00088 The HSE has priority over the GPIO function. 00089 00090 @endverbatim 00091 ****************************************************************************** 00092 * @attention 00093 * 00094 * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> 00095 * 00096 * Redistribution and use in source and binary forms, with or without modification, 00097 * are permitted provided that the following conditions are met: 00098 * 1. Redistributions of source code must retain the above copyright notice, 00099 * this list of conditions and the following disclaimer. 00100 * 2. Redistributions in binary form must reproduce the above copyright notice, 00101 * this list of conditions and the following disclaimer in the documentation 00102 * and/or other materials provided with the distribution. 00103 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00104 * may be used to endorse or promote products derived from this software 00105 * without specific prior written permission. 00106 * 00107 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00108 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00109 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00110 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00111 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00112 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00113 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00114 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00115 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00116 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00117 * 00118 ****************************************************************************** 00119 */ 00120 00121 /* Includes ------------------------------------------------------------------*/ 00122 #include "stm32l4xx_hal.h" 00123 00124 /** @addtogroup STM32L4xx_HAL_Driver 00125 * @{ 00126 */ 00127 00128 /** @defgroup GPIO GPIO 00129 * @brief GPIO HAL module driver 00130 * @{ 00131 */ 00132 00133 #ifdef HAL_GPIO_MODULE_ENABLED 00134 00135 /* Private typedef -----------------------------------------------------------*/ 00136 /* Private defines -----------------------------------------------------------*/ 00137 /** @defgroup GPIO_Private_Defines GPIO Private Defines 00138 * @{ 00139 */ 00140 #define GPIO_MODE ((uint32_t)0x00000003) 00141 #define ANALOG_MODE ((uint32_t)0x00000008) 00142 #define EXTI_MODE ((uint32_t)0x10000000) 00143 #define GPIO_MODE_IT ((uint32_t)0x00010000) 00144 #define GPIO_MODE_EVT ((uint32_t)0x00020000) 00145 #define RISING_EDGE ((uint32_t)0x00100000) 00146 #define FALLING_EDGE ((uint32_t)0x00200000) 00147 #define GPIO_OUTPUT_TYPE ((uint32_t)0x00000010) 00148 00149 #define GPIO_NUMBER ((uint32_t)16) 00150 /** 00151 * @} 00152 */ 00153 00154 /* Private macros ------------------------------------------------------------*/ 00155 /* Private macros ------------------------------------------------------------*/ 00156 /** @defgroup GPIO_Private_Macros GPIO Private Macros 00157 * @{ 00158 */ 00159 /** 00160 * @} 00161 */ 00162 /* Private variables ---------------------------------------------------------*/ 00163 /* Private function prototypes -----------------------------------------------*/ 00164 /* Exported functions --------------------------------------------------------*/ 00165 00166 /** @defgroup GPIO_Exported_Functions GPIO Exported Functions 00167 * @{ 00168 */ 00169 00170 /** @defgroup GPIO_Exported_Functions_Group1 Initialization/de-initialization functions 00171 * @brief Initialization and Configuration functions 00172 * 00173 @verbatim 00174 =============================================================================== 00175 ##### Initialization and de-initialization functions ##### 00176 =============================================================================== 00177 00178 @endverbatim 00179 * @{ 00180 */ 00181 00182 /** 00183 * @brief Initialize the GPIOx peripheral according to the specified parameters in the GPIO_Init. 00184 * @param GPIOx: where x can be (A..H) to select the GPIO peripheral for STM32L4 family 00185 * @param GPIO_Init: pointer to a GPIO_InitTypeDef structure that contains 00186 * the configuration information for the specified GPIO peripheral. 00187 * @retval None 00188 */ 00189 void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init) 00190 { 00191 uint32_t position = 0x00; 00192 uint32_t iocurrent = 0x00; 00193 uint32_t temp = 0x00; 00194 00195 /* Check the parameters */ 00196 assert_param(IS_GPIO_ALL_INSTANCE(GPIOx)); 00197 assert_param(IS_GPIO_PIN(GPIO_Init->Pin)); 00198 assert_param(IS_GPIO_MODE(GPIO_Init->Mode)); 00199 assert_param(IS_GPIO_PULL(GPIO_Init->Pull)); 00200 00201 /* Configure the port pins */ 00202 while (((GPIO_Init->Pin) >> position) != RESET) 00203 { 00204 /* Get current io position */ 00205 iocurrent = (GPIO_Init->Pin) & (1U << position); 00206 00207 if(iocurrent) 00208 { 00209 /*--------------------- GPIO Mode Configuration ------------------------*/ 00210 /* In case of Alternate function mode selection */ 00211 if((GPIO_Init->Mode == GPIO_MODE_AF_PP) || (GPIO_Init->Mode == GPIO_MODE_AF_OD)) 00212 { 00213 /* Check the Alternate function parameters */ 00214 assert_param(IS_GPIO_AF_INSTANCE(GPIOx)); 00215 assert_param(IS_GPIO_AF(GPIO_Init->Alternate)); 00216 00217 /* Configure Alternate function mapped with the current IO */ 00218 temp = GPIOx->AFR[position >> 3]; 00219 temp &= ~((uint32_t)0xF << ((uint32_t)(position & (uint32_t)0x07) * 4)) ; 00220 temp |= ((uint32_t)(GPIO_Init->Alternate) << (((uint32_t)position & (uint32_t)0x07) * 4)); 00221 GPIOx->AFR[position >> 3] = temp; 00222 } 00223 00224 /* Configure IO Direction mode (Input, Output, Alternate or Analog) */ 00225 temp = GPIOx->MODER; 00226 temp &= ~(GPIO_MODER_MODE0 << (position * 2)); 00227 temp |= ((GPIO_Init->Mode & GPIO_MODE) << (position * 2)); 00228 GPIOx->MODER = temp; 00229 00230 /* In case of Output or Alternate function mode selection */ 00231 if((GPIO_Init->Mode == GPIO_MODE_OUTPUT_PP) || (GPIO_Init->Mode == GPIO_MODE_AF_PP) || 00232 (GPIO_Init->Mode == GPIO_MODE_OUTPUT_OD) || (GPIO_Init->Mode == GPIO_MODE_AF_OD)) 00233 { 00234 /* Check the Speed parameter */ 00235 assert_param(IS_GPIO_SPEED(GPIO_Init->Speed)); 00236 /* Configure the IO Speed */ 00237 temp = GPIOx->OSPEEDR; 00238 temp &= ~(GPIO_OSPEEDR_OSPEED0 << (position * 2)); 00239 temp |= (GPIO_Init->Speed << (position * 2)); 00240 GPIOx->OSPEEDR = temp; 00241 00242 /* Configure the IO Output Type */ 00243 temp = GPIOx->OTYPER; 00244 temp &= ~(GPIO_OTYPER_OT0 << position) ; 00245 temp |= (((GPIO_Init->Mode & GPIO_OUTPUT_TYPE) >> 4) << position); 00246 GPIOx->OTYPER = temp; 00247 } 00248 00249 #if defined(STM32L471xx) || defined(STM32L475xx) || defined(STM32L476xx) || defined(STM32L485xx) || defined(STM32L486xx) 00250 00251 /* In case of Analog mode, check if ADC control mode is selected */ 00252 if((GPIO_Init->Mode & GPIO_MODE_ANALOG) == GPIO_MODE_ANALOG) 00253 { 00254 /* Configure the IO Output Type */ 00255 temp = GPIOx->ASCR; 00256 temp &= ~(GPIO_ASCR_ASC0 << position) ; 00257 temp |= (((GPIO_Init->Mode & ANALOG_MODE) >> 3) << position); 00258 GPIOx->ASCR = temp; 00259 } 00260 00261 #endif /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx */ 00262 00263 /* Activate the Pull-up or Pull down resistor for the current IO */ 00264 temp = GPIOx->PUPDR; 00265 temp &= ~(GPIO_PUPDR_PUPD0 << (position * 2)); 00266 temp |= ((GPIO_Init->Pull) << (position * 2)); 00267 GPIOx->PUPDR = temp; 00268 00269 /*--------------------- EXTI Mode Configuration ------------------------*/ 00270 /* Configure the External Interrupt or event for the current IO */ 00271 if((GPIO_Init->Mode & EXTI_MODE) == EXTI_MODE) 00272 { 00273 /* Enable SYSCFG Clock */ 00274 __HAL_RCC_SYSCFG_CLK_ENABLE(); 00275 00276 temp = SYSCFG->EXTICR[position >> 2]; 00277 temp &= ~(((uint32_t)0x0F) << (4 * (position & 0x03))); 00278 temp |= (GPIO_GET_INDEX(GPIOx) << (4 * (position & 0x03))); 00279 SYSCFG->EXTICR[position >> 2] = temp; 00280 00281 /* Clear EXTI line configuration */ 00282 temp = EXTI->IMR1; 00283 temp &= ~((uint32_t)iocurrent); 00284 if((GPIO_Init->Mode & GPIO_MODE_IT) == GPIO_MODE_IT) 00285 { 00286 temp |= iocurrent; 00287 } 00288 EXTI->IMR1 = temp; 00289 00290 temp = EXTI->EMR1; 00291 temp &= ~((uint32_t)iocurrent); 00292 if((GPIO_Init->Mode & GPIO_MODE_EVT) == GPIO_MODE_EVT) 00293 { 00294 temp |= iocurrent; 00295 } 00296 EXTI->EMR1 = temp; 00297 00298 /* Clear Rising Falling edge configuration */ 00299 temp = EXTI->RTSR1; 00300 temp &= ~((uint32_t)iocurrent); 00301 if((GPIO_Init->Mode & RISING_EDGE) == RISING_EDGE) 00302 { 00303 temp |= iocurrent; 00304 } 00305 EXTI->RTSR1 = temp; 00306 00307 temp = EXTI->FTSR1; 00308 temp &= ~((uint32_t)iocurrent); 00309 if((GPIO_Init->Mode & FALLING_EDGE) == FALLING_EDGE) 00310 { 00311 temp |= iocurrent; 00312 } 00313 EXTI->FTSR1 = temp; 00314 } 00315 } 00316 00317 position++; 00318 } 00319 } 00320 00321 /** 00322 * @brief De-initialize the GPIOx peripheral registers to their default reset values. 00323 * @param GPIOx: where x can be (A..H) to select the GPIO peripheral for STM32L4 family 00324 * @param GPIO_Pin: specifies the port bit to be written. 00325 * This parameter can be one of GPIO_PIN_x where x can be (0..15). 00326 * @retval None 00327 */ 00328 void HAL_GPIO_DeInit(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin) 00329 { 00330 uint32_t position = 0x00; 00331 uint32_t iocurrent = 0x00; 00332 uint32_t tmp = 0x00; 00333 00334 /* Check the parameters */ 00335 assert_param(IS_GPIO_ALL_INSTANCE(GPIOx)); 00336 assert_param(IS_GPIO_PIN(GPIO_Pin)); 00337 00338 /* Configure the port pins */ 00339 while ((GPIO_Pin >> position) != RESET) 00340 { 00341 /* Get current io position */ 00342 iocurrent = (GPIO_Pin) & (1U << position); 00343 00344 if (iocurrent) 00345 { 00346 /*------------------------- GPIO Mode Configuration --------------------*/ 00347 /* Configure IO in Analog Mode */ 00348 GPIOx->MODER |= (GPIO_MODER_MODE0 << (position * 2)); 00349 00350 /* Configure the default Alternate Function in current IO */ 00351 GPIOx->AFR[position >> 3] &= ~((uint32_t)0xF << ((uint32_t)(position & (uint32_t)0x07) * 4)) ; 00352 00353 /* Configure the default value for IO Speed */ 00354 GPIOx->OSPEEDR &= ~(GPIO_OSPEEDR_OSPEED0 << (position * 2)); 00355 00356 /* Configure the default value IO Output Type */ 00357 GPIOx->OTYPER &= ~(GPIO_OTYPER_OT0 << position) ; 00358 00359 /* Deactivate the Pull-up and Pull-down resistor for the current IO */ 00360 GPIOx->PUPDR &= ~(GPIO_PUPDR_PUPD0 << (position * 2)); 00361 00362 #if defined(STM32L471xx) || defined(STM32L475xx) || defined(STM32L476xx) || defined(STM32L485xx) || defined(STM32L486xx) 00363 00364 /* Deactivate the Control bit of Analog mode for the current IO */ 00365 GPIOx->ASCR &= ~(GPIO_ASCR_ASC0<< position); 00366 00367 #endif /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx */ 00368 00369 /*------------------------- EXTI Mode Configuration --------------------*/ 00370 /* Clear the External Interrupt or Event for the current IO */ 00371 00372 tmp = SYSCFG->EXTICR[position >> 2]; 00373 tmp &= (((uint32_t)0x0F) << (4 * (position & 0x03))); 00374 if(tmp == (GPIO_GET_INDEX(GPIOx) << (4 * (position & 0x03)))) 00375 { 00376 tmp = ((uint32_t)0x0F) << (4 * (position & 0x03)); 00377 SYSCFG->EXTICR[position >> 2] &= ~tmp; 00378 00379 /* Clear EXTI line configuration */ 00380 EXTI->IMR1 &= ~((uint32_t)iocurrent); 00381 EXTI->EMR1 &= ~((uint32_t)iocurrent); 00382 00383 /* Clear Rising Falling edge configuration */ 00384 EXTI->RTSR1 &= ~((uint32_t)iocurrent); 00385 EXTI->FTSR1 &= ~((uint32_t)iocurrent); 00386 } 00387 } 00388 00389 position++; 00390 } 00391 } 00392 00393 /** 00394 * @} 00395 */ 00396 00397 /** @defgroup GPIO_Exported_Functions_Group2 IO operation functions 00398 * @brief GPIO Read, Write, Toggle, Lock and EXTI management functions. 00399 * 00400 @verbatim 00401 =============================================================================== 00402 ##### IO operation functions ##### 00403 =============================================================================== 00404 00405 @endverbatim 00406 * @{ 00407 */ 00408 00409 /** 00410 * @brief Read the specified input port pin. 00411 * @param GPIOx: where x can be (A..H) to select the GPIO peripheral for STM32L4 family 00412 * @param GPIO_Pin: specifies the port bit to read. 00413 * This parameter can be GPIO_PIN_x where x can be (0..15). 00414 * @retval The input port pin value. 00415 */ 00416 GPIO_PinState HAL_GPIO_ReadPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin) 00417 { 00418 GPIO_PinState bitstatus; 00419 00420 /* Check the parameters */ 00421 assert_param(IS_GPIO_PIN(GPIO_Pin)); 00422 00423 if((GPIOx->IDR & GPIO_Pin) != (uint32_t)GPIO_PIN_RESET) 00424 { 00425 bitstatus = GPIO_PIN_SET; 00426 } 00427 else 00428 { 00429 bitstatus = GPIO_PIN_RESET; 00430 } 00431 return bitstatus; 00432 } 00433 00434 /** 00435 * @brief Set or clear the selected data port bit. 00436 * 00437 * @note This function uses GPIOx_BSRR and GPIOx_BRR registers to allow atomic read/modify 00438 * accesses. In this way, there is no risk of an IRQ occurring between 00439 * the read and the modify access. 00440 * 00441 * @param GPIOx: where x can be (A..H) to select the GPIO peripheral for STM32L4 family 00442 * @param GPIO_Pin: specifies the port bit to be written. 00443 * This parameter can be one of GPIO_PIN_x where x can be (0..15). 00444 * @param PinState: specifies the value to be written to the selected bit. 00445 * This parameter can be one of the GPIO_PinState enum values: 00446 * @arg GPIO_PIN_RESET: to clear the port pin 00447 * @arg GPIO_PIN_SET: to set the port pin 00448 * @retval None 00449 */ 00450 void HAL_GPIO_WritePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState) 00451 { 00452 /* Check the parameters */ 00453 assert_param(IS_GPIO_PIN(GPIO_Pin)); 00454 assert_param(IS_GPIO_PIN_ACTION(PinState)); 00455 00456 if(PinState != GPIO_PIN_RESET) 00457 { 00458 GPIOx->BSRR = (uint32_t)GPIO_Pin; 00459 } 00460 else 00461 { 00462 GPIOx->BRR = (uint32_t)GPIO_Pin; 00463 } 00464 } 00465 00466 /** 00467 * @brief Toggle the specified GPIO pin. 00468 * @param GPIOx: where x can be (A..H) to select the GPIO peripheral for STM32L4 family 00469 * @param GPIO_Pin: specifies the pin to be toggled. 00470 * @retval None 00471 */ 00472 void HAL_GPIO_TogglePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin) 00473 { 00474 /* Check the parameters */ 00475 assert_param(IS_GPIO_PIN(GPIO_Pin)); 00476 00477 GPIOx->ODR ^= GPIO_Pin; 00478 } 00479 00480 /** 00481 * @brief Lock GPIO Pins configuration registers. 00482 * @note The locked registers are GPIOx_MODER, GPIOx_OTYPER, GPIOx_OSPEEDR, 00483 * GPIOx_PUPDR, GPIOx_AFRL and GPIOx_AFRH. 00484 * @note The configuration of the locked GPIO pins can no longer be modified 00485 * until the next reset. 00486 * @param GPIOx: where x can be (A..H) to select the GPIO peripheral for STM32L4 family 00487 * @param GPIO_Pin: specifies the port bits to be locked. 00488 * This parameter can be any combination of GPIO_Pin_x where x can be (0..15). 00489 * @retval None 00490 */ 00491 HAL_StatusTypeDef HAL_GPIO_LockPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin) 00492 { 00493 __IO uint32_t tmp = GPIO_LCKR_LCKK; 00494 00495 /* Check the parameters */ 00496 assert_param(IS_GPIO_LOCK_INSTANCE(GPIOx)); 00497 assert_param(IS_GPIO_PIN(GPIO_Pin)); 00498 00499 /* Apply lock key write sequence */ 00500 tmp |= GPIO_Pin; 00501 /* Set LCKx bit(s): LCKK='1' + LCK[15-0] */ 00502 GPIOx->LCKR = tmp; 00503 /* Reset LCKx bit(s): LCKK='0' + LCK[15-0] */ 00504 GPIOx->LCKR = GPIO_Pin; 00505 /* Set LCKx bit(s): LCKK='1' + LCK[15-0] */ 00506 GPIOx->LCKR = tmp; 00507 /* Read LCKK bit*/ 00508 tmp = GPIOx->LCKR; 00509 00510 if((GPIOx->LCKR & GPIO_LCKR_LCKK) != RESET) 00511 { 00512 return HAL_OK; 00513 } 00514 else 00515 { 00516 return HAL_ERROR; 00517 } 00518 } 00519 00520 /** 00521 * @brief Handle EXTI interrupt request. 00522 * @param GPIO_Pin: Specifies the port pin connected to corresponding EXTI line. 00523 * @retval None 00524 */ 00525 void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin) 00526 { 00527 /* EXTI line interrupt detected */ 00528 if(__HAL_GPIO_EXTI_GET_IT(GPIO_Pin) != RESET) 00529 { 00530 __HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin); 00531 HAL_GPIO_EXTI_Callback(GPIO_Pin); 00532 } 00533 } 00534 00535 /** 00536 * @brief EXTI line detection callback. 00537 * @param GPIO_Pin: Specifies the port pin connected to corresponding EXTI line. 00538 * @retval None 00539 */ 00540 __weak void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) 00541 { 00542 /* Prevent unused argument(s) compilation warning */ 00543 UNUSED(GPIO_Pin); 00544 00545 /* NOTE: This function should not be modified, when the callback is needed, 00546 the HAL_GPIO_EXTI_Callback could be implemented in the user file 00547 */ 00548 } 00549 00550 /** 00551 * @} 00552 */ 00553 00554 00555 /** 00556 * @} 00557 */ 00558 00559 #endif /* HAL_GPIO_MODULE_ENABLED */ 00560 /** 00561 * @} 00562 */ 00563 00564 /** 00565 * @} 00566 */ 00567 00568 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/