summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <dirbaio@dirbaio.net>2022-08-30 19:25:36 +0200
committerDario Nieuwenhuis <dirbaio@dirbaio.net>2022-08-30 19:43:32 +0200
commit464ae67108c74efe38326b6ac8fedd29857e9412 (patch)
tree773ad62cfef9dfd10b4802086dee18b6007edd54
parent92ed95780df854b136eaf0095b51badd34f7581b (diff)
downloadembassy-464ae67108c74efe38326b6ac8fedd29857e9412.zip
net: feature-gate nightly-only async traits to allow building on stable.
-rwxr-xr-xci.sh5
-rwxr-xr-xci_stable.sh2
-rw-r--r--embassy-net/Cargo.toml8
-rw-r--r--embassy-net/src/lib.rs3
-rw-r--r--embassy-net/src/tcp.rs120
-rw-r--r--examples/nrf/Cargo.toml2
-rw-r--r--examples/nrf/src/bin/usb_ethernet.rs2
-rw-r--r--examples/rp/Cargo.toml2
-rw-r--r--examples/rp/src/bin/usb_ethernet.rs2
-rw-r--r--examples/std/Cargo.toml2
-rw-r--r--examples/stm32f7/Cargo.toml2
-rw-r--r--examples/stm32h7/Cargo.toml2
-rw-r--r--examples/stm32l5/Cargo.toml2
-rw-r--r--examples/stm32l5/src/bin/usb_ethernet.rs3
-rw-r--r--examples/stm32l5/src/bin/usb_hid_mouse.rs7
-rw-r--r--examples/stm32l5/src/bin/usb_serial.rs1
16 files changed, 99 insertions, 66 deletions
diff --git a/ci.sh b/ci.sh
index 77a8a7e2..0e2af1e4 100755
--- a/ci.sh
+++ b/ci.sh
@@ -36,6 +36,10 @@ cargo batch \
--- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features nightly,log \
--- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features nightly,defmt \
--- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv6m-none-eabi --features nightly,defmt \
+ --- build --release --manifest-path embassy-net/Cargo.toml --target thumbv7em-none-eabi --features defmt,tcp,udp,dns,dhcpv4,medium-ethernet,pool-16,embassy-time/tick-1mhz \
+ --- build --release --manifest-path embassy-net/Cargo.toml --target thumbv7em-none-eabi --features defmt,tcp,udp,dns,dhcpv4,medium-ethernet,pool-16,embassy-time/tick-1mhz,unstable-traits \
+ --- build --release --manifest-path embassy-net/Cargo.toml --target thumbv7em-none-eabi --features defmt,tcp,udp,dns,dhcpv4,medium-ethernet,pool-16,embassy-time/tick-1mhz,nightly \
+ --- build --release --manifest-path embassy-net/Cargo.toml --target thumbv7em-none-eabi --features defmt,tcp,udp,dns,dhcpv4,medium-ethernet,pool-16,embassy-time/tick-1mhz,unstable-traits,nightly \
--- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nightly,nrf52805,gpiote,time-driver-rtc1 \
--- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nightly,nrf52810,gpiote,time-driver-rtc1 \
--- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nightly,nrf52811,gpiote,time-driver-rtc1 \
@@ -94,6 +98,7 @@ cargo batch \
--- build --release --manifest-path examples/stm32l0/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/stm32l0 \
--- build --release --manifest-path examples/stm32l1/Cargo.toml --target thumbv7m-none-eabi --out-dir out/examples/stm32l1 \
--- build --release --manifest-path examples/stm32l4/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32l4 \
+ --- build --release --manifest-path examples/stm32l5/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/stm32l5 \
--- build --release --manifest-path examples/stm32u5/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/stm32u5 \
--- build --release --manifest-path examples/stm32wb/Cargo.toml --target thumbv7em-none-eabihf --out-dir out/examples/stm32wb \
--- build --release --manifest-path examples/stm32wl/Cargo.toml --target thumbv7em-none-eabihf --out-dir out/examples/stm32wl \
diff --git a/ci_stable.sh b/ci_stable.sh
index d388cfee..02e63052 100755
--- a/ci_stable.sh
+++ b/ci_stable.sh
@@ -13,6 +13,8 @@ cargo batch \
--- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features log \
--- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features defmt \
--- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv6m-none-eabi --features defmt \
+ --- build --release --manifest-path embassy-net/Cargo.toml --target thumbv7em-none-eabi --features defmt,tcp,udp,dns,dhcpv4,medium-ethernet,pool-16,embassy-time/tick-1mhz \
+ --- build --release --manifest-path embassy-net/Cargo.toml --target thumbv7em-none-eabi --features defmt,tcp,udp,dns,dhcpv4,medium-ethernet,pool-16,embassy-time/tick-1mhz,unstable-traits \
--- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52805,gpiote,time-driver-rtc1 \
--- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52810,gpiote,time-driver-rtc1 \
--- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52811,gpiote,time-driver-rtc1 \
diff --git a/embassy-net/Cargo.toml b/embassy-net/Cargo.toml
index 2143f36d..64d78566 100644
--- a/embassy-net/Cargo.toml
+++ b/embassy-net/Cargo.toml
@@ -16,6 +16,9 @@ std = []
defmt = ["dep:defmt", "smoltcp/defmt"]
+nightly = ["dep:embedded-io", "embedded-io?/async", "dep:embedded-nal-async"]
+unstable-traits = []
+
udp = ["smoltcp/socket-udp"]
tcp = ["smoltcp/socket-tcp"]
dns = ["smoltcp/socket-dns"]
@@ -30,7 +33,6 @@ pool-16 = []
pool-32 = []
pool-64 = []
pool-128 = []
-unstable-traits = []
[dependencies]
@@ -39,7 +41,7 @@ log = { version = "0.4.14", optional = true }
embassy-time = { version = "0.1.0", path = "../embassy-time" }
embassy-sync = { version = "0.1.0", path = "../embassy-sync" }
-embedded-io = { version = "0.3.0", features = [ "async" ] }
+embedded-io = { version = "0.3.0", optional = true }
managed = { version = "0.8.0", default-features = false, features = [ "map" ] }
heapless = { version = "0.7.5", default-features = false }
@@ -49,7 +51,7 @@ stable_deref_trait = { version = "1.2.0", default-features = false }
futures = { version = "0.3.17", default-features = false, features = [ "async-await" ] }
atomic-pool = "1.0"
atomic-polyfill = "1.0.1"
-embedded-nal-async = "0.2.0"
+embedded-nal-async = { version = "0.2.0", optional = true }
[dependencies.smoltcp]
version = "0.8.0"
diff --git a/embassy-net/src/lib.rs b/embassy-net/src/lib.rs
index 83d36471..8eebc798 100644
--- a/embassy-net/src/lib.rs
+++ b/embassy-net/src/lib.rs
@@ -1,6 +1,5 @@
#![cfg_attr(not(feature = "std"), no_std)]
-#![allow(clippy::new_without_default)]
-#![feature(generic_associated_types, type_alias_impl_trait)]
+#![cfg_attr(feature = "nightly", feature(generic_associated_types, type_alias_impl_trait))]
// This mod MUST go first, so that the others see its macros.
pub(crate) mod fmt;
diff --git a/embassy-net/src/tcp.rs b/embassy-net/src/tcp.rs
index 910772c7..0fa87360 100644
--- a/embassy-net/src/tcp.rs
+++ b/embassy-net/src/tcp.rs
@@ -1,5 +1,4 @@
use core::cell::UnsafeCell;
-use core::future::Future;
use core::mem;
use core::task::Poll;
@@ -55,6 +54,18 @@ pub struct TcpWriter<'a> {
io: TcpIo<'a>,
}
+impl<'a> TcpReader<'a> {
+ pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error> {
+ self.io.read(buf).await
+ }
+}
+
+impl<'a> TcpWriter<'a> {
+ pub async fn write(&mut self, buf: &[u8]) -> Result<usize, Error> {
+ self.io.write(buf).await
+ }
+}
+
impl<'a> TcpSocket<'a> {
pub fn new<D: Device>(stack: &'a Stack<D>, rx_buffer: &'a mut [u8], tx_buffer: &'a mut [u8]) -> Self {
// safety: not accessed reentrantly.
@@ -129,6 +140,14 @@ impl<'a> TcpSocket<'a> {
.await
}
+ pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error> {
+ self.io.read(buf).await
+ }
+
+ pub async fn write(&mut self, buf: &[u8]) -> Result<usize, Error> {
+ self.io.write(buf).await
+ }
+
pub fn set_timeout(&mut self, duration: Option<Duration>) {
unsafe { self.io.with_mut(|s, _| s.set_timeout(duration)) }
}
@@ -241,6 +260,7 @@ impl<'d> TcpIo<'d> {
.await
}
+ #[allow(unused)]
async fn flush(&mut self) -> Result<(), Error> {
poll_fn(move |_| {
Poll::Ready(Ok(())) // TODO: Is there a better implementation for this?
@@ -249,88 +269,96 @@ impl<'d> TcpIo<'d> {
}
}
-impl embedded_io::Error for ConnectError {
- fn kind(&self) -> embedded_io::ErrorKind {
- embedded_io::ErrorKind::Other
+#[cfg(feature = "nightly")]
+mod embedded_io_impls {
+ use core::future::Future;
+
+ use super::*;
+
+ impl embedded_io::Error for ConnectError {
+ fn kind(&self) -> embedded_io::ErrorKind {
+ embedded_io::ErrorKind::Other
+ }
}
-}
-impl embedded_io::Error for Error {
- fn kind(&self) -> embedded_io::ErrorKind {
- embedded_io::ErrorKind::Other
+ impl embedded_io::Error for Error {
+ fn kind(&self) -> embedded_io::ErrorKind {
+ embedded_io::ErrorKind::Other
+ }
}
-}
-impl<'d> embedded_io::Io for TcpSocket<'d> {
- type Error = Error;
-}
+ impl<'d> embedded_io::Io for TcpSocket<'d> {
+ type Error = Error;
+ }
-impl<'d> embedded_io::asynch::Read for TcpSocket<'d> {
- type ReadFuture<'a> = impl Future<Output = Result<usize, Self::Error>>
+ impl<'d> embedded_io::asynch::Read for TcpSocket<'d> {
+ type ReadFuture<'a> = impl Future<Output = Result<usize, Self::Error>>
where
Self: 'a;
- fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Self::ReadFuture<'a> {
- self.io.read(buf)
+ fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Self::ReadFuture<'a> {
+ self.io.read(buf)
+ }
}
-}
-impl<'d> embedded_io::asynch::Write for TcpSocket<'d> {
- type WriteFuture<'a> = impl Future<Output = Result<usize, Self::Error>>
+ impl<'d> embedded_io::asynch::Write for TcpSocket<'d> {
+ type WriteFuture<'a> = impl Future<Output = Result<usize, Self::Error>>
where
Self: 'a;
- fn write<'a>(&'a mut self, buf: &'a [u8]) -> Self::WriteFuture<'a> {
- self.io.write(buf)
- }
+ fn write<'a>(&'a mut self, buf: &'a [u8]) -> Self::WriteFuture<'a> {
+ self.io.write(buf)
+ }
- type FlushFuture<'a> = impl Future<Output = Result<(), Self::Error>>
+ type FlushFuture<'a> = impl Future<Output = Result<(), Self::Error>>
where
Self: 'a;
- fn flush<'a>(&'a mut self) -> Self::FlushFuture<'a> {
- self.io.flush()
+ fn flush<'a>(&'a mut self) -> Self::FlushFuture<'a> {
+ self.io.flush()
+ }
}
-}
-impl<'d> embedded_io::Io for TcpReader<'d> {
- type Error = Error;
-}
+ impl<'d> embedded_io::Io for TcpReader<'d> {
+ type Error = Error;
+ }
-impl<'d> embedded_io::asynch::Read for TcpReader<'d> {
- type ReadFuture<'a> = impl Future<Output = Result<usize, Self::Error>>
+ impl<'d> embedded_io::asynch::Read for TcpReader<'d> {
+ type ReadFuture<'a> = impl Future<Output = Result<usize, Self::Error>>
where
Self: 'a;
- fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Self::ReadFuture<'a> {
- self.io.read(buf)
+ fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Self::ReadFuture<'a> {
+ self.io.read(buf)
+ }
}
-}
-impl<'d> embedded_io::Io for TcpWriter<'d> {
- type Error = Error;
-}
+ impl<'d> embedded_io::Io for TcpWriter<'d> {
+ type Error = Error;
+ }
-impl<'d> embedded_io::asynch::Write for TcpWriter<'d> {
- type WriteFuture<'a> = impl Future<Output = Result<usize, Self::Error>>
+ impl<'d> embedded_io::asynch::Write for TcpWriter<'d> {
+ type WriteFuture<'a> = impl Future<Output = Result<usize, Self::Error>>
where
Self: 'a;
- fn write<'a>(&'a mut self, buf: &'a [u8]) -> Self::WriteFuture<'a> {
- self.io.write(buf)
- }
+ fn write<'a>(&'a mut self, buf: &'a [u8]) -> Self::WriteFuture<'a> {
+ self.io.write(buf)
+ }
- type FlushFuture<'a> = impl Future<Output = Result<(), Self::Error>>
+ type FlushFuture<'a> = impl Future<Output = Result<(), Self::Error>>
where
Self: 'a;
- fn flush<'a>(&'a mut self) -> Self::FlushFuture<'a> {
- self.io.flush()
+ fn flush<'a>(&'a mut self) -> Self::FlushFuture<'a> {
+ self.io.flush()
+ }
}
}
-#[cfg(feature = "unstable-traits")]
+#[cfg(all(feature = "unstable-traits", feature = "nightly"))]
pub mod client {
+ use core::future::Future;
use core::mem::MaybeUninit;
use core::ptr::NonNull;
diff --git a/examples/nrf/Cargo.toml b/examples/nrf/Cargo.toml
index b0af0c86..b0190acc 100644
--- a/examples/nrf/Cargo.toml
+++ b/examples/nrf/Cargo.toml
@@ -5,7 +5,7 @@ version = "0.1.0"
[features]
default = ["nightly"]
-nightly = ["embassy-executor/nightly", "embassy-nrf/nightly", "embassy-nrf/unstable-traits", "embassy-usb", "embassy-usb-serial", "embassy-usb-hid", "embassy-usb-ncm", "embedded-io/async", "embassy-net"]
+nightly = ["embassy-executor/nightly", "embassy-nrf/nightly", "embassy-net/nightly", "embassy-nrf/unstable-traits", "embassy-usb", "embassy-usb-serial", "embassy-usb-hid", "embassy-usb-ncm", "embedded-io/async", "embassy-net"]
[dependencies]
embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
diff --git a/examples/nrf/src/bin/usb_ethernet.rs b/examples/nrf/src/bin/usb_ethernet.rs
index ca6c7e0d..352660b5 100644
--- a/examples/nrf/src/bin/usb_ethernet.rs
+++ b/examples/nrf/src/bin/usb_ethernet.rs
@@ -18,7 +18,7 @@ use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex;
use embassy_sync::channel::Channel;
use embassy_usb::{Builder, Config, UsbDevice};
use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State};
-use embedded_io::asynch::{Read, Write};
+use embedded_io::asynch::Write;
use static_cell::StaticCell;
use {defmt_rtt as _, panic_probe as _};
diff --git a/examples/rp/Cargo.toml b/examples/rp/Cargo.toml
index 72a3a057..18a92b09 100644
--- a/examples/rp/Cargo.toml
+++ b/examples/rp/Cargo.toml
@@ -11,7 +11,7 @@ embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["de
embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["defmt", "unstable-traits", "nightly", "unstable-pac"] }
embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] }
embassy-usb-serial = { version = "0.1.0", path = "../../embassy-usb-serial", features = ["defmt"] }
-embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] }
+embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] }
embassy-usb-ncm = { version = "0.1.0", path = "../../embassy-usb-ncm", features = ["defmt"] }
defmt = "0.3"
diff --git a/examples/rp/src/bin/usb_ethernet.rs b/examples/rp/src/bin/usb_ethernet.rs
index 2cb0010f..2df7f62f 100644
--- a/examples/rp/src/bin/usb_ethernet.rs
+++ b/examples/rp/src/bin/usb_ethernet.rs
@@ -16,7 +16,7 @@ use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex;
use embassy_sync::channel::Channel;
use embassy_usb::{Builder, Config, UsbDevice};
use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State};
-use embedded_io::asynch::{Read, Write};
+use embedded_io::asynch::Write;
use static_cell::StaticCell;
use {defmt_rtt as _, panic_probe as _};
diff --git a/examples/std/Cargo.toml b/examples/std/Cargo.toml
index c7cec6b1..dbfd9d62 100644
--- a/examples/std/Cargo.toml
+++ b/examples/std/Cargo.toml
@@ -7,7 +7,7 @@ version = "0.1.0"
embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["log"] }
embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["log", "std", "nightly", "integrated-timers"] }
embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["log", "std", "nightly"] }
-embassy-net = { version = "0.1.0", path = "../../embassy-net", features=[ "std", "log", "medium-ethernet", "tcp", "udp", "dhcpv4", "pool-16"] }
+embassy-net = { version = "0.1.0", path = "../../embassy-net", features=[ "std", "nightly", "log", "medium-ethernet", "tcp", "udp", "dhcpv4", "pool-16"] }
embedded-io = { version = "0.3.0", features = ["async", "std", "futures"] }
critical-section = { version = "1.1", features = ["std"] }
diff --git a/examples/stm32f7/Cargo.toml b/examples/stm32f7/Cargo.toml
index a446fe3f..53ab2f5e 100644
--- a/examples/stm32f7/Cargo.toml
+++ b/examples/stm32f7/Cargo.toml
@@ -8,7 +8,7 @@ embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["de
embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] }
embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-32768hz"] }
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "net", "stm32f767zi", "unstable-pac", "time-driver-any", "exti"] }
-embassy-net = { path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] }
+embassy-net = { path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] }
embedded-io = { version = "0.3.0", features = ["async"] }
defmt = "0.3"
diff --git a/examples/stm32h7/Cargo.toml b/examples/stm32h7/Cargo.toml
index 0f76f322..18b61120 100644
--- a/examples/stm32h7/Cargo.toml
+++ b/examples/stm32h7/Cargo.toml
@@ -8,7 +8,7 @@ embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["de
embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] }
embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "unstable-traits", "tick-32768hz"] }
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32h743bi", "net", "time-driver-any", "exti", "unstable-pac", "unstable-traits"] }
-embassy-net = { path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "pool-16", "unstable-traits"] }
+embassy-net = { path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "dhcpv4", "medium-ethernet", "pool-16", "unstable-traits"] }
embedded-io = { version = "0.3.0", features = ["async"] }
defmt = "0.3"
diff --git a/examples/stm32l5/Cargo.toml b/examples/stm32l5/Cargo.toml
index 624c73c2..ea3d5ab8 100644
--- a/examples/stm32l5/Cargo.toml
+++ b/examples/stm32l5/Cargo.toml
@@ -14,7 +14,7 @@ embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defm
embassy-usb-serial = { version = "0.1.0", path = "../../embassy-usb-serial", features = ["defmt"] }
embassy-usb-hid = { version = "0.1.0", path = "../../embassy-usb-hid", features = ["defmt"] }
embassy-usb-ncm = { version = "0.1.0", path = "../../embassy-usb-ncm", features = ["defmt"] }
-embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] }
+embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] }
usbd-hid = "0.5.2"
defmt = "0.3"
diff --git a/examples/stm32l5/src/bin/usb_ethernet.rs b/examples/stm32l5/src/bin/usb_ethernet.rs
index 3286f5c4..2c8706e4 100644
--- a/examples/stm32l5/src/bin/usb_ethernet.rs
+++ b/examples/stm32l5/src/bin/usb_ethernet.rs
@@ -12,14 +12,13 @@ use embassy_net::tcp::TcpSocket;
use embassy_net::{PacketBox, PacketBoxExt, PacketBuf, Stack, StackResources};
use embassy_stm32::rcc::*;
use embassy_stm32::rng::Rng;
-use embassy_stm32::time::Hertz;
use embassy_stm32::usb::Driver;
use embassy_stm32::{interrupt, Config};
use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex;
use embassy_sync::channel::Channel;
use embassy_usb::{Builder, UsbDevice};
use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State};
-use embedded_io::asynch::{Read, Write};
+use embedded_io::asynch::Write;
use rand_core::RngCore;
use static_cell::StaticCell;
use {defmt_rtt as _, panic_probe as _};
diff --git a/examples/stm32l5/src/bin/usb_hid_mouse.rs b/examples/stm32l5/src/bin/usb_hid_mouse.rs
index f7e3d93e..7d763e7f 100644
--- a/examples/stm32l5/src/bin/usb_hid_mouse.rs
+++ b/examples/stm32l5/src/bin/usb_hid_mouse.rs
@@ -6,9 +6,8 @@
use defmt::*;
use embassy_executor::Spawner;
use embassy_stm32::rcc::*;
-use embassy_stm32::time::Hertz;
use embassy_stm32::usb::Driver;
-use embassy_stm32::{interrupt, Config, Peripherals};
+use embassy_stm32::{interrupt, Config};
use embassy_time::{Duration, Timer};
use embassy_usb::control::OutResponse;
use embassy_usb::Builder;
@@ -111,11 +110,11 @@ impl RequestHandler for MyRequestHandler {
OutResponse::Accepted
}
- fn set_idle(&self, id: Option<ReportId>, dur: Duration) {
+ fn set_idle_ms(&self, id: Option<ReportId>, dur: u32) {
info!("Set idle rate for {:?} to {:?}", id, dur);
}
- fn get_idle(&self, id: Option<ReportId>) -> Option<Duration> {
+ fn get_idle_ms(&self, id: Option<ReportId>) -> Option<u32> {
info!("Get idle rate for {:?}", id);
None
}
diff --git a/examples/stm32l5/src/bin/usb_serial.rs b/examples/stm32l5/src/bin/usb_serial.rs
index 323db655..b576a735 100644
--- a/examples/stm32l5/src/bin/usb_serial.rs
+++ b/examples/stm32l5/src/bin/usb_serial.rs
@@ -5,7 +5,6 @@
use defmt::{panic, *};
use embassy_executor::Spawner;
use embassy_stm32::rcc::*;
-use embassy_stm32::time::Hertz;
use embassy_stm32::usb::{Driver, Instance};
use embassy_stm32::{interrupt, Config};
use embassy_usb::driver::EndpointError;