初级会员

- 积分
- 74
- 金钱
- 74
- 注册时间
- 2019-10-28
- 在线时间
- 24 小时
|
1金钱
函数引用 if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET) ,此时USART_IT_RXNE=0x0525,
ITStatus USART_GetITStatus(USART_TypeDef* USARTx, uint16_t USART_IT)
{
uint32_t bitpos = 0x00, itmask = 0x00, usartreg = 0x00;
ITStatus bitstatus = RESET;
/* Check the parameters */
assert_param(IS_USART_ALL_PERIPH(USARTx));
assert_param(IS_USART_GET_IT(USART_IT));
/* The CTS interrupt is not available for UART4 and UART5 */
if (USART_IT == USART_IT_CTS)
{
assert_param(IS_USART_123_PERIPH(USARTx));
}
/* Get the USART register index */
usartreg = (((uint8_t)USART_IT) >> 0x05);
/* Get the interrupt position */
itmask = USART_IT & IT_Mask;
itmask = (uint32_t)0x01 << itmask;
if (usartreg == 0x01) /* The IT is in CR1 register */
{
itmask &= USARTx->CR1;
}
---------------------------
这里uint16_t USART_IT 是16位, 直接用uint8_t 强转成8位的, 可以吗
|
|