【bsp/stm32f10x】 修复串口驱动 | Fixed serial port drivers

This commit is contained in:
BalanceTWK 2018-12-06 11:40:49 +08:00
parent 538923d34e
commit 73d39e89ec
1 changed files with 1 additions and 2 deletions

View File

@ -101,8 +101,6 @@ static rt_err_t stm32_configure(struct rt_serial_device *serial, struct serial_c
/* Enable USART */ /* Enable USART */
USART_Cmd(uart->uart_device, ENABLE); USART_Cmd(uart->uart_device, ENABLE);
USART_ClearFlag(uart->uart_device,USART_FLAG_TC);
return RT_EOK; return RT_EOK;
} }
@ -159,6 +157,7 @@ static int stm32_putc(struct rt_serial_device *serial, char c)
} }
else else
{ {
USART_ClearFlag(uart->uart_device,USART_FLAG_TC);
uart->uart_device->DR = c; uart->uart_device->DR = c;
while (!(uart->uart_device->SR & USART_FLAG_TC)); while (!(uart->uart_device->SR & USART_FLAG_TC));
} }