Merge pull request #3238 from marxin/simplify-StackResources-new

Simplify construction of StackResources::new()
This commit is contained in:
Dario Nieuwenhuis 2024-08-08 10:48:57 +00:00 committed by GitHub
commit f31e718331
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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)));