aboutsummaryrefslogtreecommitdiff
path: root/src/print.rs
blob: 932c6558abf85b4dcb0c955f5670adc35e2173bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//! Printing
use core::fmt;

use crate::uart::UART_WRITER;
use crate::console::interface::Write;

#[doc(hidden)]
pub fn _print(args: fmt::Arguments) {
	UART_WRITER.write_fmt(args).unwrap();
}

/// Print without newline
#[macro_export]
macro_rules! print {
	($($arg:tt)*) => ($crate::print::_print(format_args!($($arg)*)));
}

/// Print with newline
#[macro_export]
macro_rules! println {
	() => ($crate::print!("\n"));
	($($arg:tt)*) => ({
		$crate::print::_print(format_args_nl!($($arg)*));
	})
}