diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-08-30 19:25:36 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-08-30 19:43:32 +0200 |
| commit | 464ae67108c74efe38326b6ac8fedd29857e9412 (patch) | |
| tree | 773ad62cfef9dfd10b4802086dee18b6007edd54 | |
| parent | 92ed95780df854b136eaf0095b51badd34f7581b (diff) | |
net: feature-gate nightly-only async traits to allow building on stable.
| -rwxr-xr-x | ci.sh | 5 | ||||
| -rwxr-xr-x | ci_stable.sh | 2 | ||||
| -rw-r--r-- | embassy-net/Cargo.toml | 8 | ||||
| -rw-r--r-- | embassy-net/src/lib.rs | 3 | ||||
| -rw-r--r-- | embassy-net/src/tcp.rs | 120 | ||||
| -rw-r--r-- | examples/nrf/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/nrf/src/bin/usb_ethernet.rs | 2 | ||||
| -rw-r--r-- | examples/rp/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/rp/src/bin/usb_ethernet.rs | 2 | ||||
| -rw-r--r-- | examples/std/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/stm32f7/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/stm32h7/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/stm32l5/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/stm32l5/src/bin/usb_ethernet.rs | 3 | ||||
| -rw-r--r-- | examples/stm32l5/src/bin/usb_hid_mouse.rs | 7 | ||||
| -rw-r--r-- | examples/stm32l5/src/bin/usb_serial.rs | 1 |
16 files changed, 99 insertions, 66 deletions
| @@ -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 | ||
| 17 | defmt = ["dep:defmt", "smoltcp/defmt"] | 17 | defmt = ["dep:defmt", "smoltcp/defmt"] |
| 18 | 18 | ||
| 19 | nightly = ["dep:embedded-io", "embedded-io?/async", "dep:embedded-nal-async"] | ||
| 20 | unstable-traits = [] | ||
| 21 | |||
| 19 | udp = ["smoltcp/socket-udp"] | 22 | udp = ["smoltcp/socket-udp"] |
| 20 | tcp = ["smoltcp/socket-tcp"] | 23 | tcp = ["smoltcp/socket-tcp"] |
| 21 | dns = ["smoltcp/socket-dns"] | 24 | dns = ["smoltcp/socket-dns"] |
| @@ -30,7 +33,6 @@ pool-16 = [] | |||
| 30 | pool-32 = [] | 33 | pool-32 = [] |
| 31 | pool-64 = [] | 34 | pool-64 = [] |
| 32 | pool-128 = [] | 35 | pool-128 = [] |
| 33 | unstable-traits = [] | ||
| 34 | 36 | ||
| 35 | [dependencies] | 37 | [dependencies] |
| 36 | 38 | ||
| @@ -39,7 +41,7 @@ log = { version = "0.4.14", optional = true } | |||
| 39 | 41 | ||
| 40 | embassy-time = { version = "0.1.0", path = "../embassy-time" } | 42 | embassy-time = { version = "0.1.0", path = "../embassy-time" } |
| 41 | embassy-sync = { version = "0.1.0", path = "../embassy-sync" } | 43 | embassy-sync = { version = "0.1.0", path = "../embassy-sync" } |
| 42 | embedded-io = { version = "0.3.0", features = [ "async" ] } | 44 | embedded-io = { version = "0.3.0", optional = true } |
| 43 | 45 | ||
| 44 | managed = { version = "0.8.0", default-features = false, features = [ "map" ] } | 46 | managed = { version = "0.8.0", default-features = false, features = [ "map" ] } |
| 45 | heapless = { version = "0.7.5", default-features = false } | 47 | heapless = { version = "0.7.5", default-features = false } |
| @@ -49,7 +51,7 @@ stable_deref_trait = { version = "1.2.0", default-features = false } | |||
| 49 | futures = { version = "0.3.17", default-features = false, features = [ "async-await" ] } | 51 | futures = { version = "0.3.17", default-features = false, features = [ "async-await" ] } |
| 50 | atomic-pool = "1.0" | 52 | atomic-pool = "1.0" |
| 51 | atomic-polyfill = "1.0.1" | 53 | atomic-polyfill = "1.0.1" |
| 52 | embedded-nal-async = "0.2.0" | 54 | embedded-nal-async = { version = "0.2.0", optional = true } |
| 53 | 55 | ||
| 54 | [dependencies.smoltcp] | 56 | [dependencies.smoltcp] |
| 55 | version = "0.8.0" | 57 | version = "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. |
| 6 | pub(crate) mod fmt; | 5 | pub(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 @@ | |||
| 1 | use core::cell::UnsafeCell; | 1 | use core::cell::UnsafeCell; |
| 2 | use core::future::Future; | ||
| 3 | use core::mem; | 2 | use core::mem; |
| 4 | use core::task::Poll; | 3 | use 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 | ||
| 57 | impl<'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 | |||
| 63 | impl<'a> TcpWriter<'a> { | ||
| 64 | pub async fn write(&mut self, buf: &[u8]) -> Result<usize, Error> { | ||
| 65 | self.io.write(buf).await | ||
| 66 | } | ||
| 67 | } | ||
| 68 | |||
| 58 | impl<'a> TcpSocket<'a> { | 69 | impl<'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 | ||
| 252 | impl embedded_io::Error for ConnectError { | 272 | #[cfg(feature = "nightly")] |
| 253 | fn kind(&self) -> embedded_io::ErrorKind { | 273 | mod 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 | ||
| 258 | impl 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 | ||
| 264 | impl<'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 | ||
| 268 | impl<'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 | ||
| 278 | impl<'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 | ||
| 296 | impl<'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 | ||
| 300 | impl<'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 | ||
| 310 | impl<'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 | ||
| 314 | impl<'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"))] |
| 333 | pub mod client { | 360 | pub 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] |
| 7 | default = ["nightly"] | 7 | default = ["nightly"] |
| 8 | 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"] | 8 | 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"] |
| 9 | 9 | ||
| 10 | [dependencies] | 10 | [dependencies] |
| 11 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } | 11 | 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 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; | |||
| 18 | use embassy_sync::channel::Channel; | 18 | use embassy_sync::channel::Channel; |
| 19 | use embassy_usb::{Builder, Config, UsbDevice}; | 19 | use embassy_usb::{Builder, Config, UsbDevice}; |
| 20 | use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State}; | 20 | use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State}; |
| 21 | use embedded_io::asynch::{Read, Write}; | 21 | use embedded_io::asynch::Write; |
| 22 | use static_cell::StaticCell; | 22 | use static_cell::StaticCell; |
| 23 | use {defmt_rtt as _, panic_probe as _}; | 23 | use {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 | |||
| 11 | embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["defmt", "unstable-traits", "nightly", "unstable-pac"] } | 11 | embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["defmt", "unstable-traits", "nightly", "unstable-pac"] } |
| 12 | embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } | 12 | embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } |
| 13 | embassy-usb-serial = { version = "0.1.0", path = "../../embassy-usb-serial", features = ["defmt"] } | 13 | embassy-usb-serial = { version = "0.1.0", path = "../../embassy-usb-serial", features = ["defmt"] } |
| 14 | embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] } | 14 | embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] } |
| 15 | embassy-usb-ncm = { version = "0.1.0", path = "../../embassy-usb-ncm", features = ["defmt"] } | 15 | embassy-usb-ncm = { version = "0.1.0", path = "../../embassy-usb-ncm", features = ["defmt"] } |
| 16 | 16 | ||
| 17 | defmt = "0.3" | 17 | defmt = "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; | |||
| 16 | use embassy_sync::channel::Channel; | 16 | use embassy_sync::channel::Channel; |
| 17 | use embassy_usb::{Builder, Config, UsbDevice}; | 17 | use embassy_usb::{Builder, Config, UsbDevice}; |
| 18 | use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State}; | 18 | use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State}; |
| 19 | use embedded_io::asynch::{Read, Write}; | 19 | use embedded_io::asynch::Write; |
| 20 | use static_cell::StaticCell; | 20 | use static_cell::StaticCell; |
| 21 | use {defmt_rtt as _, panic_probe as _}; | 21 | use {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" | |||
| 7 | embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["log"] } | 7 | embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["log"] } |
| 8 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["log", "std", "nightly", "integrated-timers"] } | 8 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["log", "std", "nightly", "integrated-timers"] } |
| 9 | embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["log", "std", "nightly"] } | 9 | embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["log", "std", "nightly"] } |
| 10 | embassy-net = { version = "0.1.0", path = "../../embassy-net", features=[ "std", "log", "medium-ethernet", "tcp", "udp", "dhcpv4", "pool-16"] } | 10 | embassy-net = { version = "0.1.0", path = "../../embassy-net", features=[ "std", "nightly", "log", "medium-ethernet", "tcp", "udp", "dhcpv4", "pool-16"] } |
| 11 | embedded-io = { version = "0.3.0", features = ["async", "std", "futures"] } | 11 | embedded-io = { version = "0.3.0", features = ["async", "std", "futures"] } |
| 12 | critical-section = { version = "1.1", features = ["std"] } | 12 | critical-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 | |||
| 8 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] } | 8 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] } |
| 9 | embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-32768hz"] } | 9 | embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-32768hz"] } |
| 10 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "net", "stm32f767zi", "unstable-pac", "time-driver-any", "exti"] } | 10 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "net", "stm32f767zi", "unstable-pac", "time-driver-any", "exti"] } |
| 11 | embassy-net = { path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] } | 11 | embassy-net = { path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] } |
| 12 | embedded-io = { version = "0.3.0", features = ["async"] } | 12 | embedded-io = { version = "0.3.0", features = ["async"] } |
| 13 | 13 | ||
| 14 | defmt = "0.3" | 14 | defmt = "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 | |||
| 8 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] } | 8 | embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] } |
| 9 | embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "unstable-traits", "tick-32768hz"] } | 9 | embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "unstable-traits", "tick-32768hz"] } |
| 10 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32h743bi", "net", "time-driver-any", "exti", "unstable-pac", "unstable-traits"] } | 10 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32h743bi", "net", "time-driver-any", "exti", "unstable-pac", "unstable-traits"] } |
| 11 | embassy-net = { path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "pool-16", "unstable-traits"] } | 11 | embassy-net = { path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "dhcpv4", "medium-ethernet", "pool-16", "unstable-traits"] } |
| 12 | embedded-io = { version = "0.3.0", features = ["async"] } | 12 | embedded-io = { version = "0.3.0", features = ["async"] } |
| 13 | 13 | ||
| 14 | defmt = "0.3" | 14 | defmt = "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 | |||
| 14 | embassy-usb-serial = { version = "0.1.0", path = "../../embassy-usb-serial", features = ["defmt"] } | 14 | embassy-usb-serial = { version = "0.1.0", path = "../../embassy-usb-serial", features = ["defmt"] } |
| 15 | embassy-usb-hid = { version = "0.1.0", path = "../../embassy-usb-hid", features = ["defmt"] } | 15 | embassy-usb-hid = { version = "0.1.0", path = "../../embassy-usb-hid", features = ["defmt"] } |
| 16 | embassy-usb-ncm = { version = "0.1.0", path = "../../embassy-usb-ncm", features = ["defmt"] } | 16 | embassy-usb-ncm = { version = "0.1.0", path = "../../embassy-usb-ncm", features = ["defmt"] } |
| 17 | embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] } | 17 | embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] } |
| 18 | usbd-hid = "0.5.2" | 18 | usbd-hid = "0.5.2" |
| 19 | 19 | ||
| 20 | defmt = "0.3" | 20 | defmt = "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; | |||
| 12 | use embassy_net::{PacketBox, PacketBoxExt, PacketBuf, Stack, StackResources}; | 12 | use embassy_net::{PacketBox, PacketBoxExt, PacketBuf, Stack, StackResources}; |
| 13 | use embassy_stm32::rcc::*; | 13 | use embassy_stm32::rcc::*; |
| 14 | use embassy_stm32::rng::Rng; | 14 | use embassy_stm32::rng::Rng; |
| 15 | use embassy_stm32::time::Hertz; | ||
| 16 | use embassy_stm32::usb::Driver; | 15 | use embassy_stm32::usb::Driver; |
| 17 | use embassy_stm32::{interrupt, Config}; | 16 | use embassy_stm32::{interrupt, Config}; |
| 18 | use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; | 17 | use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex; |
| 19 | use embassy_sync::channel::Channel; | 18 | use embassy_sync::channel::Channel; |
| 20 | use embassy_usb::{Builder, UsbDevice}; | 19 | use embassy_usb::{Builder, UsbDevice}; |
| 21 | use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State}; | 20 | use embassy_usb_ncm::{CdcNcmClass, Receiver, Sender, State}; |
| 22 | use embedded_io::asynch::{Read, Write}; | 21 | use embedded_io::asynch::Write; |
| 23 | use rand_core::RngCore; | 22 | use rand_core::RngCore; |
| 24 | use static_cell::StaticCell; | 23 | use static_cell::StaticCell; |
| 25 | use {defmt_rtt as _, panic_probe as _}; | 24 | 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 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 @@ | |||
| 6 | use defmt::*; | 6 | use defmt::*; |
| 7 | use embassy_executor::Spawner; | 7 | use embassy_executor::Spawner; |
| 8 | use embassy_stm32::rcc::*; | 8 | use embassy_stm32::rcc::*; |
| 9 | use embassy_stm32::time::Hertz; | ||
| 10 | use embassy_stm32::usb::Driver; | 9 | use embassy_stm32::usb::Driver; |
| 11 | use embassy_stm32::{interrupt, Config, Peripherals}; | 10 | use embassy_stm32::{interrupt, Config}; |
| 12 | use embassy_time::{Duration, Timer}; | 11 | use embassy_time::{Duration, Timer}; |
| 13 | use embassy_usb::control::OutResponse; | 12 | use embassy_usb::control::OutResponse; |
| 14 | use embassy_usb::Builder; | 13 | use 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 @@ | |||
| 5 | use defmt::{panic, *}; | 5 | use defmt::{panic, *}; |
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_stm32::rcc::*; | 7 | use embassy_stm32::rcc::*; |
| 8 | use embassy_stm32::time::Hertz; | ||
| 9 | use embassy_stm32::usb::{Driver, Instance}; | 8 | use embassy_stm32::usb::{Driver, Instance}; |
| 10 | use embassy_stm32::{interrupt, Config}; | 9 | use embassy_stm32::{interrupt, Config}; |
| 11 | use embassy_usb::driver::EndpointError; | 10 | use embassy_usb::driver::EndpointError; |
