aboutsummaryrefslogtreecommitdiffstats
path: root/src/log.rs
blob: 07525cc55343a6b43515aa78d8d1f1b877f902d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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));
}