aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorKingCol13 <[email protected]>2023-10-02 20:10:52 +0100
committerKingCol13 <[email protected]>2023-10-02 20:10:52 +0100
commit90ade1b311646f0ed83f3f2264537bccca2258d5 (patch)
tree22b4a61e65b9c4ff46be7399686fc99114de7f41 /examples
parenta931dfd9ad67ef68b47ffa334910e550e84fb35f (diff)
Add wait for DHCP in rp wifi_tcp_server
Diffstat (limited to 'examples')
-rw-r--r--examples/rp/src/bin/wifi_tcp_server.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/examples/rp/src/bin/wifi_tcp_server.rs b/examples/rp/src/bin/wifi_tcp_server.rs
index 20a92b6ed..64cf95171 100644
--- a/examples/rp/src/bin/wifi_tcp_server.rs
+++ b/examples/rp/src/bin/wifi_tcp_server.rs
@@ -18,7 +18,7 @@ use embassy_rp::bind_interrupts;
18use embassy_rp::gpio::{Level, Output}; 18use embassy_rp::gpio::{Level, Output};
19use embassy_rp::peripherals::{DMA_CH0, PIN_23, PIN_25, PIO0}; 19use embassy_rp::peripherals::{DMA_CH0, PIN_23, PIN_25, PIO0};
20use embassy_rp::pio::{InterruptHandler, Pio}; 20use embassy_rp::pio::{InterruptHandler, Pio};
21use embassy_time::Duration; 21use embassy_time::{Duration, Timer};
22use embedded_io_async::Write; 22use embedded_io_async::Write;
23use static_cell::make_static; 23use static_cell::make_static;
24use {defmt_rtt as _, panic_probe as _}; 24use {defmt_rtt as _, panic_probe as _};
@@ -102,6 +102,13 @@ async fn main(spawner: Spawner) {
102 } 102 }
103 } 103 }
104 104
105 // Wait for DHCP, not necessary when using static IP
106 info!("waiting for DHCP...");
107 while !stack.is_config_up() {
108 Timer::after(Duration::from_millis(100)).await;
109 }
110 info!("DHCP is now up!");
111
105 // And now we can use it! 112 // And now we can use it!
106 113
107 let mut rx_buffer = [0; 4096]; 114 let mut rx_buffer = [0; 4096];