aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJuliDi <[email protected]>2023-09-08 17:40:20 +0200
committerJuliDi <[email protected]>2023-09-08 17:40:20 +0200
commitcf2d4eca7c3a3f53aa57a7d9a53de490962019cf (patch)
tree9a3ef5efef0fd0a5719f229a45bf7f8cfdb0bbb4 /examples
parent3e0b752befd492229bfb4c6f9fd3213cfd69a0fc (diff)
add wait_config_up to examples
Diffstat (limited to 'examples')
-rw-r--r--examples/stm32f4/src/bin/eth.rs5
-rw-r--r--examples/stm32f7/src/bin/eth.rs5
-rw-r--r--examples/stm32h5/src/bin/eth.rs3
-rw-r--r--examples/stm32h7/src/bin/eth.rs3
-rw-r--r--examples/stm32h7/src/bin/eth_client.rs8
5 files changed, 18 insertions, 6 deletions
diff --git a/examples/stm32f4/src/bin/eth.rs b/examples/stm32f4/src/bin/eth.rs
index 393e60b73..5f1e62d0a 100644
--- a/examples/stm32f4/src/bin/eth.rs
+++ b/examples/stm32f4/src/bin/eth.rs
@@ -79,7 +79,10 @@ async fn main(spawner: Spawner) -> ! {
79 )); 79 ));
80 80
81 // Launch network task 81 // Launch network task
82 unwrap!(spawner.spawn(net_task(&stack))); 82 unwrap!(spawner.spawn(net_task(stack)));
83
84 // Ensure DHCP configuration is up before trying connect
85 stack.wait_config_up().await;
83 86
84 info!("Network task initialized"); 87 info!("Network task initialized");
85 88
diff --git a/examples/stm32f7/src/bin/eth.rs b/examples/stm32f7/src/bin/eth.rs
index f0e280c35..01c38106e 100644
--- a/examples/stm32f7/src/bin/eth.rs
+++ b/examples/stm32f7/src/bin/eth.rs
@@ -80,7 +80,10 @@ async fn main(spawner: Spawner) -> ! {
80 )); 80 ));
81 81
82 // Launch network task 82 // Launch network task
83 unwrap!(spawner.spawn(net_task(&stack))); 83 unwrap!(spawner.spawn(net_task(stack)));
84
85 // Ensure DHCP configuration is up before trying connect
86 stack.wait_config_up().await;
84 87
85 info!("Network task initialized"); 88 info!("Network task initialized");
86 89
diff --git a/examples/stm32h5/src/bin/eth.rs b/examples/stm32h5/src/bin/eth.rs
index 763520ab8..c32e0fdb5 100644
--- a/examples/stm32h5/src/bin/eth.rs
+++ b/examples/stm32h5/src/bin/eth.rs
@@ -101,6 +101,9 @@ async fn main(spawner: Spawner) -> ! {
101 // Launch network task 101 // Launch network task
102 unwrap!(spawner.spawn(net_task(&stack))); 102 unwrap!(spawner.spawn(net_task(&stack)));
103 103
104 // Ensure DHCP configuration is up before trying connect
105 stack.wait_config_up().await;
106
104 info!("Network task initialized"); 107 info!("Network task initialized");
105 108
106 // Then we can use it! 109 // Then we can use it!
diff --git a/examples/stm32h7/src/bin/eth.rs b/examples/stm32h7/src/bin/eth.rs
index 26a386e49..e691c6d06 100644
--- a/examples/stm32h7/src/bin/eth.rs
+++ b/examples/stm32h7/src/bin/eth.rs
@@ -83,6 +83,9 @@ async fn main(spawner: Spawner) -> ! {
83 // Launch network task 83 // Launch network task
84 unwrap!(spawner.spawn(net_task(&stack))); 84 unwrap!(spawner.spawn(net_task(&stack)));
85 85
86 // Ensure DHCP configuration is up before trying connect
87 stack.wait_config_up().await;
88
86 info!("Network task initialized"); 89 info!("Network task initialized");
87 90
88 // Then we can use it! 91 // Then we can use it!
diff --git a/examples/stm32h7/src/bin/eth_client.rs b/examples/stm32h7/src/bin/eth_client.rs
index 6664410c8..ebef54c3c 100644
--- a/examples/stm32h7/src/bin/eth_client.rs
+++ b/examples/stm32h7/src/bin/eth_client.rs
@@ -82,12 +82,12 @@ async fn main(spawner: Spawner) -> ! {
82 )); 82 ));
83 83
84 // Launch network task 84 // Launch network task
85 unwrap!(spawner.spawn(net_task(&stack))); 85 unwrap!(spawner.spawn(net_task(stack)));
86 86
87 info!("Network task initialized"); 87 // Ensure DHCP configuration is up before trying connect
88 stack.wait_config_up().await;
88 89
89 // To ensure DHCP configuration before trying connect 90 info!("Network task initialized");
90 Timer::after(Duration::from_secs(20)).await;
91 91
92 static STATE: TcpClientState<1, 1024, 1024> = TcpClientState::new(); 92 static STATE: TcpClientState<1, 1024, 1024> = TcpClientState::new();
93 let client = TcpClient::new(&stack, &STATE); 93 let client = TcpClient::new(&stack, &STATE);