aboutsummaryrefslogtreecommitdiff
path: root/examples/std/src/bin/net_ppp.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/std/src/bin/net_ppp.rs')
-rw-r--r--examples/std/src/bin/net_ppp.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/examples/std/src/bin/net_ppp.rs b/examples/std/src/bin/net_ppp.rs
index cee04e558..8c80c4beb 100644
--- a/examples/std/src/bin/net_ppp.rs
+++ b/examples/std/src/bin/net_ppp.rs
@@ -25,7 +25,7 @@ use heapless::Vec;
25use log::*; 25use log::*;
26use nix::sys::termios; 26use nix::sys::termios;
27use rand_core::{OsRng, RngCore}; 27use rand_core::{OsRng, RngCore};
28use static_cell::{make_static, StaticCell}; 28use static_cell::StaticCell;
29 29
30use crate::serial_port::SerialPort; 30use crate::serial_port::SerialPort;
31 31
@@ -88,7 +88,8 @@ async fn main_task(spawner: Spawner) {
88 let port = SerialPort::new(opts.device.as_str(), baudrate).unwrap(); 88 let port = SerialPort::new(opts.device.as_str(), baudrate).unwrap();
89 89
90 // Init network device 90 // Init network device
91 let state = make_static!(embassy_net_ppp::State::<4, 4>::new()); 91 static STATE: StaticCell<embassy_net_ppp::State<4, 4>> = StaticCell::new();
92 let state = STATE.init(embassy_net_ppp::State::<4, 4>::new());
92 let (device, runner) = embassy_net_ppp::new(state); 93 let (device, runner) = embassy_net_ppp::new(state);
93 94
94 // Generate random seed 95 // Generate random seed
@@ -97,11 +98,13 @@ async fn main_task(spawner: Spawner) {
97 let seed = u64::from_le_bytes(seed); 98 let seed = u64::from_le_bytes(seed);
98 99
99 // Init network stack 100 // Init network stack
100 let stack = &*make_static!(Stack::new( 101 static STACK: StaticCell<Stack<embassy_net_ppp::Device<'static>>> = StaticCell::new();
102 static RESOURCES: StaticCell<StackResources<3>> = StaticCell::new();
103 let stack = &*STACK.init(Stack::new(
101 device, 104 device,
102 Config::default(), // don't configure IP yet 105 Config::default(), // don't configure IP yet
103 make_static!(StackResources::<3>::new()), 106 RESOURCES.init(StackResources::<3>::new()),
104 seed 107 seed,
105 )); 108 ));
106 109
107 // Launch network task 110 // Launch network task