diff --git a/examples/src/bin/ieee802154_sniffer.rs b/examples/src/bin/ieee802154_sniffer.rs index e345c97b02..ad100fc49d 100644 --- a/examples/src/bin/ieee802154_sniffer.rs +++ b/examples/src/bin/ieee802154_sniffer.rs @@ -42,11 +42,8 @@ fn main() -> ! { let mut cnt = 0; let mut read = [0u8; 2]; loop { - let c = loop { - if let Some(c) = uart0.read_byte() { - break c; - } - }; + let c = uart0.read_byte(); + if c == b'r' { continue; } @@ -81,10 +78,9 @@ fn main() -> ! { println!("@RAW {:02x?}", &frame.data); } - if let Some(c) = uart0.read_byte() { - if c == b'r' { - software_reset(); - } + let mut buff = [0u8; 1]; + if uart0.read_bytes(&mut buff) > 0 && buff[0] == b'r' { + software_reset(); } } }