Update Embassy.
This commit is contained in:
parent
79c7be3fc6
commit
945449b10f
@ -8,7 +8,7 @@ defmt = ["dep:defmt"]
|
|||||||
log = ["dep:log"]
|
log = ["dep:log"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-executor = { version = "0.1.0", features = [ "time" ] }
|
embassy-time = { version = "0.1.0" }
|
||||||
embassy-util = { version = "0.1.0" }
|
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"
|
||||||
|
@ -6,17 +6,19 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cyw43 = { path = "../../", features = ["defmt"]}
|
cyw43 = { path = "../../", features = ["defmt"]}
|
||||||
embassy-executor = { version = "0.1.0", features = ["defmt", "defmt-timestamp-uptime"] }
|
embassy-executor = { version = "0.1.0", features = ["defmt", "integrated-timers"] }
|
||||||
|
embassy-time = { version = "0.1.0", features = ["defmt", "defmt-timestamp-uptime"] }
|
||||||
embassy-util = { version = "0.1.0" }
|
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"
|
||||||
|
static_cell = "1.0"
|
||||||
|
|
||||||
defmt = "0.3"
|
defmt = "0.3"
|
||||||
defmt-rtt = "0.3"
|
defmt-rtt = "0.3"
|
||||||
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
||||||
|
|
||||||
cortex-m = "0.7.3"
|
cortex-m = { version = "0.7.6", features = ["critical-section-single-core"]}
|
||||||
cortex-m-rt = "0.7.0"
|
cortex-m-rt = "0.7.0"
|
||||||
futures = { version = "0.3.17", default-features = false, features = ["async-await", "cfg-target-has-atomic", "unstable"] }
|
futures = { version = "0.3.17", default-features = false, features = ["async-await", "cfg-target-has-atomic", "unstable"] }
|
||||||
|
|
||||||
@ -27,10 +29,11 @@ heapless = "0.7.15"
|
|||||||
|
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
embassy-executor = { git = "https://github.com/embassy-rs/embassy", rev = "6ffca81a38d2c7f57da667ff49b4296c4eba78e2" }
|
embassy-executor = { git = "https://github.com/embassy-rs/embassy", rev = "53fbd0efb3e77e1e3de948afde2b5bf1a5a9735f" }
|
||||||
embassy-util = { git = "https://github.com/embassy-rs/embassy", rev = "6ffca81a38d2c7f57da667ff49b4296c4eba78e2" }
|
embassy-time = { git = "https://github.com/embassy-rs/embassy", rev = "53fbd0efb3e77e1e3de948afde2b5bf1a5a9735f" }
|
||||||
embassy-rp = { git = "https://github.com/embassy-rs/embassy", rev = "6ffca81a38d2c7f57da667ff49b4296c4eba78e2" }
|
embassy-util = { git = "https://github.com/embassy-rs/embassy", rev = "53fbd0efb3e77e1e3de948afde2b5bf1a5a9735f" }
|
||||||
embassy-net = { git = "https://github.com/embassy-rs/embassy", rev = "6ffca81a38d2c7f57da667ff49b4296c4eba78e2" }
|
embassy-rp = { git = "https://github.com/embassy-rs/embassy", rev = "53fbd0efb3e77e1e3de948afde2b5bf1a5a9735f" }
|
||||||
|
embassy-net = { git = "https://github.com/embassy-rs/embassy", rev = "53fbd0efb3e77e1e3de948afde2b5bf1a5a9735f" }
|
||||||
#embassy-executor = { path = "/home/dirbaio/embassy/embassy/embassy-executor" }
|
#embassy-executor = { path = "/home/dirbaio/embassy/embassy/embassy-executor" }
|
||||||
#embassy-util = { path = "/home/dirbaio/embassy/embassy/embassy-util" }
|
#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" }
|
||||||
|
@ -6,23 +6,22 @@ use core::convert::Infallible;
|
|||||||
use core::future::Future;
|
use core::future::Future;
|
||||||
|
|
||||||
use defmt::*;
|
use defmt::*;
|
||||||
use embassy_executor::executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
use embassy_net::tcp::TcpSocket;
|
use embassy_net::tcp::TcpSocket;
|
||||||
use embassy_net::{Stack, StackResources};
|
use embassy_net::{Stack, StackResources};
|
||||||
use embassy_rp::gpio::{Flex, Level, Output};
|
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_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};
|
||||||
|
use static_cell::StaticCell;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
macro_rules! forever {
|
macro_rules! singleton {
|
||||||
($val:expr) => {{
|
($val:expr) => {{
|
||||||
type T = impl Sized;
|
type T = impl Sized;
|
||||||
static FOREVER: Forever<T> = Forever::new();
|
static STATIC_CELL: StaticCell<T> = StaticCell::new();
|
||||||
FOREVER.put_with(move || $val)
|
STATIC_CELL.init_with(move || $val)
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,9 +38,11 @@ async fn net_task(stack: &'static Stack<cyw43::NetDevice<'static>>) -> ! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(spawner: Spawner, p: Peripherals) {
|
async fn main(spawner: Spawner) {
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
|
let p = embassy_rp::init(Default::default());
|
||||||
|
|
||||||
// Include the WiFi firmware and Country Locale Matrix (CLM) blobs.
|
// Include the WiFi firmware and Country Locale Matrix (CLM) blobs.
|
||||||
let fw = include_bytes!("../../../firmware/43439A0.bin");
|
let fw = include_bytes!("../../../firmware/43439A0.bin");
|
||||||
let clm = include_bytes!("../../../firmware/43439A0_clm.bin");
|
let clm = include_bytes!("../../../firmware/43439A0_clm.bin");
|
||||||
@ -63,7 +64,7 @@ async fn main(spawner: Spawner, p: Peripherals) {
|
|||||||
let bus = MySpi { clk, dio };
|
let bus = MySpi { clk, dio };
|
||||||
let spi = ExclusiveDevice::new(bus, cs);
|
let spi = ExclusiveDevice::new(bus, cs);
|
||||||
|
|
||||||
let state = forever!(cyw43::State::new());
|
let state = singleton!(cyw43::State::new());
|
||||||
let (mut control, runner) = cyw43::new(state, pwr, spi, fw).await;
|
let (mut control, runner) = cyw43::new(state, pwr, spi, fw).await;
|
||||||
|
|
||||||
spawner.spawn(wifi_task(runner)).unwrap();
|
spawner.spawn(wifi_task(runner)).unwrap();
|
||||||
@ -84,10 +85,10 @@ async fn main(spawner: Spawner, p: Peripherals) {
|
|||||||
let seed = 0x0123_4567_89ab_cdef; // chosen by fair dice roll. guarenteed to be random.
|
let seed = 0x0123_4567_89ab_cdef; // chosen by fair dice roll. guarenteed to be random.
|
||||||
|
|
||||||
// Init network stack
|
// Init network stack
|
||||||
let stack = &*forever!(Stack::new(
|
let stack = &*singleton!(Stack::new(
|
||||||
net_device,
|
net_device,
|
||||||
config,
|
config,
|
||||||
forever!(StackResources::<1, 2, 8>::new()),
|
singleton!(StackResources::<1, 2, 8>::new()),
|
||||||
seed
|
seed
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@ use core::sync::atomic::Ordering;
|
|||||||
use core::task::Waker;
|
use core::task::Waker;
|
||||||
|
|
||||||
use atomic_polyfill::AtomicBool;
|
use atomic_polyfill::AtomicBool;
|
||||||
use embassy_executor::time::{block_for, Duration, Timer};
|
|
||||||
use embassy_net::{PacketBoxExt, PacketBuf};
|
use embassy_net::{PacketBoxExt, PacketBuf};
|
||||||
|
use embassy_time::{block_for, Duration, Timer};
|
||||||
use embassy_util::blocking_mutex::raw::NoopRawMutex;
|
use embassy_util::blocking_mutex::raw::NoopRawMutex;
|
||||||
use embassy_util::channel::mpmc::Channel;
|
use embassy_util::channel::mpmc::Channel;
|
||||||
use embassy_util::yield_now;
|
use embassy_util::yield_now;
|
||||||
|
Loading…
Reference in New Issue
Block a user