aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorchemicstry <[email protected]>2022-05-26 14:11:15 +0300
committerchemicstry <[email protected]>2022-05-26 14:11:15 +0300
commit667abe6d1d78cc989fb57884643f4d2f5834ea52 (patch)
treefc4b90680c004b3397686f5f2691998201bb386d /examples
parent4b6162694a65bf8629da62499046b8f22cf3175e (diff)
Simplify example
Diffstat (limited to 'examples')
-rw-r--r--examples/stm32f4/src/bin/usart_buffered.rs8
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 c5fbbbe5d..80b65f0d4 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) {
26 unsafe { BufferedUart::new(&mut state, usart, irq, &mut tx_buf, &mut rx_buf) }; 26 unsafe { BufferedUart::new(&mut state, usart, irq, &mut tx_buf, &mut rx_buf) };
27 27
28 loop { 28 loop {
29 let n = { 29 let buf = buf_usart.fill_buf().await.unwrap();
30 let buf = buf_usart.fill_buf().await.unwrap(); 30 info!("Received: {}", buf);
31 info!("Received: {}", buf);
32 buf.len()
33 };
34 31
35 // Read bytes have to be explicitly consumed, otherwise fill_buf() will return them again 32 // Read bytes have to be explicitly consumed, otherwise fill_buf() will return them again
33 let n = buf.len();
36 buf_usart.consume(n); 34 buf_usart.consume(n);
37 } 35 }
38} 36}