diff --git a/src/lib.rs b/src/lib.rs index 76cf1865b9a7ae3f9363d5efdd45deedd408d69f..73ebcb549f57ca193f7b1124dd6f20880b62b155 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(); + } + } +}