From 66ee8a34f3bcde31f9d5919f2e0e363ac11f4aca Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Thu, 18 Aug 2022 20:37:09 -0700 Subject: Formatted printing to UART --- src/console.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/console.rs (limited to 'src/console.rs') diff --git a/src/console.rs b/src/console.rs new file mode 100644 index 0000000..bcde05a --- /dev/null +++ b/src/console.rs @@ -0,0 +1,18 @@ +pub mod interface { + use core::fmt; + pub trait Write { + fn write_char(&self, c: char); + fn write_fmt(&self, args: fmt::Arguments) -> fmt::Result; + fn flush(&self); + } + + pub trait Statistics { + fn chars_written(&self) -> usize { 0 } + } + + pub trait All: Write + Statistics {} +} + +pub fn console() -> &'static crate::uart::Uart { + &crate::uart::UART_WRITER +} -- cgit v1.2.1