一個(gè)是獲取狀態(tài)的,一個(gè)是獲取中斷的。EXTI_GetFlagStatus只是純粹讀取中斷標(biāo)志位的狀態(tài),但是不一定會(huì)響應(yīng)中斷(EXT_IMR寄存器對(duì)該中斷進(jìn)行屏蔽);而EXTI_GetITStatus除了讀取中斷標(biāo)志位,還查看EXT_IMR寄存器是否對(duì)該中斷進(jìn)行屏蔽,在中斷掛起&沒(méi)有屏蔽的情況下就會(huì)響應(yīng)中斷。仔細(xì)看看代碼就知道區(qū)別了
FlagStatus EXTI_GetFlagStatus(uint32_t EXTI_Line)
{
FlagStatus bitstatus = RESET;
assert_param(IS_GET_EXTI_LINE(EXTI_Line));
if ((EXTI->PR & EXTI_Line) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
}
ITStatus EXTI_GetITStatus(uint32_t EXTI_Line)
{
ITStatus bitstatus = RESET;
uint32_t enablestatus = 0;
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;
}
本文引用地址:
http://m.butianyuan.cn/article/201611/320934.htm
評(píng)論