一個是獲取狀態(tài)的,一個是獲取中斷的。EXTI_GetFlagStatus只是純粹讀取中斷標志位的狀態(tài),但是不一定會響應中斷(EXT_IMR寄存器對該中斷進行屏蔽);而EXTI_GetITStatus除了讀取中斷標志位,還查看EXT_IMR寄存器是否對該中斷進行屏蔽,在中斷掛起&沒有屏蔽的情況下就會響應中斷。仔細看看代碼就知道區(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://www.butianyuan.cn/article/201611/320934.htm
評論