From d38ffc1c658476a5c28e3d70ac9abd300f914433 Mon Sep 17 00:00:00 2001 From: Michael Hope Date: Wed, 20 Oct 2010 21:06:17 +1300 Subject: Wait until the transmit buffer is empty before send to save time --- libmaple/usart.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libmaple/usart.h b/libmaple/usart.h index 593fb8f..cbc7bde 100644 --- a/libmaple/usart.h +++ b/libmaple/usart.h @@ -76,11 +76,11 @@ extern struct usart_dev usart_dev_table[]; static inline void usart_putc(uint8 usart_num, uint8 byte) { usart_port *port = usart_dev_table[usart_num].base; - port->DR = byte; - - /* Wait for transmission to complete */ + /* Wait for the buffer to empty */ while ((port->SR & USART_TXE) == 0) ; + + port->DR = byte; } /** -- cgit v1.2.3