use hprint macros
This commit is contained in:
@@ -27,11 +27,9 @@
|
||||
#[allow(unused_extern_crates)]
|
||||
extern crate panic_halt;
|
||||
|
||||
use core::fmt::Write;
|
||||
|
||||
use cortex_m::peripheral::syst::SystClkSource;
|
||||
use cortex_m_rt::entry;
|
||||
use cortex_m_semihosting::hio::{self, HStdout};
|
||||
use cortex_m_semihosting::hprint;
|
||||
use stm32f30x::{interrupt, Interrupt};
|
||||
|
||||
#[entry]
|
||||
@@ -58,14 +56,8 @@ fn main() -> ! {
|
||||
}
|
||||
|
||||
// try commenting out this line: you'll end in `default_handler` instead of in `exti0`
|
||||
interrupt!(EXTI0, exti0, state: Option<HStdout> = None);
|
||||
interrupt!(EXTI0, exti0);
|
||||
|
||||
fn exti0(state: &mut Option<HStdout>) {
|
||||
if state.is_none() {
|
||||
*state = Some(hio::hstdout().unwrap());
|
||||
}
|
||||
|
||||
if let Some(hstdout) = state.as_mut() {
|
||||
hstdout.write_str(".").unwrap();
|
||||
}
|
||||
fn exti0() {
|
||||
hprint!(".").unwrap();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user