Use make_static! from static-cell v1.1
This commit is contained in:
@ -30,7 +30,7 @@ critical-section = "1.1"
|
||||
micromath = "2.0.0"
|
||||
stm32-fmc = "0.2.4"
|
||||
embedded-storage = "0.3.0"
|
||||
static_cell = "1.0"
|
||||
static_cell = { version = "1.1", features = ["nightly"]}
|
||||
|
||||
# cargo build/run
|
||||
[profile.dev]
|
||||
|
@ -15,18 +15,8 @@ use embassy_stm32::{bind_interrupts, eth, Config};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embedded_io::asynch::Write;
|
||||
use rand_core::RngCore;
|
||||
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();
|
||||
let (x,) = STATIC_CELL.init(($val,));
|
||||
x
|
||||
}};
|
||||
}
|
||||
|
||||
bind_interrupts!(struct Irqs {
|
||||
ETH => eth::InterruptHandler;
|
||||
});
|
||||
@ -56,7 +46,7 @@ async fn main(spawner: Spawner) -> ! {
|
||||
let mac_addr = [0x00, 0x00, 0xDE, 0xAD, 0xBE, 0xEF];
|
||||
|
||||
let device = Ethernet::new(
|
||||
singleton!(PacketQueue::<16, 16>::new()),
|
||||
make_static!(PacketQueue::<16, 16>::new()),
|
||||
p.ETH,
|
||||
Irqs,
|
||||
p.PA1,
|
||||
@ -81,7 +71,12 @@ async fn main(spawner: Spawner) -> ! {
|
||||
//});
|
||||
|
||||
// Init network stack
|
||||
let stack = &*singleton!(Stack::new(device, config, singleton!(StackResources::<2>::new()), seed));
|
||||
let stack = &*make_static!(Stack::new(
|
||||
device,
|
||||
config,
|
||||
make_static!(StackResources::<2>::new()),
|
||||
seed
|
||||
));
|
||||
|
||||
// Launch network task
|
||||
unwrap!(spawner.spawn(net_task(&stack)));
|
||||
|
@ -16,18 +16,8 @@ use embassy_time::{Duration, Timer};
|
||||
use embedded_io::asynch::Write;
|
||||
use embedded_nal_async::{Ipv4Addr, SocketAddr, SocketAddrV4, TcpConnect};
|
||||
use rand_core::RngCore;
|
||||
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();
|
||||
let (x,) = STATIC_CELL.init(($val,));
|
||||
x
|
||||
}};
|
||||
}
|
||||
|
||||
bind_interrupts!(struct Irqs {
|
||||
ETH => eth::InterruptHandler;
|
||||
});
|
||||
@ -57,7 +47,7 @@ async fn main(spawner: Spawner) -> ! {
|
||||
let mac_addr = [0x00, 0x00, 0xDE, 0xAD, 0xBE, 0xEF];
|
||||
|
||||
let device = Ethernet::new(
|
||||
singleton!(PacketQueue::<16, 16>::new()),
|
||||
make_static!(PacketQueue::<16, 16>::new()),
|
||||
p.ETH,
|
||||
Irqs,
|
||||
p.PA1,
|
||||
@ -82,7 +72,12 @@ async fn main(spawner: Spawner) -> ! {
|
||||
//});
|
||||
|
||||
// Init network stack
|
||||
let stack = &*singleton!(Stack::new(device, config, singleton!(StackResources::<2>::new()), seed));
|
||||
let stack = &*make_static!(Stack::new(
|
||||
device,
|
||||
config,
|
||||
make_static!(StackResources::<2>::new()),
|
||||
seed
|
||||
));
|
||||
|
||||
// Launch network task
|
||||
unwrap!(spawner.spawn(net_task(&stack)));
|
||||
|
Reference in New Issue
Block a user