stm32f0xx_hal_gpio.c 20 KB

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