#define USART_IT_PE ((uint16_t)0x0028)
#define USART_IT_TXE ((uint16_t)0x0727)
#define USART_IT_TC ((uint16_t)0x0626)
#define USART_IT_RXNE ((uint16_t)0x0525)
#define USART_IT_IDLE ((uint16_t)0x0424)
#define USART_IT_LBD ((uint16_t)0x0846)
#define USART_IT_CTS ((uint16_t)0x096A)
#define USART_IT_ERR ((uint16_t)0x0060)
#define USART_IT_ORE ((uint16_t)0x0360)
#define USART_IT_NE ((uint16_t)0x0260)
#define USART_IT_FE ((uint16_t)0x0160)
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
今天看到了,对着楼主的分析了一下,确实如楼主所言。不明白的是每一个中断使能都在手册里可以查到具体的地址,为什么不用结构体指针的方式直接定位到呢?反而要通过几次计算,得到偏移地址再定位。像这种
if (NewState != DISABLE)
{
/* Enable the selected USART by setting the UE bit in the CR1 register */
USARTx->CR1 |= USART_CR1_UE;
}
else
{
/* Disable the selected USART by clearing the UE bit in the CR1 register */
USARTx->CR1 &= (uint16_t)~((uint16_t)USART_CR1_UE);
}
一周热门 更多>