diff --git a/examples/loopback.rs b/examples/loopback.rs index 4a1e70509770085c26a2c383d0deded8c76418bc..48872eec184a19e51a3cdab2e1c5743cd7d73412 100644 --- a/examples/loopback.rs +++ b/examples/loopback.rs @@ -50,6 +50,10 @@ app! { path: error_usart_overflow, priority: 1, }, + EXTI4: { + path: rxne_not_set, + priority: 1, + }, } } @@ -104,16 +108,19 @@ fn usart2_handler(_t: &mut Threshold, r: USART2::Resources) { r.USART2.dr.read(); // clear the error by reading the data register } } - } - - match r.SEND.dequeue() { - Some(b) => { - // we (still) have something in the queue to send - let _ = serial.write(b); - } - _ => { - // the que was empty so the last item was already sent - serial.unlisten(Event::Txe); + } else { + // rxne not set + rtfm::set_pending(f4::stm32f40x::Interrupt::EXTI4); + + match r.SEND.dequeue() { + Some(b) => { + // we (still) have something in the queue to send + let _ = serial.write(b); + } + _ => { + // the que was empty so the last item was already sent + serial.unlisten(Event::Txe); + } } } } @@ -161,6 +168,10 @@ fn error_usart_overflow() { ipln!("error_usart_overflow"); } +fn rxne_not_set() { + ip!("-"); +} + #[derive(Debug)] enum Command { Start,