From a2792182952c953aab2c442bb02ac1f2e4986e67 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sun, 4 Nov 2018 19:57:39 +0100 Subject: use new cortex_m_semihosting::hprintln macro --- examples/message.rs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'examples/message.rs') diff --git a/examples/message.rs b/examples/message.rs index 1ff08b2..b5d68a6 100644 --- a/examples/message.rs +++ b/examples/message.rs @@ -7,19 +7,9 @@ extern crate panic_semihosting; -use cortex_m_semihosting::debug; +use cortex_m_semihosting::{debug, hprintln}; use rtfm::app; -macro_rules! println { - ($($tt:tt)*) => { - if let Ok(mut stdout) = cortex_m_semihosting::hio::hstdout() { - use core::fmt::Write; - - writeln!(stdout, $($tt)*).ok(); - } - }; -} - #[app(device = lm3s6965)] const APP: () = { #[init(spawn = [foo])] @@ -31,7 +21,7 @@ const APP: () = { fn foo() { static mut COUNT: u32 = 0; - println!("foo"); + hprintln!("foo").unwrap(); spawn.bar(*COUNT).unwrap(); *COUNT += 1; @@ -39,14 +29,14 @@ const APP: () = { #[task(spawn = [baz])] fn bar(x: u32) { - println!("bar({})", x); + hprintln!("bar({})", x).unwrap(); spawn.baz(x + 1, x + 2).unwrap(); } #[task(spawn = [foo])] fn baz(x: u32, y: u32) { - println!("baz({}, {})", x, y); + hprintln!("baz({}, {})", x, y).unwrap(); if x + y > 4 { debug::exit(debug::EXIT_SUCCESS); -- cgit v1.2.3