EXTI_GetITStatus()函数的内核代码是什么
时间: 2024-05-08 13:15:04 浏览: 15
EXTI_GetITStatus()函数的内核代码如下:
```
FlagStatus EXTI_GetITStatus(uint32_t EXTI_Line)
{
FlagStatus bitstatus = RESET;
uint32_t enablestatus = 0;
/* Check the parameters */
assert_param(IS_GET_EXTI_LINE(EXTI_Line));
enablestatus = EXTI->IMR & EXTI_Line;
if (((EXTI->PR & EXTI_Line) != (uint32_t)RESET) && (enablestatus != (uint32_t)RESET))
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
}
```
该函数的作用是获取外部中断线的中断状态。
首先,函数会检查传入的参数是否合法,即参数 EXTI_Line 是否在有效范围内。
然后,函数会读取 EXTI_IMR 寄存器,获取要查询的外部中断线的中断使能状态。
接着,函数会读取 EXTI_PR 寄存器,获取要查询的外部中断线的中断挂起状态。如果该外部中断线的中断挂起状态不为 0,并且该外部中断线的中断使能状态也不为 0,则说明该外部中断线的中断已经发生。
最后,函数会将中断状态返回给调用者。如果该外部中断线的中断已经发生,则返回 SET;否则,返回 RESET。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)