From 75c863c8f6dffabcc09437348ebf490c16a2ab00 Mon Sep 17 00:00:00 2001 From: soypat Date: Sat, 11 Mar 2023 10:36:53 -0300 Subject: [PATCH] add Flush for UART --- src/machine/machine_rp2040_uart.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/machine/machine_rp2040_uart.go b/src/machine/machine_rp2040_uart.go index b4053aeb92..713cd863f8 100644 --- a/src/machine/machine_rp2040_uart.go +++ b/src/machine/machine_rp2040_uart.go @@ -131,3 +131,9 @@ func (uart *UART) handleInterrupt(interrupt.Interrupt) { } uart.Receive(byte((uart.Bus.UARTDR.Get() & 0xFF))) } + +// Flush blocks until all bytes in UART transmit buffer have been sent over the wire. +func (uart *UART) Flush() { + for uart.Bus.UARTFR.HasBits(rp.UART0_UARTFR_BUSY) { + } +}