aboutsummaryrefslogtreecommitdiff
path: root/examples/std/src/bin/serial.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/std/src/bin/serial.rs')
-rw-r--r--examples/std/src/bin/serial.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/std/src/bin/serial.rs b/examples/std/src/bin/serial.rs
index 129dc2090..b1e5b0142 100644
--- a/examples/std/src/bin/serial.rs
+++ b/examples/std/src/bin/serial.rs
@@ -5,8 +5,8 @@ mod serial_port;
5 5
6use async_io::Async; 6use async_io::Async;
7use embassy::executor::Executor; 7use embassy::executor::Executor;
8use embassy::io::AsyncBufReadExt;
9use embassy::util::Forever; 8use embassy::util::Forever;
9use embedded_io::asynch::Read;
10use log::*; 10use log::*;
11use nix::sys::termios; 11use nix::sys::termios;
12 12
@@ -24,12 +24,12 @@ async fn run() {
24 // Essentially, async_io::Async converts from AsRawFd+Read+Write to futures's AsyncRead+AsyncWrite 24 // Essentially, async_io::Async converts from AsRawFd+Read+Write to futures's AsyncRead+AsyncWrite
25 let port = Async::new(port).unwrap(); 25 let port = Async::new(port).unwrap();
26 26
27 // This implements futures's AsyncBufRead based on futures's AsyncRead 27 // We can then use FromStdIo to convert from futures's AsyncRead+AsyncWrite
28 let port = futures::io::BufReader::new(port); 28 // to embedded_io's async Read+Write.
29 29 //
30 // We can then use FromStdIo to convert from futures's AsyncBufRead+AsyncWrite 30 // This is not really needed, you could write the code below using futures::io directly.
31 // to embassy's AsyncBufRead+AsyncWrite 31 // It's useful if you want to have portable code across embedded and std.
32 let mut port = embassy::io::FromStdIo::new(port); 32 let mut port = embedded_io::adapters::FromFutures::new(port);
33 33
34 info!("Serial opened!"); 34 info!("Serial opened!");
35 35