File tree Expand file tree Collapse file tree
examples/espressif/esp/src
port/espressif/esp/src/hal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ const SERVER_PORT = 3333;
5252
5353var maybe_netif : ? * lwip.c.netif = null ;
5454
55- var ip_ready_semaphore : rtos.Semaphore = .init ( 0 , 1 ) ;
55+ var ip_ready_signal : rtos .Signal ( void ) = .{} ;
5656var ip : lwip.c.ip_addr_t = undefined ;
5757
5858extern fn netconn_new_with_proto_and_callback (t : lwip.c.enum_netconn_type , proto : lwip.c.u8_t , callback : ? * const anyopaque ) [* c ]lwip .c .struct_netconn ;
@@ -103,9 +103,10 @@ pub fn main() !void {
103103 }
104104
105105 try radio .wifi .connect_blocking ();
106+
106107 try lwip .c_err (lwip .c .netifapi_netif_common (& netif , lwip .c .netif_set_link_up , null ));
107108
108- ip_ready_semaphore . take ();
109+ ip_ready_signal . wait ();
109110 std .log .info ("Listening on {f}:{}" , .{ IP_Formatter .init (netif .ip_addr ), SERVER_PORT });
110111
111112 const server_conn = netconn_new_with_proto_and_callback (lwip .c .NETCONN_TCP , 0 , null ) orelse {
@@ -201,7 +202,7 @@ fn netif_status_callback(netif_ptr: [*c]lwip.c.netif) callconv(.c) void {
201202 const netif = & netif_ptr [0 ];
202203 if (netif .ip_addr .u_addr .ip4 .addr != 0 ) {
203204 ip = netif .ip_addr ;
204- ip_ready_semaphore . give ( );
205+ ip_ready_signal . put ({} );
205206 }
206207}
207208
You can’t perform that action at this time.
0 commit comments