Update Embassy.

This commit is contained in:
Dario Nieuwenhuis 2022-08-13 15:37:30 +02:00
parent 3388b5cecf
commit f76815d642
4 changed files with 24 additions and 20 deletions

View File

@ -4,10 +4,12 @@ version = "0.1.0"
edition = "2021" edition = "2021"
[features] [features]
defmt = ["dep:defmt", "embassy/defmt"] defmt = ["dep:defmt"]
log = ["dep:log"] log = ["dep:log"]
[dependencies] [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" } embassy-net = { version = "0.1.0" }
atomic-polyfill = "0.1.5" atomic-polyfill = "0.1.5"

View File

@ -6,7 +6,8 @@ edition = "2021"
[dependencies] [dependencies]
cyw43 = { path = "../../", features = ["defmt"]} 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-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"] } embassy-net = { version = "0.1.0", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "pool-16"] }
atomic-polyfill = "0.1.5" atomic-polyfill = "0.1.5"
@ -26,10 +27,12 @@ heapless = "0.7.15"
[patch.crates-io] [patch.crates-io]
embassy = { git = "https://github.com/embassy-rs/embassy", rev = "5f43c1d37e9db847c7861fe0bd821db62edba9f6" } embassy-executor = { git = "https://github.com/embassy-rs/embassy", rev = "6ffca81a38d2c7f57da667ff49b4296c4eba78e2" }
embassy-rp = { git = "https://github.com/embassy-rs/embassy", rev = "5f43c1d37e9db847c7861fe0bd821db62edba9f6" } embassy-util = { git = "https://github.com/embassy-rs/embassy", rev = "6ffca81a38d2c7f57da667ff49b4296c4eba78e2" }
embassy-net = { git = "https://github.com/embassy-rs/embassy", rev = "5f43c1d37e9db847c7861fe0bd821db62edba9f6" } embassy-rp = { git = "https://github.com/embassy-rs/embassy", rev = "6ffca81a38d2c7f57da667ff49b4296c4eba78e2" }
#embassy = { path = "/home/dirbaio/embassy/embassy/embassy" } 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-rp = { path = "/home/dirbaio/embassy/embassy/embassy-rp" }
#embassy-net = { path = "/home/dirbaio/embassy/embassy/embassy-net" } #embassy-net = { path = "/home/dirbaio/embassy/embassy/embassy-net" }
#smoltcp = { path = "./smoltcp" } #smoltcp = { path = "./smoltcp" }

View File

@ -5,15 +5,14 @@
use core::convert::Infallible; use core::convert::Infallible;
use core::future::Future; use core::future::Future;
use defmt::{assert, assert_eq, panic, *}; use defmt::*;
use embassy::executor::Spawner; use embassy_executor::executor::Spawner;
use embassy::time::{Duration, Timer};
use embassy::util::Forever;
use embassy_net::tcp::TcpSocket; use embassy_net::tcp::TcpSocket;
use embassy_net::{Ipv4Address, Ipv4Cidr, Stack, StackResources}; use embassy_net::{Stack, StackResources};
use embassy_rp::gpio::{Flex, Level, Output, Pin}; use embassy_rp::gpio::{Flex, Level, Output};
use embassy_rp::peripherals::{PIN_23, PIN_24, PIN_25, PIN_29}; use embassy_rp::peripherals::{PIN_23, PIN_24, PIN_25, PIN_29};
use embassy_rp::Peripherals; use embassy_rp::Peripherals;
use embassy_util::Forever;
use embedded_hal_1::spi::ErrorType; use embedded_hal_1::spi::ErrorType;
use embedded_hal_async::spi::{ExclusiveDevice, SpiBusFlush, SpiBusRead, SpiBusWrite}; use embedded_hal_async::spi::{ExclusiveDevice, SpiBusFlush, SpiBusRead, SpiBusWrite};
use embedded_io::asynch::{Read, Write}; use embedded_io::asynch::{Read, Write};
@ -27,19 +26,19 @@ macro_rules! forever {
}}; }};
} }
#[embassy::task] #[embassy_executor::task]
async fn wifi_task( async fn wifi_task(
runner: cyw43::Runner<'static, Output<'static, PIN_23>, ExclusiveDevice<MySpi, Output<'static, PIN_25>>>, runner: cyw43::Runner<'static, Output<'static, PIN_23>, ExclusiveDevice<MySpi, Output<'static, PIN_25>>>,
) -> ! { ) -> ! {
runner.run().await runner.run().await
} }
#[embassy::task] #[embassy_executor::task]
async fn net_task(stack: &'static Stack<cyw43::NetDevice<'static>>) -> ! { async fn net_task(stack: &'static Stack<cyw43::NetDevice<'static>>) -> ! {
stack.run().await stack.run().await
} }
#[embassy::main] #[embassy_executor::main]
async fn main(spawner: Spawner, p: Peripherals) { async fn main(spawner: Spawner, p: Peripherals) {
info!("Hello World!"); info!("Hello World!");

View File

@ -17,11 +17,11 @@ use core::sync::atomic::Ordering;
use core::task::Waker; use core::task::Waker;
use atomic_polyfill::AtomicBool; use atomic_polyfill::AtomicBool;
use embassy::blocking_mutex::raw::NoopRawMutex; use embassy_executor::time::{block_for, Duration, Timer};
use embassy::channel::mpmc::Channel;
use embassy::time::{block_for, Duration, Timer};
use embassy::util::yield_now;
use embassy_net::{PacketBoxExt, PacketBuf}; 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_1::digital::blocking::OutputPin;
use embedded_hal_async::spi::{SpiBusRead, SpiBusWrite, SpiDevice}; use embedded_hal_async::spi::{SpiBusRead, SpiBusWrite, SpiDevice};