File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,6 +105,15 @@ void uart_tx_one_char(uint8 uart, uint8 TxChar) {
105105 WRITE_PERI_REG (UART_FIFO (uart ), TxChar );
106106}
107107
108+ void uart_flush (uint8 uart ) {
109+ while (true) {
110+ uint32 fifo_cnt = READ_PERI_REG (UART_STATUS (uart )) & (UART_TXFIFO_CNT <<UART_TXFIFO_CNT_S );
111+ if ((fifo_cnt >> UART_TXFIFO_CNT_S & UART_TXFIFO_CNT ) == 0 ) {
112+ break ;
113+ }
114+ }
115+ }
116+
108117/******************************************************************************
109118 * FunctionName : uart1_write_char
110119 * Description : Internal used function
Original file line number Diff line number Diff line change @@ -92,5 +92,6 @@ typedef struct {
9292void uart_init (UartBautRate uart0_br , UartBautRate uart1_br );
9393int uart0_rx (void );
9494void uart_tx_one_char (uint8 uart , uint8 TxChar );
95+ void uart_flush (uint8 uart );
9596
9697#endif // _INCLUDED_UART_H_
You can’t perform that action at this time.
0 commit comments