From 6c91fb4e92cccdb4ce16514feb6957c161f0a707 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Wed, 8 Jan 2025 14:08:03 +0100 Subject: [PATCH] fix: Adapt ieee802154 example --- examples/src/bin/ieee802154_sniffer.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/examples/src/bin/ieee802154_sniffer.rs b/examples/src/bin/ieee802154_sniffer.rs index 125ec77744..f9005c4301 100644 --- a/examples/src/bin/ieee802154_sniffer.rs +++ b/examples/src/bin/ieee802154_sniffer.rs @@ -39,11 +39,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; } @@ -78,10 +75,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(); } } }