aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2022-08-30 19:25:36 +0200
committerDario Nieuwenhuis <[email protected]>2022-08-30 19:43:32 +0200
commit464ae67108c74efe38326b6ac8fedd29857e9412 (patch)
tree773ad62cfef9dfd10b4802086dee18b6007edd54
parent92ed95780df854b136eaf0095b51badd34f7581b (diff)
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 77a8a7e27..0e2af1e4c 100755
--- a/ci.sh
+++ b/ci.sh
@@ -36,6 +36,10 @@ cargo batch \
36 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features nightly,log \ 36 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features nightly,log \
37 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features nightly,defmt \ 37 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features nightly,defmt \
38 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv6m-none-eabi --features nightly,defmt \ 38 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv6m-none-eabi --features nightly,defmt \
39 --- 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 \
40 --- 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 \
41 --- 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 \
42 --- 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 \
39 --- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nightly,nrf52805,gpiote,time-driver-rtc1 \ 43 --- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nightly,nrf52805,gpiote,time-driver-rtc1 \
40 --- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nightly,nrf52810,gpiote,time-driver-rtc1 \ 44 --- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nightly,nrf52810,gpiote,time-driver-rtc1 \
41 --- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nightly,nrf52811,gpiote,time-driver-rtc1 \ 45 --- 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 \
94 --- build --release --manifest-path examples/stm32l0/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/stm32l0 \ 98 --- build --release --manifest-path examples/stm32l0/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/stm32l0 \
95 --- build --release --manifest-path examples/stm32l1/Cargo.toml --target thumbv7m-none-eabi --out-dir out/examples/stm32l1 \ 99 --- build --release --manifest-path examples/stm32l1/Cargo.toml --target thumbv7m-none-eabi --out-dir out/examples/stm32l1 \
96 --- build --release --manifest-path examples/stm32l4/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32l4 \ 100 --- build --release --manifest-path examples/stm32l4/Cargo.toml --target thumbv7em-none-eabi --out-dir out/examples/stm32l4 \
101 --- build --release --manifest-path examples/stm32l5/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/stm32l5 \
97 --- build --release --manifest-path examples/stm32u5/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/stm32u5 \ 102 --- build --release --manifest-path examples/stm32u5/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/stm32u5 \
98 --- build --release --manifest-path examples/stm32wb/Cargo.toml --target thumbv7em-none-eabihf --out-dir out/examples/stm32wb \ 103 --- build --release --manifest-path examples/stm32wb/Cargo.toml --target thumbv7em-none-eabihf --out-dir out/examples/stm32wb \
99 --- build --release --manifest-path examples/stm32wl/Cargo.toml --target thumbv7em-none-eabihf --out-dir out/examples/stm32wl \ 104 --- 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 d388cfee3..02e630520 100755
--- a/ci_stable.sh
+++ b/ci_stable.sh
@@ -13,6 +13,8 @@ cargo batch \
13 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features log \ 13 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features log \
14 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features defmt \ 14 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv7em-none-eabi --features defmt \
15 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv6m-none-eabi --features defmt \ 15 --- build --release --manifest-path embassy-executor/Cargo.toml --target thumbv6m-none-eabi --features defmt \
16 --- 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 \
17 --- 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 \
16 --- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52805,gpiote,time-driver-rtc1 \ 18 --- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52805,gpiote,time-driver-rtc1 \
17 --- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52810,gpiote,time-driver-rtc1 \ 19 --- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52810,gpiote,time-driver-rtc1 \
18 --- build --release --manifest-path embassy-nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52811,gpiote,time-driver-rtc1 \ 20 --- 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 2143f36d3..64d78566f 100644
--- a/embassy-net/Cargo.toml
+++ b/embassy-net/Cargo.toml
@@ -16,6 +16,9 @@ std = []
16 16
17defmt = ["dep:defmt", "smoltcp/defmt"] 17defmt = ["dep:defmt", "smoltcp/defmt"]
18 18
19nightly = ["dep:embedded-io", "embedded-io?/async", "dep:embedded-nal-async"]
20unstable-traits = []
21
19udp = ["smoltcp/socket-udp"] 22udp = ["smoltcp/socket-udp"]
20tcp = ["smoltcp/socket-tcp"] 23tcp = ["smoltcp/socket-tcp"]
21dns = ["smoltcp/socket-dns"] 24dns = ["smoltcp/socket-dns"]
@@ -30,7 +33,6 @@ pool-16 = []
30pool-32 = [] 33pool-32 = []
31pool-64 = [] 34pool-64 = []
32pool-128 = [] 35pool-128 = []
33unstable-traits = []
34 36
35[dependencies] 37[dependencies]
36 38
@@ -39,7 +41,7 @@ log = { version = "0.4.14", optional = true }
39 41
40embassy-time = { version = "0.1.0", path = "../embassy-time" } 42embassy-time = { version = "0.1.0", path = "../embassy-time" }
41embassy-sync = { version = "0.1.0", path = "../embassy-sync" } 43embassy-sync = { version = "0.1.0", path = "../embassy-sync" }
42embedded-io = { version = "0.3.0", features = [ "async" ] } 44embedded-io = { version = "0.3.0", optional = true }
43 45
44managed = { version = "0.8.0", default-features = false, features = [ "map" ] } 46managed = { version = "0.8.0", default-features = false, features = [ "map" ] }
45heapless = { version = "0.7.5", default-features = false } 47heapless = { version = "0.7.5", default-features = false }
@@ -49,7 +51,7 @@ stable_deref_trait = { version = "1.2.0", default-features = false }
49futures = { version = "0.3.17", default-features = false, features = [ "async-await" ] } 51futures = { version = "0.3.17", default-features = false, features = [ "async-await" ] }
50atomic-pool = "1.0" 52atomic-pool = "1.0"
51atomic-polyfill = "1.0.1" 53atomic-polyfill = "1.0.1"
52embedded-nal-async = "0.2.0" 54embedded-nal-async = { version = "0.2.0", optional = true }
53 55
54[dependencies.smoltcp] 56[dependencies.smoltcp]
55version = "0.8.0" 57version = "0.8.0"
diff --git a/embassy-net/src/lib.rs b/embassy-net/src/lib.rs
index 83d364715..8eebc798e 100644
--- a/embassy-net/src/lib.rs
+++ b/embassy-net/src/lib.rs
@@ -1,6 +1,5 @@
1#![cfg_attr(not(feature = "std"), no_std)] 1#![cfg_attr(not(feature = "std"), no_std)]
2#![allow(clippy::new_without_default)] 2#![cfg_attr(feature = "nightly", feature(generic_associated_types, type_alias_impl_trait))]
3#![feature(generic_associated_types, type_alias_impl_trait)]
4 3
5// This mod MUST go first, so that the others see its macros. 4// This mod MUST go first, so that the others see its macros.
6pub(crate) mod fmt; 5pub(crate) mod fmt;
diff --git a/embassy-net/src/tcp.rs b/embassy-net/src/tcp.rs
index 910772c7d..0fa873602 100644
--- a/embassy-net/src/tcp.rs
+++ b/embassy-net/src/tcp.rs
@@ -1,5 +1,4 @@
1use core::cell::UnsafeCell; 1use core::cell::UnsafeCell;
2use core::future::Future;
3use core::mem; 2use core::mem;
4use core::task::Poll; 3use core::task::Poll;
5 4
@@ -55,6 +54,18 @@ pub struct TcpWriter<'a> {
55 io: TcpIo<'a>, 54 io: TcpIo<'a>,
56} 55}
57 56
57impl<'a> TcpReader<'a> {
58 pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error> {
59 self.io.read(buf).await
60 }
61}
62
63impl<'a> TcpWriter<'a> {
64 pub async fn write(&mut self, buf: &[u8]) -> Result<usize, Error> {
65 self.io.write(buf).await
66 }
67}
68
58impl<'a> TcpSocket<'a> { 69impl<'a> TcpSocket<'a> {
59 pub fn new<D: Device>(stack: &'a Stack<D>, rx_buffer: &'a mut [u8], tx_buffer: &'a mut [u8]) -> Self { 70 pub fn new<D: Device>(stack: &'a Stack<D>, rx_buffer: &'a mut [u8], tx_buffer: &'a mut [u8]) -> Self {
60 // safety: not accessed reentrantly. 71 // safety: not accessed reentrantly.
@@ -129,6 +140,14 @@ impl<'a> TcpSocket<'a> {
129 .await 140 .await
130 } 141 }
131 142
143 pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error> {
144 self.io.read(buf).await
145 }
146
147 pub async fn write(&mut self, buf: &[u8]) -> Result<usize, Error> {
148 self.io.write(buf).await
149 }
150
132 pub fn set_timeout(&mut self, duration: Option<Duration>) { 151 pub fn set_timeout(&mut self, duration: Option<Duration>) {
133 unsafe { self.io.with_mut(|s, _| s.set_timeout(duration)) } 152 unsafe { self.io.with_mut(|s, _| s.set_timeout(duration)) }
134 } 153 }
@@ -241,6 +260,7 @@ impl<'d> TcpIo<'d> {
241 .await 260 .await
242 } 261 }
243 262
263 #[allow(unused)]
244 async fn flush(&mut self) -> Result<(), Error> { 264 async fn flush(&mut self) -> Result<(), Error> {
245 poll_fn(move |_| { 265 poll_fn(move |_| {
246 Poll::Ready(Ok(())) // TODO: Is there a better implementation for this? 266 Poll::Ready(Ok(())) // TODO: Is there a better implementation for this?
@@ -249,88 +269,96 @@ impl<'d> TcpIo<'d> {
249 } 269 }
250} 270}
251 271
252impl embedded_io::Error for ConnectError { 272#[cfg(feature = "nightly")]
253 fn kind(&self) -> embedded_io::ErrorKind { 273mod embedded_io_impls {
254 embedded_io::ErrorKind::Other 274 use core::future::Future;
275
276 use super::*;
277
278 impl embedded_io::Error for ConnectError {
279 fn kind(&self) -> embedded_io::ErrorKind {
280 embedded_io::ErrorKind::Other
281 }
255 } 282 }
256}
257 283
258impl embedded_io::Error for Error { 284 impl embedded_io::Error for Error {
259 fn kind(&self) -> embedded_io::ErrorKind { 285 fn kind(&self) -> embedded_io::ErrorKind {
260 embedded_io::ErrorKind::Other 286 embedded_io::ErrorKind::Other
287 }
261 } 288 }
262}
263 289
264impl<'d> embedded_io::Io for TcpSocket<'d> { 290 impl<'d> embedded_io::Io for TcpSocket<'d> {
265 type Error = Error; 291 type Error = Error;
266} 292 }
267 293
268impl<'d> embedded_io::asynch::Read for TcpSocket<'d> { 294 impl<'d> embedded_io::asynch::Read for TcpSocket<'d> {
269 type ReadFuture<'a> = impl Future<Output = Result<usize, Self::Error>> 295 type ReadFuture<'a> = impl Future<Output = Result<usize, Self::Error>>
270 where 296 where
271 Self: 'a; 297 Self: 'a;
272 298
273 fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Self::ReadFuture<'a> { 299 fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Self::ReadFuture<'a> {
274 self.io.read(buf) 300 self.io.read(buf)
301 }
275 } 302 }
276}
277 303
278impl<'d> embedded_io::asynch::Write for TcpSocket<'d> { 304 impl<'d> embedded_io::asynch::Write for TcpSocket<'d> {
279 type WriteFuture<'a> = impl Future<Output = Result<usize, Self::Error>> 305 type WriteFuture<'a> = impl Future<Output = Result<usize, Self::Error>>
280 where 306 where
281 Self: 'a; 307 Self: 'a;
282 308
283 fn write<'a>(&'a mut self, buf: &'a [u8]) -> Self::WriteFuture<'a> { 309 fn write<'a>(&'a mut self, buf: &'a [u8]) -> Self::WriteFuture<'a> {
284 self.io.write(buf) 310 self.io.write(buf)
285 } 311 }
286 312
287 type FlushFuture<'a> = impl Future<Output = Result<(), Self::Error>> 313 type FlushFuture<'a> = impl Future<Output = Result<(), Self::Error>>
288 where 314 where
289 Self: 'a; 315 Self: 'a;
290 316
291 fn flush<'a>(&'a mut self) -> Self::FlushFuture<'a> { 317 fn flush<'a>(&'a mut self) -> Self::FlushFuture<'a> {
292 self.io.flush() 318 self.io.flush()
319 }
293 } 320 }
294}
295 321
296impl<'d> embedded_io::Io for TcpReader<'d> { 322 impl<'d> embedded_io::Io for TcpReader<'d> {
297 type Error = Error; 323 type Error = Error;
298} 324 }
299 325
300impl<'d> embedded_io::asynch::Read for TcpReader<'d> { 326 impl<'d> embedded_io::asynch::Read for TcpReader<'d> {
301 type ReadFuture<'a> = impl Future<Output = Result<usize, Self::Error>> 327 type ReadFuture<'a> = impl Future<Output = Result<usize, Self::Error>>
302 where 328 where
303 Self: 'a; 329 Self: 'a;
304 330
305 fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Self::ReadFuture<'a> { 331 fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Self::ReadFuture<'a> {
306 self.io.read(buf) 332 self.io.read(buf)
333 }
307 } 334 }
308}
309 335
310impl<'d> embedded_io::Io for TcpWriter<'d> { 336 impl<'d> embedded_io::Io for TcpWriter<'d> {
311 type Error = Error; 337 type Error = Error;
312} 338 }
313 339
314impl<'d> embedded_io::asynch::Write for TcpWriter<'d> { 340 impl<'d> embedded_io::asynch::Write for TcpWriter<'d> {
315 type WriteFuture<'a> = impl Future<Output = Result<usize, Self::Error>> 341 type WriteFuture<'a> = impl Future<Output = Result<usize, Self::Error>>
316 where 342 where
317 Self: 'a; 343 Self: 'a;
318 344
319 fn write<'a>(&'a mut self, buf: &'a [u8]) -> Self::WriteFuture<'a> { 345 fn write<'a>(&'a mut self, buf: &'a [u8]) -> Self::WriteFuture<'a> {
320 self.io.write(buf) 346 self.io.write(buf)
321 } 347 }
322 348
323 type FlushFuture<'a> = impl Future<Output = Result<(), Self::Error>> 349 type FlushFuture<'a> = impl Future<Output = Result<(), Self::Error>>
324 where 350 where
325 Self: 'a; 351 Self: 'a;
326 352
327 fn flush<'a>(&'a mut self) -> Self::FlushFuture<'a> { 353 fn flush<'a>(&'a mut self) -> Self::FlushFuture<'a> {
328 self.io.flush() 354 self.io.flush()
355 }
329 } 356 }
330} 357}
331 358
332#[cfg(feature = "unstable-traits")] 359#[cfg(all(feature = "unstable-traits", feature = "nightly"))]
333pub mod client { 360pub mod client {
361 use core::future::Future;
334 use core::mem::MaybeUninit; 362 use core::mem::MaybeUninit;
335 use core::ptr::NonNull; 363 use core::ptr::NonNull;
336 364
diff --git a/examples/nrf/Cargo.toml b/examples/nrf/Cargo.toml
index b0af0c86e..b0190acc8 100644
--- a/examples/nrf/Cargo.toml
+++ b/examples/nrf/Cargo.toml
@@ -5,7 +5,7 @@ version = "0.1.0"
5 5
6[features] 6[features]
7default = ["nightly"] 7default = ["nightly"]
8nightly = ["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"] 8nightly = ["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"]
9 9
10[dependencies] 10[dependencies]
11embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 11embassy-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 ca6c7e0d1..352660b59 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;
18use embassy_sync::channel::Channel; 18use embassy_sync::channel::Channel;
19use embassy_usb::{Builder, Config, UsbDevice}; 19use embassy_usb::{Builder, Config, UsbDevice};
20use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State}; 20use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State};
21use embedded_io::asynch::{Read, Write}; 21use embedded_io::asynch::Write;
22use static_cell::StaticCell; 22use static_cell::StaticCell;
23use {defmt_rtt as _, panic_probe as _}; 23use {defmt_rtt as _, panic_probe as _};
24 24
diff --git a/examples/rp/Cargo.toml b/examples/rp/Cargo.toml
index 72a3a057d..18a92b094 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
11embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["defmt", "unstable-traits", "nightly", "unstable-pac"] } 11embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["defmt", "unstable-traits", "nightly", "unstable-pac"] }
12embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } 12embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] }
13embassy-usb-serial = { version = "0.1.0", path = "../../embassy-usb-serial", features = ["defmt"] } 13embassy-usb-serial = { version = "0.1.0", path = "../../embassy-usb-serial", features = ["defmt"] }
14embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] } 14embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] }
15embassy-usb-ncm = { version = "0.1.0", path = "../../embassy-usb-ncm", features = ["defmt"] } 15embassy-usb-ncm = { version = "0.1.0", path = "../../embassy-usb-ncm", features = ["defmt"] }
16 16
17defmt = "0.3" 17defmt = "0.3"
diff --git a/examples/rp/src/bin/usb_ethernet.rs b/examples/rp/src/bin/usb_ethernet.rs
index 2cb0010f1..2df7f62f6 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;
16use embassy_sync::channel::Channel; 16use embassy_sync::channel::Channel;
17use embassy_usb::{Builder, Config, UsbDevice}; 17use embassy_usb::{Builder, Config, UsbDevice};
18use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State}; 18use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State};
19use embedded_io::asynch::{Read, Write}; 19use embedded_io::asynch::Write;
20use static_cell::StaticCell; 20use static_cell::StaticCell;
21use {defmt_rtt as _, panic_probe as _}; 21use {defmt_rtt as _, panic_probe as _};
22 22
diff --git a/examples/std/Cargo.toml b/examples/std/Cargo.toml
index c7cec6b19..dbfd9d625 100644
--- a/examples/std/Cargo.toml
+++ b/examples/std/Cargo.toml
@@ -7,7 +7,7 @@ version = "0.1.0"
7embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["log"] } 7embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["log"] }
8embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["log", "std", "nightly", "integrated-timers"] } 8embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["log", "std", "nightly", "integrated-timers"] }
9embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["log", "std", "nightly"] } 9embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["log", "std", "nightly"] }
10embassy-net = { version = "0.1.0", path = "../../embassy-net", features=[ "std", "log", "medium-ethernet", "tcp", "udp", "dhcpv4", "pool-16"] } 10embassy-net = { version = "0.1.0", path = "../../embassy-net", features=[ "std", "nightly", "log", "medium-ethernet", "tcp", "udp", "dhcpv4", "pool-16"] }
11embedded-io = { version = "0.3.0", features = ["async", "std", "futures"] } 11embedded-io = { version = "0.3.0", features = ["async", "std", "futures"] }
12critical-section = { version = "1.1", features = ["std"] } 12critical-section = { version = "1.1", features = ["std"] }
13 13
diff --git a/examples/stm32f7/Cargo.toml b/examples/stm32f7/Cargo.toml
index a446fe3fb..53ab2f5e7 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
8embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] } 8embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] }
9embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-32768hz"] } 9embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-32768hz"] }
10embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "net", "stm32f767zi", "unstable-pac", "time-driver-any", "exti"] } 10embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "net", "stm32f767zi", "unstable-pac", "time-driver-any", "exti"] }
11embassy-net = { path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] } 11embassy-net = { path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] }
12embedded-io = { version = "0.3.0", features = ["async"] } 12embedded-io = { version = "0.3.0", features = ["async"] }
13 13
14defmt = "0.3" 14defmt = "0.3"
diff --git a/examples/stm32h7/Cargo.toml b/examples/stm32h7/Cargo.toml
index 0f76f3226..18b61120b 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
8embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] } 8embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] }
9embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "unstable-traits", "tick-32768hz"] } 9embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "unstable-traits", "tick-32768hz"] }
10embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32h743bi", "net", "time-driver-any", "exti", "unstable-pac", "unstable-traits"] } 10embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32h743bi", "net", "time-driver-any", "exti", "unstable-pac", "unstable-traits"] }
11embassy-net = { path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "pool-16", "unstable-traits"] } 11embassy-net = { path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "dhcpv4", "medium-ethernet", "pool-16", "unstable-traits"] }
12embedded-io = { version = "0.3.0", features = ["async"] } 12embedded-io = { version = "0.3.0", features = ["async"] }
13 13
14defmt = "0.3" 14defmt = "0.3"
diff --git a/examples/stm32l5/Cargo.toml b/examples/stm32l5/Cargo.toml
index 624c73c26..ea3d5ab88 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
14embassy-usb-serial = { version = "0.1.0", path = "../../embassy-usb-serial", features = ["defmt"] } 14embassy-usb-serial = { version = "0.1.0", path = "../../embassy-usb-serial", features = ["defmt"] }
15embassy-usb-hid = { version = "0.1.0", path = "../../embassy-usb-hid", features = ["defmt"] } 15embassy-usb-hid = { version = "0.1.0", path = "../../embassy-usb-hid", features = ["defmt"] }
16embassy-usb-ncm = { version = "0.1.0", path = "../../embassy-usb-ncm", features = ["defmt"] } 16embassy-usb-ncm = { version = "0.1.0", path = "../../embassy-usb-ncm", features = ["defmt"] }
17embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] } 17embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] }
18usbd-hid = "0.5.2" 18usbd-hid = "0.5.2"
19 19
20defmt = "0.3" 20defmt = "0.3"
diff --git a/examples/stm32l5/src/bin/usb_ethernet.rs b/examples/stm32l5/src/bin/usb_ethernet.rs
index 3286f5c4d..2c8706e41 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;
12use embassy_net::{PacketBox, PacketBoxExt, PacketBuf, Stack, StackResources}; 12use embassy_net::{PacketBox, PacketBoxExt, PacketBuf, Stack, StackResources};
13use embassy_stm32::rcc::*; 13use embassy_stm32::rcc::*;
14use embassy_stm32::rng::Rng; 14use embassy_stm32::rng::Rng;
15use embassy_stm32::time::Hertz;
16use embassy_stm32::usb::Driver; 15use embassy_stm32::usb::Driver;
17use embassy_stm32::{interrupt, Config}; 16use embassy_stm32::{interrupt, Config};
18use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; 17use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex;
19use embassy_sync::channel::Channel; 18use embassy_sync::channel::Channel;
20use embassy_usb::{Builder, UsbDevice}; 19use embassy_usb::{Builder, UsbDevice};
21use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State}; 20use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State};
22use embedded_io::asynch::{Read, Write}; 21use embedded_io::asynch::Write;
23use rand_core::RngCore; 22use rand_core::RngCore;
24use static_cell::StaticCell; 23use static_cell::StaticCell;
25use {defmt_rtt as _, panic_probe as _}; 24use {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 f7e3d93e3..7d763e7fd 100644
--- a/examples/stm32l5/src/bin/usb_hid_mouse.rs
+++ b/examples/stm32l5/src/bin/usb_hid_mouse.rs
@@ -6,9 +6,8 @@
6use defmt::*; 6use defmt::*;
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_stm32::rcc::*; 8use embassy_stm32::rcc::*;
9use embassy_stm32::time::Hertz;
10use embassy_stm32::usb::Driver; 9use embassy_stm32::usb::Driver;
11use embassy_stm32::{interrupt, Config, Peripherals}; 10use embassy_stm32::{interrupt, Config};
12use embassy_time::{Duration, Timer}; 11use embassy_time::{Duration, Timer};
13use embassy_usb::control::OutResponse; 12use embassy_usb::control::OutResponse;
14use embassy_usb::Builder; 13use embassy_usb::Builder;
@@ -111,11 +110,11 @@ impl RequestHandler for MyRequestHandler {
111 OutResponse::Accepted 110 OutResponse::Accepted
112 } 111 }
113 112
114 fn set_idle(&self, id: Option<ReportId>, dur: Duration) { 113 fn set_idle_ms(&self, id: Option<ReportId>, dur: u32) {
115 info!("Set idle rate for {:?} to {:?}", id, dur); 114 info!("Set idle rate for {:?} to {:?}", id, dur);
116 } 115 }
117 116
118 fn get_idle(&self, id: Option<ReportId>) -> Option<Duration> { 117 fn get_idle_ms(&self, id: Option<ReportId>) -> Option<u32> {
119 info!("Get idle rate for {:?}", id); 118 info!("Get idle rate for {:?}", id);
120 None 119 None
121 } 120 }
diff --git a/examples/stm32l5/src/bin/usb_serial.rs b/examples/stm32l5/src/bin/usb_serial.rs
index 323db6557..b576a7353 100644
--- a/examples/stm32l5/src/bin/usb_serial.rs
+++ b/examples/stm32l5/src/bin/usb_serial.rs
@@ -5,7 +5,6 @@
5use defmt::{panic, *}; 5use defmt::{panic, *};
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::rcc::*; 7use embassy_stm32::rcc::*;
8use embassy_stm32::time::Hertz;
9use embassy_stm32::usb::{Driver, Instance}; 8use embassy_stm32::usb::{Driver, Instance};
10use embassy_stm32::{interrupt, Config}; 9use embassy_stm32::{interrupt, Config};
11use embassy_usb::driver::EndpointError; 10use embassy_usb::driver::EndpointError;