int fputc(int ch, FILE *f)
IAR printf重定向到usart
为什么printf之后总是
while(USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET在这里做死循环
int fputc(int ch, FILE *f)
{
/* Place your implementation of fputc here */
/* e.g. write a character to the USART */
USART_SendData(USART2, (u8) ch);
/* Loop until the end of transmission */
while(USART_GetFlagStatus(USART2, USART_FLAG_TC) == RESET)
{}
return ch;
} |