chore: replace make_static! macro usage with non-macro version
This commit is contained in:
@ -14,7 +14,7 @@ use embassy_nrf::spim::{self, Spim};
|
||||
use embassy_nrf::{bind_interrupts, peripherals};
|
||||
use embassy_time::Delay;
|
||||
use embedded_hal_bus::spi::ExclusiveDevice;
|
||||
use static_cell::make_static;
|
||||
use static_cell::StaticCell;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
bind_interrupts!(struct Irqs {
|
||||
@ -68,11 +68,13 @@ async fn main(spawner: Spawner) {
|
||||
let seed = u64::from_le_bytes(seed);
|
||||
|
||||
// Init network stack
|
||||
let stack = &*make_static!(Stack::new(
|
||||
static STACK: StaticCell<Stack<MyDriver>> = StaticCell::new();
|
||||
static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new();
|
||||
let stack = &*STACK.init(Stack::new(
|
||||
device,
|
||||
config,
|
||||
make_static!(StackResources::<2>::new()),
|
||||
seed
|
||||
RESOURCES.init(StackResources::<2>::new()),
|
||||
seed,
|
||||
));
|
||||
|
||||
unwrap!(spawner.spawn(net_task(stack)));
|
||||
|
@ -13,7 +13,7 @@ use embassy_nrf::spim::{self, Spim};
|
||||
use embassy_nrf::{bind_interrupts, peripherals};
|
||||
use embassy_time::Delay;
|
||||
use embedded_hal_bus::spi::ExclusiveDevice;
|
||||
use static_cell::make_static;
|
||||
use static_cell::StaticCell;
|
||||
use {defmt_rtt as _, embassy_net_esp_hosted as hosted, panic_probe as _};
|
||||
|
||||
bind_interrupts!(struct Irqs {
|
||||
@ -64,8 +64,9 @@ async fn main(spawner: Spawner) {
|
||||
let spi = spim::Spim::new(p.SPI3, Irqs, sck, miso, mosi, config);
|
||||
let spi = ExclusiveDevice::new(spi, cs, Delay);
|
||||
|
||||
static STATE: StaticCell<embassy_net_esp_hosted::State> = StaticCell::new();
|
||||
let (device, mut control, runner) = embassy_net_esp_hosted::new(
|
||||
make_static!(embassy_net_esp_hosted::State::new()),
|
||||
STATE.init(embassy_net_esp_hosted::State::new()),
|
||||
spi,
|
||||
handshake,
|
||||
ready,
|
||||
@ -85,11 +86,13 @@ async fn main(spawner: Spawner) {
|
||||
let seed = u64::from_le_bytes(seed);
|
||||
|
||||
// Init network stack
|
||||
let stack = &*make_static!(Stack::new(
|
||||
static STACK: StaticCell<Stack<MyDriver>> = StaticCell::new();
|
||||
static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new();
|
||||
let stack = &*STACK.init(Stack::new(
|
||||
device,
|
||||
Config::dhcpv4(Default::default()),
|
||||
make_static!(StackResources::<2>::new()),
|
||||
seed
|
||||
RESOURCES.init(StackResources::<2>::new()),
|
||||
seed,
|
||||
));
|
||||
|
||||
unwrap!(spawner.spawn(net_task(stack)));
|
||||
|
@ -11,7 +11,7 @@ use embassy_rp::gpio::{Level, Output};
|
||||
use embassy_rp::peripherals::{DMA_CH0, PIN_23, PIN_25, PIO0};
|
||||
use embassy_rp::pio::{InterruptHandler, Pio};
|
||||
use embassy_rp::{bind_interrupts, rom_data};
|
||||
use static_cell::make_static;
|
||||
use static_cell::StaticCell;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
bind_interrupts!(struct Irqs {
|
||||
@ -58,7 +58,8 @@ async fn main(spawner: Spawner) {
|
||||
let mut pio = Pio::new(p.PIO0, Irqs);
|
||||
let spi = PioSpi::new(&mut pio.common, pio.sm0, pio.irq0, cs, p.PIN_24, p.PIN_29, p.DMA_CH0);
|
||||
|
||||
let state = make_static!(cyw43::State::new());
|
||||
static STATE: StaticCell<cyw43::State> = StaticCell::new();
|
||||
let state = STATE.init(cyw43::State::new());
|
||||
let (net_device, mut control, runner) = cyw43::new(state, pwr, spi, fw).await;
|
||||
unwrap!(spawner.spawn(wifi_task(runner)));
|
||||
|
||||
@ -71,11 +72,13 @@ async fn main(spawner: Spawner) {
|
||||
let seed = 0x0123_4567_89ab_cdef; // chosen by fair dice roll. guarenteed to be random.
|
||||
|
||||
// Init network stack
|
||||
let stack = &*make_static!(Stack::new(
|
||||
static STACK: StaticCell<Stack<cyw43::NetDriver<'static>>> = StaticCell::new();
|
||||
static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new();
|
||||
let stack = &*STACK.init(Stack::new(
|
||||
net_device,
|
||||
Config::dhcpv4(Default::default()),
|
||||
make_static!(StackResources::<2>::new()),
|
||||
seed
|
||||
RESOURCES.init(StackResources::<2>::new()),
|
||||
seed,
|
||||
));
|
||||
|
||||
unwrap!(spawner.spawn(net_task(stack)));
|
||||
|
@ -16,7 +16,7 @@ use embassy_rp::spi::{Async, Config as SpiConfig, Spi};
|
||||
use embassy_time::Delay;
|
||||
use embedded_hal_bus::spi::ExclusiveDevice;
|
||||
use rand::RngCore;
|
||||
use static_cell::make_static;
|
||||
use static_cell::StaticCell;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::task]
|
||||
@ -51,7 +51,8 @@ async fn main(spawner: Spawner) {
|
||||
let w5500_reset = Output::new(p.PIN_20, Level::High);
|
||||
|
||||
let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00];
|
||||
let state = make_static!(State::<8, 8>::new());
|
||||
static STATE: StaticCell<State<8, 8>> = StaticCell::new();
|
||||
let state = STATE.init(State::<8, 8>::new());
|
||||
let (device, runner) = embassy_net_wiznet::new(
|
||||
mac_addr,
|
||||
state,
|
||||
@ -66,11 +67,13 @@ async fn main(spawner: Spawner) {
|
||||
let seed = rng.next_u64();
|
||||
|
||||
// Init network stack
|
||||
let stack = &*make_static!(Stack::new(
|
||||
static STACK: StaticCell<Stack<Device<'static>>> = StaticCell::new();
|
||||
static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new();
|
||||
let stack = &*STACK.init(Stack::new(
|
||||
device,
|
||||
embassy_net::Config::dhcpv4(Default::default()),
|
||||
make_static!(StackResources::<2>::new()),
|
||||
seed
|
||||
RESOURCES.init(StackResources::<2>::new()),
|
||||
seed,
|
||||
));
|
||||
|
||||
// Launch network task
|
||||
|
@ -14,7 +14,7 @@ use embassy_stm32::peripherals::ETH;
|
||||
use embassy_stm32::rng::Rng;
|
||||
use embassy_stm32::{bind_interrupts, eth, peripherals, rng};
|
||||
use rand_core::RngCore;
|
||||
use static_cell::make_static;
|
||||
use static_cell::StaticCell;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
teleprobe_meta::timeout!(120);
|
||||
@ -71,8 +71,9 @@ async fn main(spawner: Spawner) {
|
||||
#[cfg(not(feature = "stm32f207zg"))]
|
||||
const PACKET_QUEUE_SIZE: usize = 4;
|
||||
|
||||
static PACKETS: StaticCell<PacketQueue<PACKET_QUEUE_SIZE, PACKET_QUEUE_SIZE>> = StaticCell::new();
|
||||
let device = Ethernet::new(
|
||||
make_static!(PacketQueue::<PACKET_QUEUE_SIZE, PACKET_QUEUE_SIZE>::new()),
|
||||
PACKETS.init(PacketQueue::<PACKET_QUEUE_SIZE, PACKET_QUEUE_SIZE>::new()),
|
||||
p.ETH,
|
||||
Irqs,
|
||||
p.PA1,
|
||||
@ -99,11 +100,13 @@ async fn main(spawner: Spawner) {
|
||||
//});
|
||||
|
||||
// Init network stack
|
||||
let stack = &*make_static!(Stack::new(
|
||||
static STACK: StaticCell<Stack<Device>> = StaticCell::new();
|
||||
static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new();
|
||||
let stack = &*STACK.init(Stack::new(
|
||||
device,
|
||||
config,
|
||||
make_static!(StackResources::<2>::new()),
|
||||
seed
|
||||
RESOURCES.init(StackResources::<2>::new()),
|
||||
seed,
|
||||
));
|
||||
|
||||
// Launch network task
|
||||
|
@ -15,7 +15,7 @@ use embassy_stm32::rcc::LsConfig;
|
||||
use embassy_stm32::rtc::{Rtc, RtcConfig};
|
||||
use embassy_stm32::Config;
|
||||
use embassy_time::Timer;
|
||||
use static_cell::make_static;
|
||||
use static_cell::StaticCell;
|
||||
|
||||
#[entry]
|
||||
fn main() -> ! {
|
||||
@ -64,7 +64,8 @@ async fn async_main(spawner: Spawner) {
|
||||
|
||||
rtc.set_datetime(now.into()).expect("datetime not set");
|
||||
|
||||
let rtc = make_static!(rtc);
|
||||
static RTC: StaticCell<Rtc> = StaticCell::new();
|
||||
let rtc = RTC.init(rtc);
|
||||
|
||||
stop_with_rtc(rtc);
|
||||
|
||||
|
Reference in New Issue
Block a user