diff options
Diffstat (limited to 'examples/std/src/bin/net_ppp.rs')
| -rw-r--r-- | examples/std/src/bin/net_ppp.rs | 14 |
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; | |||
| 25 | use log::*; | 24 | use log::*; |
| 26 | use nix::sys::termios; | 25 | use nix::sys::termios; |
| 27 | use rand_core::{OsRng, RngCore}; | 26 | use rand_core::{OsRng, RngCore}; |
| 28 | use static_cell::{make_static, StaticCell}; | 27 | use static_cell::StaticCell; |
| 29 | 28 | ||
| 30 | use crate::serial_port::SerialPort; | 29 | use 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 |
