chore: replace make_static! macro usage with non-macro version

This commit is contained in:
Ulf Lilleengen
2023-12-21 08:50:54 +01:00
parent d832d45c0b
commit 0acf7b09c3
37 changed files with 313 additions and 188 deletions

View File

@ -14,7 +14,7 @@ use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config};
use embassy_time::Timer;
use embedded_io_async::Write;
use rand_core::RngCore;
use static_cell::make_static;
use static_cell::StaticCell;
use {defmt_rtt as _, panic_probe as _};
bind_interrupts!(struct Irqs {
@ -64,8 +64,9 @@ async fn main(spawner: Spawner) -> ! {
let mac_addr = [0x00, 0x00, 0xDE, 0xAD, 0xBE, 0xEF];
static PACKETS: StaticCell<PacketQueue<4, 4>> = StaticCell::new();
let device = Ethernet::new(
make_static!(PacketQueue::<16, 16>::new()),
PACKETS.init(PacketQueue::<4, 4>::new()),
p.ETH,
Irqs,
p.PA1,
@ -89,11 +90,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<3>> = StaticCell::new();
let stack = &*STACK.init(Stack::new(
device,
config,
make_static!(StackResources::<3>::new()),
seed
RESOURCES.init(StackResources::<3>::new()),
seed,
));
// Launch network task

View File

@ -15,7 +15,7 @@ use embassy_time::Timer;
use embedded_io_async::Write;
use embedded_nal_async::{Ipv4Addr, SocketAddr, SocketAddrV4, TcpConnect};
use rand_core::RngCore;
use static_cell::make_static;
use static_cell::StaticCell;
use {defmt_rtt as _, panic_probe as _};
bind_interrupts!(struct Irqs {
@ -65,8 +65,9 @@ async fn main(spawner: Spawner) -> ! {
let mac_addr = [0x00, 0x00, 0xDE, 0xAD, 0xBE, 0xEF];
static PACKETS: StaticCell<PacketQueue<16, 16>> = StaticCell::new();
let device = Ethernet::new(
make_static!(PacketQueue::<16, 16>::new()),
PACKETS.init(PacketQueue::<16, 16>::new()),
p.ETH,
Irqs,
p.PA1,
@ -90,11 +91,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<3>> = StaticCell::new();
let stack = &*STACK.init(Stack::new(
device,
config,
make_static!(StackResources::<3>::new()),
seed
RESOURCES.init(StackResources::<3>::new()),
seed,
));
// Launch network task