From 6871c2fd851171c6eab5353b004c5bd8fb1b91a1 Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Mon, 8 Aug 2022 13:17:08 -0400 Subject: add missing log module --- src/log.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/log.rs diff --git a/src/log.rs b/src/log.rs new file mode 100644 index 0000000..07525cc --- /dev/null +++ b/src/log.rs @@ -0,0 +1,16 @@ +use core::fmt::Write; + +use gd32vf103xx_hal::{ + pac::USART1, + serial::Tx, +}; + +static mut TX: Option> = None; + +pub unsafe fn new(tx: Tx) { + TX = Some(tx); +} + +pub unsafe fn log(str: &str) { + TX.as_mut().map(|tx| tx.write_str(str)); +} -- cgit v1.2.3