stm32g0xx_hal_exti.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670
  1. /**
  2. ******************************************************************************
  3. * @file stm32g0xx_hal_exti.c
  4. * @author MCD Application Team
  5. * @brief EXTI HAL module driver.
  6. * This file provides firmware functions to manage the following
  7. * functionalities of the General Purpose Input/Output (EXTI) peripheral:
  8. * + Initialization and de-initialization functions
  9. * + IO operation functions
  10. *
  11. ******************************************************************************
  12. * @attention
  13. *
  14. * Copyright (c) 2018 STMicroelectronics.
  15. * All rights reserved.
  16. *
  17. * This software is licensed under terms that can be found in the LICENSE file
  18. * in the root directory of this software component.
  19. * If no LICENSE file comes with this software, it is provided AS-IS.
  20. *
  21. ******************************************************************************
  22. @verbatim
  23. ==============================================================================
  24. ##### EXTI Peripheral features #####
  25. ==============================================================================
  26. [..]
  27. (+) Each Exti line can be configured within this driver.
  28. (+) Exti line can be configured in 3 different modes
  29. (++) Interrupt
  30. (++) Event
  31. (++) Both of them
  32. (+) Configurable Exti lines can be configured with 3 different triggers
  33. (++) Rising
  34. (++) Falling
  35. (++) Both of them
  36. (+) When set in interrupt mode, configurable Exti lines have two diffenrents
  37. interrupt pending registers which allow to distinguish which transition
  38. occurs:
  39. (++) Rising edge pending interrupt
  40. (++) Falling
  41. (+) Exti lines 0 to 15 are linked to gpio pin number 0 to 15. Gpio port can
  42. be selected through multiplexer.
  43. ##### How to use this driver #####
  44. ==============================================================================
  45. [..]
  46. (#) Configure the EXTI line using HAL_EXTI_SetConfigLine().
  47. (++) Choose the interrupt line number by setting "Line" member from
  48. EXTI_ConfigTypeDef structure.
  49. (++) Configure the interrupt and/or event mode using "Mode" member from
  50. EXTI_ConfigTypeDef structure.
  51. (++) For configurable lines, configure rising and/or falling trigger
  52. "Trigger" member from EXTI_ConfigTypeDef structure.
  53. (++) For Exti lines linked to gpio, choose gpio port using "GPIOSel"
  54. member from GPIO_InitTypeDef structure.
  55. (#) Get current Exti configuration of a dedicated line using
  56. HAL_EXTI_GetConfigLine().
  57. (++) Provide exiting handle as parameter.
  58. (++) Provide pointer on EXTI_ConfigTypeDef structure as second parameter.
  59. (#) Clear Exti configuration of a dedicated line using HAL_EXTI_ClearConfigLine().
  60. (++) Provide exiting handle as parameter.
  61. (#) Register callback to treat Exti interrupts using HAL_EXTI_RegisterCallback().
  62. (++) Provide exiting handle as first parameter.
  63. (++) Provide which callback will be registered using one value from
  64. EXTI_CallbackIDTypeDef.
  65. (++) Provide callback function pointer.
  66. (#) Get interrupt pending bit using HAL_EXTI_GetPending().
  67. (#) Clear interrupt pending bit using HAL_EXTI_ClearPending().
  68. (#) Generate software interrupt using HAL_EXTI_GenerateSWI().
  69. @endverbatim
  70. */
  71. /* Includes ------------------------------------------------------------------*/
  72. #include "stm32g0xx_hal.h"
  73. /** @addtogroup STM32G0xx_HAL_Driver
  74. * @{
  75. */
  76. /** @addtogroup EXTI
  77. * @{
  78. */
  79. /** MISRA C:2012 deviation rule has been granted for following rule:
  80. * Rule-18.1_b - Medium: Array `EXTICR' 1st subscript interval [0,7] may be out
  81. * of bounds [0,3] in following API :
  82. * HAL_EXTI_SetConfigLine
  83. * HAL_EXTI_GetConfigLine
  84. * HAL_EXTI_ClearConfigLine
  85. */
  86. #ifdef HAL_EXTI_MODULE_ENABLED
  87. /* Private typedef -----------------------------------------------------------*/
  88. /* Private defines ------------------------------------------------------------*/
  89. /** @defgroup EXTI_Private_Constants EXTI Private Constants
  90. * @{
  91. */
  92. #define EXTI_MODE_OFFSET 0x04u /* 0x10: offset between CPU IMR/EMR registers */
  93. #define EXTI_CONFIG_OFFSET 0x08u /* 0x20: offset between CPU Rising/Falling configuration registers */
  94. /**
  95. * @}
  96. */
  97. /* Private macros ------------------------------------------------------------*/
  98. /* Private variables ---------------------------------------------------------*/
  99. /* Private function prototypes -----------------------------------------------*/
  100. /* Exported functions --------------------------------------------------------*/
  101. /** @addtogroup EXTI_Exported_Functions
  102. * @{
  103. */
  104. /** @addtogroup EXTI_Exported_Functions_Group1
  105. * @brief Configuration functions
  106. *
  107. @verbatim
  108. ===============================================================================
  109. ##### Configuration functions #####
  110. ===============================================================================
  111. @endverbatim
  112. * @{
  113. */
  114. /**
  115. * @brief Set configuration of a dedicated Exti line.
  116. * @param hexti Exti handle.
  117. * @param pExtiConfig Pointer on EXTI configuration to be set.
  118. * @retval HAL Status.
  119. */
  120. HAL_StatusTypeDef HAL_EXTI_SetConfigLine(EXTI_HandleTypeDef *hexti, EXTI_ConfigTypeDef *pExtiConfig)
  121. {
  122. __IO uint32_t *regaddr;
  123. uint32_t regval;
  124. uint32_t linepos;
  125. uint32_t maskline;
  126. uint32_t offset;
  127. /* Check null pointer */
  128. if ((hexti == NULL) || (pExtiConfig == NULL))
  129. {
  130. return HAL_ERROR;
  131. }
  132. /* Check parameters */
  133. assert_param(IS_EXTI_LINE(pExtiConfig->Line));
  134. assert_param(IS_EXTI_MODE(pExtiConfig->Mode));
  135. /* Assign line number to handle */
  136. hexti->Line = pExtiConfig->Line;
  137. /* compute line register offset and line mask */
  138. offset = ((pExtiConfig->Line & EXTI_REG_MASK) >> EXTI_REG_SHIFT);
  139. linepos = (pExtiConfig->Line & EXTI_PIN_MASK);
  140. maskline = (1uL << linepos);
  141. /* Configure triggers for configurable lines */
  142. if ((pExtiConfig->Line & EXTI_CONFIG) != 0x00u)
  143. {
  144. assert_param(IS_EXTI_TRIGGER(pExtiConfig->Trigger));
  145. /* Configure rising trigger */
  146. regaddr = (&EXTI->RTSR1 + (EXTI_CONFIG_OFFSET * offset));
  147. regval = *regaddr;
  148. /* Mask or set line */
  149. if ((pExtiConfig->Trigger & EXTI_TRIGGER_RISING) != 0x00u)
  150. {
  151. regval |= maskline;
  152. }
  153. else
  154. {
  155. regval &= ~maskline;
  156. }
  157. /* Store rising trigger mode */
  158. *regaddr = regval;
  159. /* Configure falling trigger */
  160. regaddr = (&EXTI->FTSR1 + (EXTI_CONFIG_OFFSET * offset));
  161. regval = *regaddr;
  162. /* Mask or set line */
  163. if ((pExtiConfig->Trigger & EXTI_TRIGGER_FALLING) != 0x00u)
  164. {
  165. regval |= maskline;
  166. }
  167. else
  168. {
  169. regval &= ~maskline;
  170. }
  171. /* Store falling trigger mode */
  172. *regaddr = regval;
  173. /* Configure gpio port selection in case of gpio exti line */
  174. if ((pExtiConfig->Line & EXTI_GPIO) == EXTI_GPIO)
  175. {
  176. assert_param(IS_EXTI_GPIO_PORT(pExtiConfig->GPIOSel));
  177. assert_param(IS_EXTI_GPIO_PIN(linepos));
  178. regval = EXTI->EXTICR[linepos >> 2u];
  179. regval &= ~(EXTI_EXTICR1_EXTI0 << (EXTI_EXTICR1_EXTI1_Pos * (linepos & 0x03u)));
  180. regval |= (pExtiConfig->GPIOSel << (EXTI_EXTICR1_EXTI1_Pos * (linepos & 0x03u)));
  181. EXTI->EXTICR[linepos >> 2u] = regval;
  182. }
  183. }
  184. /* Configure interrupt mode : read current mode */
  185. regaddr = (&EXTI->IMR1 + (EXTI_MODE_OFFSET * offset));
  186. regval = *regaddr;
  187. /* Mask or set line */
  188. if ((pExtiConfig->Mode & EXTI_MODE_INTERRUPT) != 0x00u)
  189. {
  190. regval |= maskline;
  191. }
  192. else
  193. {
  194. regval &= ~maskline;
  195. }
  196. /* Store interrupt mode */
  197. *regaddr = regval;
  198. /* Configure event mode : read current mode */
  199. regaddr = (&EXTI->EMR1 + (EXTI_MODE_OFFSET * offset));
  200. regval = *regaddr;
  201. /* Mask or set line */
  202. if ((pExtiConfig->Mode & EXTI_MODE_EVENT) != 0x00u)
  203. {
  204. regval |= maskline;
  205. }
  206. else
  207. {
  208. regval &= ~maskline;
  209. }
  210. /* Store event mode */
  211. *regaddr = regval;
  212. return HAL_OK;
  213. }
  214. /**
  215. * @brief Get configuration of a dedicated Exti line.
  216. * @param hexti Exti handle.
  217. * @param pExtiConfig Pointer on structure to store Exti configuration.
  218. * @retval HAL Status.
  219. */
  220. HAL_StatusTypeDef HAL_EXTI_GetConfigLine(EXTI_HandleTypeDef *hexti, EXTI_ConfigTypeDef *pExtiConfig)
  221. {
  222. __IO uint32_t *regaddr;
  223. uint32_t regval;
  224. uint32_t linepos;
  225. uint32_t maskline;
  226. uint32_t offset;
  227. /* Check null pointer */
  228. if ((hexti == NULL) || (pExtiConfig == NULL))
  229. {
  230. return HAL_ERROR;
  231. }
  232. /* Check the parameter */
  233. assert_param(IS_EXTI_LINE(hexti->Line));
  234. /* Store handle line number to configiguration structure */
  235. pExtiConfig->Line = hexti->Line;
  236. /* compute line register offset and line mask */
  237. offset = ((pExtiConfig->Line & EXTI_REG_MASK) >> EXTI_REG_SHIFT);
  238. linepos = (pExtiConfig->Line & EXTI_PIN_MASK);
  239. maskline = (1uL << linepos);
  240. /* 1] Get core mode : interrupt */
  241. regaddr = (&EXTI->IMR1 + (EXTI_MODE_OFFSET * offset));
  242. regval = *regaddr;
  243. /* Check if selected line is enable */
  244. if ((regval & maskline) != 0x00u)
  245. {
  246. pExtiConfig->Mode = EXTI_MODE_INTERRUPT;
  247. }
  248. else
  249. {
  250. pExtiConfig->Mode = EXTI_MODE_NONE;
  251. }
  252. /* Get event mode */
  253. regaddr = (&EXTI->EMR1 + (EXTI_MODE_OFFSET * offset));
  254. regval = *regaddr;
  255. /* Check if selected line is enable */
  256. if ((regval & maskline) != 0x00u)
  257. {
  258. pExtiConfig->Mode |= EXTI_MODE_EVENT;
  259. }
  260. /* Get default Trigger and GPIOSel configuration */
  261. pExtiConfig->Trigger = EXTI_TRIGGER_NONE;
  262. pExtiConfig->GPIOSel = 0x00u;
  263. /* 2] Get trigger for configurable lines : rising */
  264. if ((pExtiConfig->Line & EXTI_CONFIG) != 0x00u)
  265. {
  266. regaddr = (&EXTI->RTSR1 + (EXTI_CONFIG_OFFSET * offset));
  267. regval = *regaddr;
  268. /* Check if configuration of selected line is enable */
  269. if ((regval & maskline) != 0x00u)
  270. {
  271. pExtiConfig->Trigger = EXTI_TRIGGER_RISING;
  272. }
  273. /* Get falling configuration */
  274. regaddr = (&EXTI->FTSR1 + (EXTI_CONFIG_OFFSET * offset));
  275. regval = *regaddr;
  276. /* Check if configuration of selected line is enable */
  277. if ((regval & maskline) != 0x00u)
  278. {
  279. pExtiConfig->Trigger |= EXTI_TRIGGER_FALLING;
  280. }
  281. /* Get Gpio port selection for gpio lines */
  282. if ((pExtiConfig->Line & EXTI_GPIO) == EXTI_GPIO)
  283. {
  284. assert_param(IS_EXTI_GPIO_PIN(linepos));
  285. regval = EXTI->EXTICR[linepos >> 2u];
  286. pExtiConfig->GPIOSel = (regval >> (EXTI_EXTICR1_EXTI1_Pos * (linepos & 0x03u))) & EXTI_EXTICR1_EXTI0;
  287. }
  288. }
  289. return HAL_OK;
  290. }
  291. /**
  292. * @brief Clear whole configuration of a dedicated Exti line.
  293. * @param hexti Exti handle.
  294. * @retval HAL Status.
  295. */
  296. HAL_StatusTypeDef HAL_EXTI_ClearConfigLine(EXTI_HandleTypeDef *hexti)
  297. {
  298. __IO uint32_t *regaddr;
  299. uint32_t regval;
  300. uint32_t linepos;
  301. uint32_t maskline;
  302. uint32_t offset;
  303. /* Check null pointer */
  304. if (hexti == NULL)
  305. {
  306. return HAL_ERROR;
  307. }
  308. /* Check the parameter */
  309. assert_param(IS_EXTI_LINE(hexti->Line));
  310. /* compute line register offset and line mask */
  311. offset = ((hexti->Line & EXTI_REG_MASK) >> EXTI_REG_SHIFT);
  312. linepos = (hexti->Line & EXTI_PIN_MASK);
  313. maskline = (1uL << linepos);
  314. /* 1] Clear interrupt mode */
  315. regaddr = (&EXTI->IMR1 + (EXTI_MODE_OFFSET * offset));
  316. regval = (*regaddr & ~maskline);
  317. *regaddr = regval;
  318. /* 2] Clear event mode */
  319. regaddr = (&EXTI->EMR1 + (EXTI_MODE_OFFSET * offset));
  320. regval = (*regaddr & ~maskline);
  321. *regaddr = regval;
  322. /* 3] Clear triggers in case of configurable lines */
  323. if ((hexti->Line & EXTI_CONFIG) != 0x00u)
  324. {
  325. regaddr = (&EXTI->RTSR1 + (EXTI_CONFIG_OFFSET * offset));
  326. regval = (*regaddr & ~maskline);
  327. *regaddr = regval;
  328. regaddr = (&EXTI->FTSR1 + (EXTI_CONFIG_OFFSET * offset));
  329. regval = (*regaddr & ~maskline);
  330. *regaddr = regval;
  331. /* Get Gpio port selection for gpio lines */
  332. if ((hexti->Line & EXTI_GPIO) == EXTI_GPIO)
  333. {
  334. assert_param(IS_EXTI_GPIO_PIN(linepos));
  335. regval = EXTI->EXTICR[linepos >> 2u];
  336. regval &= ~(EXTI_EXTICR1_EXTI0 << (EXTI_EXTICR1_EXTI1_Pos * (linepos & 0x03u)));
  337. EXTI->EXTICR[linepos >> 2u] = regval;
  338. }
  339. }
  340. return HAL_OK;
  341. }
  342. /**
  343. * @brief Register callback for a dedicaated Exti line.
  344. * @param hexti Exti handle.
  345. * @param CallbackID User callback identifier.
  346. * This parameter can be one of @arg @ref EXTI_CallbackIDTypeDef values.
  347. * @param pPendingCbfn function pointer to be stored as callback.
  348. * @retval HAL Status.
  349. */
  350. HAL_StatusTypeDef HAL_EXTI_RegisterCallback(EXTI_HandleTypeDef *hexti, EXTI_CallbackIDTypeDef CallbackID, void (*pPendingCbfn)(void))
  351. {
  352. HAL_StatusTypeDef status = HAL_OK;
  353. switch (CallbackID)
  354. {
  355. case HAL_EXTI_COMMON_CB_ID:
  356. hexti->RisingCallback = pPendingCbfn;
  357. hexti->FallingCallback = pPendingCbfn;
  358. break;
  359. case HAL_EXTI_RISING_CB_ID:
  360. hexti->RisingCallback = pPendingCbfn;
  361. break;
  362. case HAL_EXTI_FALLING_CB_ID:
  363. hexti->FallingCallback = pPendingCbfn;
  364. break;
  365. default:
  366. status = HAL_ERROR;
  367. break;
  368. }
  369. return status;
  370. }
  371. /**
  372. * @brief Store line number as handle private field.
  373. * @param hexti Exti handle.
  374. * @param ExtiLine Exti line number.
  375. * This parameter can be from 0 to @ref EXTI_LINE_NB.
  376. * @retval HAL Status.
  377. */
  378. HAL_StatusTypeDef HAL_EXTI_GetHandle(EXTI_HandleTypeDef *hexti, uint32_t ExtiLine)
  379. {
  380. /* Check the parameters */
  381. assert_param(IS_EXTI_LINE(ExtiLine));
  382. /* Check null pointer */
  383. if (hexti == NULL)
  384. {
  385. return HAL_ERROR;
  386. }
  387. else
  388. {
  389. /* Store line number as handle private field */
  390. hexti->Line = ExtiLine;
  391. return HAL_OK;
  392. }
  393. }
  394. /**
  395. * @}
  396. */
  397. /** @addtogroup EXTI_Exported_Functions_Group2
  398. * @brief EXTI IO functions.
  399. *
  400. @verbatim
  401. ===============================================================================
  402. ##### IO operation functions #####
  403. ===============================================================================
  404. @endverbatim
  405. * @{
  406. */
  407. /**
  408. * @brief Handle EXTI interrupt request.
  409. * @param hexti Exti handle.
  410. * @retval none.
  411. */
  412. void HAL_EXTI_IRQHandler(EXTI_HandleTypeDef *hexti)
  413. {
  414. __IO uint32_t *regaddr;
  415. uint32_t regval;
  416. uint32_t maskline;
  417. uint32_t offset;
  418. /* Compute line register offset and line mask */
  419. offset = ((hexti->Line & EXTI_REG_MASK) >> EXTI_REG_SHIFT);
  420. maskline = (1uL << (hexti->Line & EXTI_PIN_MASK));
  421. /* Get rising edge pending bit */
  422. regaddr = (&EXTI->RPR1 + (EXTI_CONFIG_OFFSET * offset));
  423. regval = (*regaddr & maskline);
  424. if (regval != 0x00u)
  425. {
  426. /* Clear pending bit */
  427. *regaddr = maskline;
  428. /* Call rising callback */
  429. if (hexti->RisingCallback != NULL)
  430. {
  431. hexti->RisingCallback();
  432. }
  433. }
  434. /* Get falling edge pending bit */
  435. regaddr = (&EXTI->FPR1 + (EXTI_CONFIG_OFFSET * offset));
  436. regval = (*regaddr & maskline);
  437. if (regval != 0x00u)
  438. {
  439. /* Clear pending bit */
  440. *regaddr = maskline;
  441. /* Call rising callback */
  442. if (hexti->FallingCallback != NULL)
  443. {
  444. hexti->FallingCallback();
  445. }
  446. }
  447. }
  448. /**
  449. * @brief Get interrupt pending bit of a dedicated line.
  450. * @param hexti Exti handle.
  451. * @param Edge Specify which pending edge as to be checked.
  452. * This parameter can be one of the following values:
  453. * @arg @ref EXTI_TRIGGER_RISING
  454. * @arg @ref EXTI_TRIGGER_FALLING
  455. * @retval 1 if interrupt is pending else 0.
  456. */
  457. uint32_t HAL_EXTI_GetPending(EXTI_HandleTypeDef *hexti, uint32_t Edge)
  458. {
  459. __IO uint32_t *regaddr;
  460. uint32_t regval;
  461. uint32_t linepos;
  462. uint32_t maskline;
  463. uint32_t offset;
  464. /* Check parameters */
  465. assert_param(IS_EXTI_LINE(hexti->Line));
  466. assert_param(IS_EXTI_CONFIG_LINE(hexti->Line));
  467. assert_param(IS_EXTI_PENDING_EDGE(Edge));
  468. /* compute line register offset and line mask */
  469. offset = ((hexti->Line & EXTI_REG_MASK) >> EXTI_REG_SHIFT);
  470. linepos = (hexti->Line & EXTI_PIN_MASK);
  471. maskline = (1uL << linepos);
  472. if (Edge != EXTI_TRIGGER_RISING)
  473. {
  474. /* Get falling edge pending bit */
  475. regaddr = (&EXTI->FPR1 + (EXTI_CONFIG_OFFSET * offset));
  476. }
  477. else
  478. {
  479. /* Get rising edge pending bit */
  480. regaddr = (&EXTI->RPR1 + (EXTI_CONFIG_OFFSET * offset));
  481. }
  482. /* return 1 if bit is set else 0 */
  483. regval = ((*regaddr & maskline) >> linepos);
  484. return regval;
  485. }
  486. /**
  487. * @brief Clear interrupt pending bit of a dedicated line.
  488. * @param hexti Exti handle.
  489. * @param Edge Specify which pending edge as to be clear.
  490. * This parameter can be one of the following values:
  491. * @arg @ref EXTI_TRIGGER_RISING
  492. * @arg @ref EXTI_TRIGGER_FALLING
  493. * @retval None.
  494. */
  495. void HAL_EXTI_ClearPending(EXTI_HandleTypeDef *hexti, uint32_t Edge)
  496. {
  497. __IO uint32_t *regaddr;
  498. uint32_t maskline;
  499. uint32_t offset;
  500. /* Check parameters */
  501. assert_param(IS_EXTI_LINE(hexti->Line));
  502. assert_param(IS_EXTI_CONFIG_LINE(hexti->Line));
  503. assert_param(IS_EXTI_PENDING_EDGE(Edge));
  504. /* compute line register offset and line mask */
  505. offset = ((hexti->Line & EXTI_REG_MASK) >> EXTI_REG_SHIFT);
  506. maskline = (1uL << (hexti->Line & EXTI_PIN_MASK));
  507. if (Edge != EXTI_TRIGGER_RISING)
  508. {
  509. /* Get falling edge pending register address */
  510. regaddr = (&EXTI->FPR1 + (EXTI_CONFIG_OFFSET * offset));
  511. }
  512. else
  513. {
  514. /* Get falling edge pending register address */
  515. regaddr = (&EXTI->RPR1 + (EXTI_CONFIG_OFFSET * offset));
  516. }
  517. /* Clear Pending bit */
  518. *regaddr = maskline;
  519. }
  520. /**
  521. * @brief Generate a software interrupt for a dedicated line.
  522. * @param hexti Exti handle.
  523. * @retval None.
  524. */
  525. void HAL_EXTI_GenerateSWI(EXTI_HandleTypeDef *hexti)
  526. {
  527. __IO uint32_t *regaddr;
  528. uint32_t maskline;
  529. uint32_t offset;
  530. /* Check parameterd */
  531. assert_param(IS_EXTI_LINE(hexti->Line));
  532. assert_param(IS_EXTI_CONFIG_LINE(hexti->Line));
  533. /* compute line register offset and line mask */
  534. offset = ((hexti->Line & EXTI_REG_MASK) >> EXTI_REG_SHIFT);
  535. maskline = (1uL << (hexti->Line & EXTI_PIN_MASK));
  536. regaddr = (&EXTI->SWIER1 + (EXTI_CONFIG_OFFSET * offset));
  537. *regaddr = maskline;
  538. }
  539. /**
  540. * @}
  541. */
  542. /**
  543. * @}
  544. */
  545. #endif /* HAL_EXTI_MODULE_ENABLED */
  546. /**
  547. * @}
  548. */
  549. /**
  550. * @}
  551. */