Use make_static! from static-cell v1.1

This commit is contained in:
Dario Nieuwenhuis
2023-06-01 01:32:11 +02:00
parent d7d66bd74f
commit 1d8321b821
38 changed files with 168 additions and 300 deletions

View File

@ -13,17 +13,9 @@ use embassy_net::Stack;
use embassy_rp::gpio::{Level, Output};
use embassy_rp::peripherals::{DMA_CH0, PIN_23, PIN_25, PIO0};
use embassy_rp::pio::Pio;
use static_cell::StaticCell;
use static_cell::make_static;
use {defmt_rtt as _, panic_probe as _};
macro_rules! singleton {
($val:expr) => {{
type T = impl Sized;
static STATIC_CELL: StaticCell<T> = StaticCell::new();
STATIC_CELL.init_with(move || $val)
}};
}
#[embassy_executor::task]
async fn wifi_task(
runner: cyw43::Runner<'static, Output<'static, PIN_23>, PioSpi<'static, PIN_25, PIO0, 0, DMA_CH0>>,
@ -57,7 +49,7 @@ async fn main(spawner: Spawner) {
let mut pio = Pio::new(p.PIO0);
let spi = PioSpi::new(&mut pio.common, pio.sm0, pio.irq0, cs, p.PIN_24, p.PIN_29, p.DMA_CH0);
let state = singleton!(cyw43::State::new());
let state = make_static!(cyw43::State::new());
let (_net_device, mut control, runner) = cyw43::new(state, pwr, spi, fw).await;
unwrap!(spawner.spawn(wifi_task(runner)));