diff options
author | chemicstry <chemicstry@gmail.com> | 2022-05-26 14:11:15 +0300 |
---|---|---|
committer | chemicstry <chemicstry@gmail.com> | 2022-05-26 14:11:15 +0300 |
commit | 667abe6d1d78cc989fb57884643f4d2f5834ea52 (patch) | |
tree | fc4b90680c004b3397686f5f2691998201bb386d /examples/stm32f4/src/bin | |
parent | 4b6162694a65bf8629da62499046b8f22cf3175e (diff) | |
download | embassy-667abe6d1d78cc989fb57884643f4d2f5834ea52.zip |
Simplify example
Diffstat (limited to 'examples/stm32f4/src/bin')
-rw-r--r-- | examples/stm32f4/src/bin/usart_buffered.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/examples/stm32f4/src/bin/usart_buffered.rs b/examples/stm32f4/src/bin/usart_buffered.rs index c5fbbbe5..80b65f0d 100644 --- a/examples/stm32f4/src/bin/usart_buffered.rs +++ b/examples/stm32f4/src/bin/usart_buffered.rs @@ -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); } } |