//! 系统控制台输出

use core::fmt;

use crate::bsp::__console_output;

/// 向控制台打印格式化字符
#[inline(always)]
pub fn console_output(args: fmt::Arguments<'_>) {
    unsafe {
        __console_output(args);
    }
}

/// 向控制台输出
#[macro_export]
macro_rules! print {
    ($($arg:tt)*) => {{
        $crate::print::console_output(core::format_args!($($arg)*));
    }};
}

/// 向控制台输出并换行
#[macro_export]
#[allow_internal_unstable(format_args_nl)]
macro_rules! println {
    () => {
        $crate::print!("\n")
    };
    ($($arg:tt)*) => {{
        $crate::print::console_output(core::format_args_nl!($($arg)*));
    }};
}
