Simplify construction of StackResources::new()

This commit is contained in:
Martin Liska 2024-08-08 10:53:55 +02:00
parent 891c5ee105
commit 961ec387ed
5 changed files with 5 additions and 15 deletions

View File

@ -67,12 +67,7 @@ async fn main(spawner: Spawner) {
// Init network stack
static STACK: StaticCell<Stack<MyDriver>> = StaticCell::new();
static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new();
let stack = &*STACK.init(Stack::new(
device,
config,
RESOURCES.init(StackResources::<2>::new()),
seed,
));
let stack = &*STACK.init(Stack::new(device, config, RESOURCES.init(StackResources::new()), seed));
unwrap!(spawner.spawn(net_task(stack)));

View File

@ -91,7 +91,7 @@ async fn main(spawner: Spawner) {
let stack = &*STACK.init(Stack::new(
device,
Config::dhcpv4(Default::default()),
RESOURCES.init(StackResources::<2>::new()),
RESOURCES.init(StackResources::new()),
seed,
));

View File

@ -74,7 +74,7 @@ async fn main(spawner: Spawner) {
let stack = &*STACK.init(Stack::new(
net_device,
Config::dhcpv4(Default::default()),
RESOURCES.init(StackResources::<2>::new()),
RESOURCES.init(StackResources::new()),
seed,
));

View File

@ -72,7 +72,7 @@ async fn main(spawner: Spawner) {
let stack = &*STACK.init(Stack::new(
device,
embassy_net::Config::dhcpv4(Default::default()),
RESOURCES.init(StackResources::<2>::new()),
RESOURCES.init(StackResources::new()),
seed,
));

View File

@ -101,12 +101,7 @@ async fn main(spawner: Spawner) {
// Init network stack
static STACK: StaticCell<Stack<Device>> = StaticCell::new();
static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new();
let stack = &*STACK.init(Stack::new(
device,
config,
RESOURCES.init(StackResources::<2>::new()),
seed,
));
let stack = &*STACK.init(Stack::new(device, config, RESOURCES.init(StackResources::new()), seed));
// Launch network task
unwrap!(spawner.spawn(net_task(&stack)));