From f9254fdffa29fc62ad1a576f58669ea532536dc2 Mon Sep 17 00:00:00 2001 From: Nic0w <nico.broquet@gmail.com> Date: Sun, 25 Apr 2021 20:00:56 +0200 Subject: [PATCH] Increment byte_written after write has happened. Co-authored-by: tdittr <tdittr@users.noreply.github.com> --- rp2040-hal/src/uart.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rp2040-hal/src/uart.rs b/rp2040-hal/src/uart.rs index 2f59c00..4ede6d8 100644 --- a/rp2040-hal/src/uart.rs +++ b/rp2040-hal/src/uart.rs @@ -209,12 +209,12 @@ impl<D: UARTDevice> UARTPeripheral<Enabled, D> { } } - bytes_written += 1; - self.device.uartdr.write(|w| unsafe { w.data().bits(*c); w - }) + }); + + bytes_written += 1; } Ok(bytes_written) }