STM32库函数EXTI_GetFlagStatus和EXTI_GetITStatus区别是什么?
2017-09-07 10:41
274 查看
一个是获取状态的,一个是获取中断的。
EXTI_GetFlagStatus只是纯粹读取中断标志位的状态,但是不一定会响应中断(EXT_IMR寄存器对该中断进行屏蔽);而EXTI_GetITStatus除了读取中断标志位,还查看EXT_IMR寄存器是否对该中断进行屏蔽,在中断挂起&没有屏蔽的情况下就会响应中断。仔细看看代码就知道区别了
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;
}
EXTI_GetFlagStatus只是纯粹读取中断标志位的状态,但是不一定会响应中断(EXT_IMR寄存器对该中断进行屏蔽);而EXTI_GetITStatus除了读取中断标志位,还查看EXT_IMR寄存器是否对该中断进行屏蔽,在中断挂起&没有屏蔽的情况下就会响应中断。仔细看看代码就知道区别了
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;
}
相关文章推荐
- STM32库函数EXTI_GetFlagStatus和EXTI_GetITStatus的区别
- STM32库函数EXTI_GetFlagStatus()和EXTI_GetITStatus()区别是什么?
- 关于STM32的USART_GetFlagStatus和USART_GetITStatus解析(异步通信)
- 比较 stm32的 DMA_GetITStatus 和 DMA_GetFlagStatus
- init()方法里的这三个,有什么区别?this.getServletConfig().getInitParameter("username")+"----"+this.getServletConte
- get和post有什么区别
- spring controller @RequestMapping(value = "/welcome") 中get post 和什么都不加的时候区别
- GET和POST有什么区别?及为什么网上多数答案都是错的(转载)
- HTTP协议中POST、GET、HEAD的区别是什么?分别在什么情况下使用?(
- 转载:GET和POST有什么区别
- yum和apt-get有什么区别
- 表单的提交方式POST和GET有什么区别
- getSession(true)和getSession(),有什么区别
- yum和apt-get有什么区别
- 安全测试-- 告诉你什么是XSS、sql注入?POST和GET的区别
- POST和GET两种方式,两种方式有什么区别
- GET和POST有什么区别?及为什么网上的多数答案都是错的
- 使用apt install和使用apt-get install的区别是什么
- session的get()和load()有什么区别?
- Hibernate Session的get()方法和load()方法有什么区别??