Simplify example
This commit is contained in:
parent
4b6162694a
commit
667abe6d1d
@ -26,13 +26,11 @@ async fn main(_spawner: Spawner, p: Peripherals) {
|
||||
unsafe { BufferedUart::new(&mut state, usart, irq, &mut tx_buf, &mut rx_buf) };
|
||||
|
||||
loop {
|
||||
let n = {
|
||||
let buf = buf_usart.fill_buf().await.unwrap();
|
||||
info!("Received: {}", buf);
|
||||
buf.len()
|
||||
};
|
||||
let buf = buf_usart.fill_buf().await.unwrap();
|
||||
info!("Received: {}", buf);
|
||||
|
||||
// Read bytes have to be explicitly consumed, otherwise fill_buf() will return them again
|
||||
let n = buf.len();
|
||||
buf_usart.consume(n);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user