aboutsummaryrefslogtreecommitdiff
path: root/src/macros.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/macros.rs')
-rw-r--r--src/macros.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/macros.rs b/src/macros.rs
index bd31167..1c39f18 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -27,3 +27,28 @@ macro_rules! hprintln {
($fmt:expr) => (hprint!(concat!($fmt, "\n")));
($fmt:expr, $($arg:tt)*) => (hprint!(concat!($fmt, "\n"), $($arg)*));
}
+
+/// Macro for sending a formatted string through an ITM channel
+#[macro_export]
+macro_rules! iprint {
+ ($channel:expr, $s:expr) => {
+ $crate::itm::write_str($channel, $s);
+ };
+ ($channel:expr, $($arg:tt)*) => {
+ $crate::itm::write_fmt($channel, format_args!($($arg)*));
+ };
+}
+
+/// Macro for sending a formatted string through an ITM channel, with a newline.
+#[macro_export]
+macro_rules! iprintln {
+ ($channel:expr) => {
+ iprint!($channel, "\n");
+ };
+ ($channel:expr, $fmt:expr) => {
+ iprint!($channel, concat!($fmt, "\n"));
+ };
+ ($channel:expr, $fmt:expr, $($arg:tt)*) => {
+ iprint!($channel, concat!($fmt, "\n"), $($arg)*);
+ };
+}