From f76815d642064b5ed5b1673e4a386e2747813f20 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Sat, 13 Aug 2022 15:37:30 +0200 Subject: [PATCH] Update Embassy. --- Cargo.toml | 6 ++++-- examples/rpi-pico-w/Cargo.toml | 13 ++++++++----- examples/rpi-pico-w/src/main.rs | 17 ++++++++--------- src/lib.rs | 8 ++++---- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d35e865b..cea7d780 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,10 +4,12 @@ version = "0.1.0" edition = "2021" [features] -defmt = ["dep:defmt", "embassy/defmt"] +defmt = ["dep:defmt"] log = ["dep:log"] + [dependencies] -embassy = { version = "0.1.0" } +embassy-executor = { version = "0.1.0", features = [ "time" ] } +embassy-util = { version = "0.1.0" } embassy-net = { version = "0.1.0" } atomic-polyfill = "0.1.5" diff --git a/examples/rpi-pico-w/Cargo.toml b/examples/rpi-pico-w/Cargo.toml index 9e1d7547..af558d8c 100644 --- a/examples/rpi-pico-w/Cargo.toml +++ b/examples/rpi-pico-w/Cargo.toml @@ -6,7 +6,8 @@ edition = "2021" [dependencies] cyw43 = { path = "../../", features = ["defmt"]} -embassy = { version = "0.1.0", features = ["defmt", "defmt-timestamp-uptime"] } +embassy-executor = { version = "0.1.0", features = ["defmt", "defmt-timestamp-uptime"] } +embassy-util = { version = "0.1.0" } embassy-rp = { version = "0.1.0", features = ["defmt", "unstable-traits", "nightly", "unstable-pac"] } embassy-net = { version = "0.1.0", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] } atomic-polyfill = "0.1.5" @@ -26,10 +27,12 @@ heapless = "0.7.15" [patch.crates-io] -embassy = { git = "https://github.com/embassy-rs/embassy", rev = "5f43c1d37e9db847c7861fe0bd821db62edba9f6" } -embassy-rp = { git = "https://github.com/embassy-rs/embassy", rev = "5f43c1d37e9db847c7861fe0bd821db62edba9f6" } -embassy-net = { git = "https://github.com/embassy-rs/embassy", rev = "5f43c1d37e9db847c7861fe0bd821db62edba9f6" } -#embassy = { path = "/home/dirbaio/embassy/embassy/embassy" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy", rev = "6ffca81a38d2c7f57da667ff49b4296c4eba78e2" } +embassy-util = { git = "https://github.com/embassy-rs/embassy", rev = "6ffca81a38d2c7f57da667ff49b4296c4eba78e2" } +embassy-rp = { git = "https://github.com/embassy-rs/embassy", rev = "6ffca81a38d2c7f57da667ff49b4296c4eba78e2" } +embassy-net = { git = "https://github.com/embassy-rs/embassy", rev = "6ffca81a38d2c7f57da667ff49b4296c4eba78e2" } +#embassy-executor = { path = "/home/dirbaio/embassy/embassy/embassy-executor" } +#embassy-util = { path = "/home/dirbaio/embassy/embassy/embassy-util" } #embassy-rp = { path = "/home/dirbaio/embassy/embassy/embassy-rp" } #embassy-net = { path = "/home/dirbaio/embassy/embassy/embassy-net" } #smoltcp = { path = "./smoltcp" } diff --git a/examples/rpi-pico-w/src/main.rs b/examples/rpi-pico-w/src/main.rs index 3e966d21..91f08726 100644 --- a/examples/rpi-pico-w/src/main.rs +++ b/examples/rpi-pico-w/src/main.rs @@ -5,15 +5,14 @@ use core::convert::Infallible; use core::future::Future; -use defmt::{assert, assert_eq, panic, *}; -use embassy::executor::Spawner; -use embassy::time::{Duration, Timer}; -use embassy::util::Forever; +use defmt::*; +use embassy_executor::executor::Spawner; use embassy_net::tcp::TcpSocket; -use embassy_net::{Ipv4Address, Ipv4Cidr, Stack, StackResources}; -use embassy_rp::gpio::{Flex, Level, Output, Pin}; +use embassy_net::{Stack, StackResources}; +use embassy_rp::gpio::{Flex, Level, Output}; use embassy_rp::peripherals::{PIN_23, PIN_24, PIN_25, PIN_29}; use embassy_rp::Peripherals; +use embassy_util::Forever; use embedded_hal_1::spi::ErrorType; use embedded_hal_async::spi::{ExclusiveDevice, SpiBusFlush, SpiBusRead, SpiBusWrite}; use embedded_io::asynch::{Read, Write}; @@ -27,19 +26,19 @@ macro_rules! forever { }}; } -#[embassy::task] +#[embassy_executor::task] async fn wifi_task( runner: cyw43::Runner<'static, Output<'static, PIN_23>, ExclusiveDevice>>, ) -> ! { runner.run().await } -#[embassy::task] +#[embassy_executor::task] async fn net_task(stack: &'static Stack>) -> ! { stack.run().await } -#[embassy::main] +#[embassy_executor::main] async fn main(spawner: Spawner, p: Peripherals) { info!("Hello World!"); diff --git a/src/lib.rs b/src/lib.rs index 3d08370c..3932ce41 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,11 +17,11 @@ use core::sync::atomic::Ordering; use core::task::Waker; use atomic_polyfill::AtomicBool; -use embassy::blocking_mutex::raw::NoopRawMutex; -use embassy::channel::mpmc::Channel; -use embassy::time::{block_for, Duration, Timer}; -use embassy::util::yield_now; +use embassy_executor::time::{block_for, Duration, Timer}; use embassy_net::{PacketBoxExt, PacketBuf}; +use embassy_util::blocking_mutex::raw::NoopRawMutex; +use embassy_util::channel::mpmc::Channel; +use embassy_util::yield_now; use embedded_hal_1::digital::blocking::OutputPin; use embedded_hal_async::spi::{SpiBusRead, SpiBusWrite, SpiDevice};