-
Notifications
You must be signed in to change notification settings - Fork 35
/
macros.rs
45 lines (42 loc) · 1.08 KB
/
macros.rs
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/// Macro for sending `print!`-formatted messages to the ITM (Instrumentation
/// Trace Macrocell).
#[macro_export]
macro_rules! iprint {
($s:expr) => {
$crate::itm::write_str($s)
};
($($arg:tt)*) => {
$crate::itm::write_fmt(format_args!($($arg)*))
};
}
/// Macro for sending `print!`-formatted messages to the ITM, with a newline
#[macro_export]
macro_rules! iprintln {
($fmt:expr) => {
iprint!(concat!($fmt, "\n"))
};
($fmt:expr, $($arg:tt)*) => {
iprint!(concat!($fmt, "\n"), $($arg)*)
};
}
/// Macro for sending `print!`-formatted messages over the Serial Port
#[macro_export]
macro_rules! uprint {
($s:expr) => {
$crate::serial::write_str($s)
};
($($arg:tt)*) => {
$crate::serial::write_fmt(format_args!($($arg)*))
};
}
/// Macro for sending `print!`-formatted messages over the Serial Port, with a
/// newline
#[macro_export]
macro_rules! uprintln {
($fmt:expr) => {
uprint!(concat!($fmt, "\n"))
};
($fmt:expr, $($arg:tt)*) => {
uprint!(concat!($fmt, "\n"), $($arg)*)
};
}