main: fix wfi, revise leds, unreachable end
This commit is contained in:
parent
9af94e7616
commit
9ec32ca0a2
21
src/main.rs
21
src/main.rs
@ -105,36 +105,39 @@ fn main() -> ! {
|
||||
Server::run(iface, |server| {
|
||||
let mut last_output = 0_u32;
|
||||
loop {
|
||||
led_green.on();
|
||||
let now = timer::now().0;
|
||||
let instant = Instant::from_millis(now as i64);
|
||||
server.poll(instant);
|
||||
led_green.off();
|
||||
|
||||
led_blue.on();
|
||||
cortex_m::interrupt::free(net::clear_pending);
|
||||
server.poll(instant)
|
||||
.unwrap_or_else(|e| {
|
||||
warn!("poll: {:?}", e);
|
||||
});
|
||||
led_blue.off();
|
||||
|
||||
let now = timer::now().0;
|
||||
if now - last_output >= OUTPUT_INTERVAL {
|
||||
led_red.on();
|
||||
let adc_value = adc_input.read();
|
||||
write!(server, "t={},pa3={}\r\n", now, adc_value).unwrap();
|
||||
last_output = now;
|
||||
led_red.off();
|
||||
}
|
||||
led_blue.off();
|
||||
|
||||
// Update watchdog
|
||||
wd.feed();
|
||||
|
||||
led_red.on();
|
||||
cortex_m::interrupt::free(|cs| {
|
||||
if !net::is_pending(cs) {
|
||||
led_green.on();
|
||||
// Wait for interrupts
|
||||
wfi();
|
||||
net::clear_pending(cs);
|
||||
led_green.off();
|
||||
}
|
||||
});
|
||||
led_red.off();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
unimplemented!()
|
||||
unreachable!()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user