summaryrefslogtreecommitdiff
path: root/src/serial.rs
blob: 792ddf74b5dcca6d2f6bb42026a7c2994d308fec (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
26
27
28
29
30
//! # Serial Writer
//!
//! Write to serial
//!
//! ```rust
//! #[doc(hidden)]
//! pub fn _serial_print(args: core::fmt::Arguments) {
//!     use core::fmt::Write;
//!     SERIAL1.lock(|serial| {
//!         ...
//!     });
//! }
//! ```

/// Prints to the host through the serial interface.
#[macro_export]
macro_rules! serial_print {
	($($arg:tt)*) => {
		$crate::serial::_print(format_args!($($arg)*));
	};
}

/// Prints to the host through the serial interface, appending a newline.
#[macro_export]
macro_rules! serial_println {
	() => ($crate::serial_print!("\n"));
	($fmt:expr) => ($crate::serial_print!(concat!($fmt, "\n")));
	($fmt:expr, $($arg:tt)*) => ($crate::serial_print!(
				concat!($fmt, "\n"), $($arg)*));
}