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"
[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"

View File

@ -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" }

View File

@ -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<MySpi, Output<'static, PIN_25>>>,
) -> ! {
runner.run().await
}
#[embassy::task]
#[embassy_executor::task]
async fn net_task(stack: &'static Stack<cyw43::NetDevice<'static>>) -> ! {
stack.run().await
}
#[embassy::main]
#[embassy_executor::main]
async fn main(spawner: Spawner, p: Peripherals) {
info!("Hello World!");

View File

@ -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};