diff --git a/src/io.rs b/src/io.rs index a5c2765..b485b25 100644 --- a/src/io.rs +++ b/src/io.rs @@ -49,6 +49,10 @@ impl embedded_io::ReadReady for SerialPort<'_, Bus> { impl embedded_io::Write for SerialPort<'_, Bus> { fn write(&mut self, buf: &[u8]) -> Result { + if buf.is_empty() { + return Ok(0); + } + loop { match self.write(buf) { // We are required by `embedded-io` to continue writing until at least one byte is