aboutsummaryrefslogtreecommitdiff
path: root/examples/std/src/bin/net_ppp.rs
diff options
context:
space:
mode:
authorFrostie314159 <[email protected]>2024-03-31 20:48:05 +0200
committerGitHub <[email protected]>2024-03-31 20:48:05 +0200
commit67c9cc2c4b886e6962ecdd6eff8794b14c1accdc (patch)
treef176ab269949d26f48e04c950cebc5489bae8c56 /examples/std/src/bin/net_ppp.rs
parenta2f9aa592ec61beb247065003016515f0d423c13 (diff)
parent6634cc90bcd3eb25b64712688920f383584b2964 (diff)
Merge branch 'embassy-rs:main' into ticker_send_sync
Diffstat (limited to 'examples/std/src/bin/net_ppp.rs')
-rw-r--r--examples/std/src/bin/net_ppp.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/examples/std/src/bin/net_ppp.rs b/examples/std/src/bin/net_ppp.rs
index cee04e558..9ec0ea91f 100644
--- a/examples/std/src/bin/net_ppp.rs
+++ b/examples/std/src/bin/net_ppp.rs
@@ -7,7 +7,6 @@
7//! ping 192.168.7.10 7//! ping 192.168.7.10
8//! nc 192.168.7.10 1234 8//! nc 192.168.7.10 1234
9 9
10#![feature(type_alias_impl_trait)]
11#![allow(async_fn_in_trait)] 10#![allow(async_fn_in_trait)]
12 11
13#[path = "../serial_port.rs"] 12#[path = "../serial_port.rs"]
@@ -25,7 +24,7 @@ use heapless::Vec;
25use log::*; 24use log::*;
26use nix::sys::termios; 25use nix::sys::termios;
27use rand_core::{OsRng, RngCore}; 26use rand_core::{OsRng, RngCore};
28use static_cell::{make_static, StaticCell}; 27use static_cell::StaticCell;
29 28
30use crate::serial_port::SerialPort; 29use crate::serial_port::SerialPort;
31 30
@@ -88,7 +87,8 @@ async fn main_task(spawner: Spawner) {
88 let port = SerialPort::new(opts.device.as_str(), baudrate).unwrap(); 87 let port = SerialPort::new(opts.device.as_str(), baudrate).unwrap();
89 88
90 // Init network device 89 // Init network device
91 let state = make_static!(embassy_net_ppp::State::<4, 4>::new()); 90 static STATE: StaticCell<embassy_net_ppp::State<4, 4>> = StaticCell::new();
91 let state = STATE.init(embassy_net_ppp::State::<4, 4>::new());
92 let (device, runner) = embassy_net_ppp::new(state); 92 let (device, runner) = embassy_net_ppp::new(state);
93 93
94 // Generate random seed 94 // Generate random seed
@@ -97,11 +97,13 @@ async fn main_task(spawner: Spawner) {
97 let seed = u64::from_le_bytes(seed); 97 let seed = u64::from_le_bytes(seed);
98 98
99 // Init network stack 99 // Init network stack
100 let stack = &*make_static!(Stack::new( 100 static STACK: StaticCell<Stack<embassy_net_ppp::Device<'static>>> = StaticCell::new();
101 static RESOURCES: StaticCell<StackResources<3>> = StaticCell::new();
102 let stack = &*STACK.init(Stack::new(
101 device, 103 device,
102 Config::default(), // don't configure IP yet 104 Config::default(), // don't configure IP yet
103 make_static!(StackResources::<3>::new()), 105 RESOURCES.init(StackResources::<3>::new()),
104 seed 106 seed,
105 )); 107 ));
106 108
107 // Launch network task 109 // Launch network task