net: Make the user pass in the StackResources in init
By having the user pass in the resources, we can make them generic, this way the user can choose the size of the individual resources
This commit is contained in:
@ -19,6 +19,7 @@ use crate::tuntap::TunTapDevice;
|
||||
|
||||
static DEVICE: Forever<TunTapDevice> = Forever::new();
|
||||
static CONFIG: Forever<DhcpConfigurator> = Forever::new();
|
||||
static NET_RESOURCES: Forever<StackResources<1, 2, 8>> = Forever::new();
|
||||
|
||||
#[derive(Clap)]
|
||||
#[clap(version = "1.0")]
|
||||
@ -51,8 +52,10 @@ async fn main_task(spawner: Spawner) {
|
||||
// DHCP configruation
|
||||
let config = DhcpConfigurator::new();
|
||||
|
||||
let net_resources = StackResources::new();
|
||||
|
||||
// Init network stack
|
||||
embassy_net::init(DEVICE.put(device), CONFIG.put(config));
|
||||
embassy_net::init(DEVICE.put(device), CONFIG.put(config), NET_RESOURCES.put(net_resources));
|
||||
|
||||
// Launch network task
|
||||
spawner.spawn(net_task()).unwrap();
|
||||
|
Reference in New Issue
Block a user