From 4ab6fb627195afc68eee523a634f4bc9bc065dce Mon Sep 17 00:00:00 2001 From: Astro Date: Sat, 25 Apr 2020 00:28:17 +0200 Subject: [PATCH] libboard_zynq: use Void in uart embedded_hal impl --- Cargo.lock | 1 + libboard_zynq/Cargo.toml | 1 + libboard_zynq/src/uart/mod.rs | 7 ++++--- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d3942f2..c42bfe4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -66,6 +66,7 @@ dependencies = [ "libregister 0.0.0", "nb 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "smoltcp 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "volatile-register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/libboard_zynq/Cargo.toml b/libboard_zynq/Cargo.toml index cf104c1..676069e 100644 --- a/libboard_zynq/Cargo.toml +++ b/libboard_zynq/Cargo.toml @@ -14,6 +14,7 @@ volatile-register = "0.2" bit_field = "0.10" embedded-hal = "0.2" nb = "0.1" +void = { version = "1", default-features = false } libregister = { path = "../libregister" } libcortex_a9 = { path = "../libcortex_a9" } diff --git a/libboard_zynq/src/uart/mod.rs b/libboard_zynq/src/uart/mod.rs index 55d6b96..12ce557 100644 --- a/libboard_zynq/src/uart/mod.rs +++ b/libboard_zynq/src/uart/mod.rs @@ -1,4 +1,5 @@ use core::fmt; +use void::Void; use libregister::*; use super::slcr; @@ -209,9 +210,9 @@ impl fmt::Write for Uart { /// embedded_hal async API impl embedded_hal::serial::Write for Uart { - type Error = (); + type Error = Void; - fn write(&mut self, b: u8) -> nb::Result<(), ()> { + fn write(&mut self, b: u8) -> nb::Result<(), Void> { if self.tx_fifo_full() { Err(nb::Error::WouldBlock) } else { @@ -220,7 +221,7 @@ impl embedded_hal::serial::Write for Uart { } } - fn flush(&mut self) -> nb::Result<(), ()> { + fn flush(&mut self) -> nb::Result<(), Void> { if self.tx_fifo_empty() { Ok(()) } else {