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)); }