diff options
author | Brian Cully <bjc@kublai.com> | 2022-08-08 13:17:08 -0400 |
---|---|---|
committer | Brian Cully <bjc@kublai.com> | 2022-08-08 13:17:08 -0400 |
commit | 6871c2fd851171c6eab5353b004c5bd8fb1b91a1 (patch) | |
tree | b7aab940ce76818fb93b4f3f2ebc0e788fc88e05 /src/log.rs | |
parent | 70adaaca5e7618969bf3b8ab548eb1f15dda5126 (diff) | |
download | luchie-6871c2fd851171c6eab5353b004c5bd8fb1b91a1.tar.gz luchie-6871c2fd851171c6eab5353b004c5bd8fb1b91a1.zip |
add missing log module
Diffstat (limited to 'src/log.rs')
-rw-r--r-- | src/log.rs | 16 |
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)); +} |