From 931a137f8c5a760c2e06c437c98d14eff3e3a587 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Wed, 4 May 2022 20:48:37 +0200 Subject: Replace embassy::io with embedded_io. --- examples/std/src/bin/serial.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'examples/std/src/bin/serial.rs') 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; use async_io::Async; use embassy::executor::Executor; -use embassy::io::AsyncBufReadExt; use embassy::util::Forever; +use embedded_io::asynch::Read; use log::*; use nix::sys::termios; @@ -24,12 +24,12 @@ async fn run() { // Essentially, async_io::Async converts from AsRawFd+Read+Write to futures's AsyncRead+AsyncWrite let port = Async::new(port).unwrap(); - // This implements futures's AsyncBufRead based on futures's AsyncRead - let port = futures::io::BufReader::new(port); - - // We can then use FromStdIo to convert from futures's AsyncBufRead+AsyncWrite - // to embassy's AsyncBufRead+AsyncWrite - let mut port = embassy::io::FromStdIo::new(port); + // We can then use FromStdIo to convert from futures's AsyncRead+AsyncWrite + // to embedded_io's async Read+Write. + // + // This is not really needed, you could write the code below using futures::io directly. + // It's useful if you want to have portable code across embedded and std. + let mut port = embedded_io::adapters::FromFutures::new(port); info!("Serial opened!"); -- cgit