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) { + } +}