From c278f3a2c64a5ad6be4f46f647fb4c3acc333b54 Mon Sep 17 00:00:00 2001 From: Per Lindgren <per.lindgren@ltu.se> Date: Thu, 4 Jan 2018 15:18:55 +0100 Subject: [PATCH] sprintln --- src/lib.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 76cf186..73ebcb5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -33,3 +33,27 @@ macro_rules! ipln { ip!(concat!($fmt, "\n"), $($arg)*); }; } + +/// Macro for sending a formatted string overes semihosting, with a newline. +#[macro_export] +macro_rules! sprintln { + ($($e:tt)*) => { + { + extern crate cortex_m_semihosting; + use core::fmt::Write; + writeln!(cortex_m_semihosting::hio::hstdout().unwrap(), $($e)*).unwrap(); + } + } +} + +/// Macro for sending a formatted string overes semihosting. +#[macro_export] +macro_rules! sprint { + ($($e:tt)*) => { + { + extern crate cortex_m_semihosting; + use core::fmt::Write; + write!(cortex_m_semihosting::hio::hstdout().unwrap(), $($e)*).unwrap(); + } + } +} -- GitLab