aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2022-08-08 13:17:08 -0400
committerBrian Cully <bjc@kublai.com>2022-08-08 13:17:08 -0400
commit6871c2fd851171c6eab5353b004c5bd8fb1b91a1 (patch)
treeb7aab940ce76818fb93b4f3f2ebc0e788fc88e05
parent70adaaca5e7618969bf3b8ab548eb1f15dda5126 (diff)
downloadluchie-6871c2fd851171c6eab5353b004c5bd8fb1b91a1.tar.gz
luchie-6871c2fd851171c6eab5353b004c5bd8fb1b91a1.zip
add missing log module
-rw-r--r--src/log.rs16
1 files changed, 16 insertions, 0 deletions
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<Tx<USART1>> = None;
+
+pub unsafe fn new(tx: Tx<USART1>) {
+ TX = Some(tx);
+}
+
+pub unsafe fn log(str: &str) {
+ TX.as_mut().map(|tx| tx.write_str(str));
+}