@@ -51,7 +51,7 @@ fn main() -> Result<(), Error> {
51
51
thread. join ( ) . unwrap ( )
52
52
}
53
53
54
- // NOTE: For no_std, name this entry point according to your MCU platform
54
+ // NOTE (no_std) : For no_std, name this entry point according to your MCU platform
55
55
#[ cfg( not( feature = "std" ) ) ]
56
56
#[ no_mangle]
57
57
fn app_main ( ) {
@@ -100,11 +100,11 @@ fn run() -> Result<(), Error> {
100
100
#[ cfg( feature = "std" ) ]
101
101
let rand = matter:: utils:: rand:: sys_rand;
102
102
103
- // NOTE: For no_std, provide your own function here
103
+ // NOTE (no_std) : For no_std, provide your own function here
104
104
#[ cfg( not( feature = "std" ) ) ]
105
105
let epoch = matter:: utils:: epoch:: dummy_epoch;
106
106
107
- // NOTE: For no_std, provide your own function here
107
+ // NOTE (no_std) : For no_std, provide your own function here
108
108
#[ cfg( not( feature = "std" ) ) ]
109
109
let rand = matter:: utils:: rand:: dummy_rand;
110
110
@@ -175,6 +175,8 @@ fn run() -> Result<(), Error> {
175
175
let tx_buf = & mut tx_buf;
176
176
177
177
let mut io_fut = pin ! ( async move {
178
+ // NOTE (no_std): On no_std, the `UdpListener` implementation is a no-op so you might want to
179
+ // replace it with your own UDP stack
178
180
let udp = UdpListener :: new( SocketAddr :: new(
179
181
IpAddr :: V6 ( Ipv6Addr :: UNSPECIFIED ) ,
180
182
matter:: MATTER_PORT ,
@@ -216,17 +218,21 @@ fn run() -> Result<(), Error> {
216
218
Ok :: <_, matter:: error:: Error >( ( ) )
217
219
} ) ;
218
220
221
+ // NOTE (no_std): On no_std, the `run_udp` is a no-op so you might want to replace it with `run` and
222
+ // connect the pipes of the `run` method with your own UDP stack
219
223
let mut mdns_fut = pin ! ( async move { mdns_runner. run_udp( ) . await } ) ;
220
224
221
225
let mut fut = pin ! ( async move { select( & mut io_fut, & mut mdns_fut) . await . unwrap( ) } ) ;
222
226
223
- info ! ( "Final future: {:p}" , & mut fut) ;
224
-
225
- // NOTE: For no_std, replace with your own no_std way of polling the future
226
227
#[ cfg( feature = "std" ) ]
227
228
smol:: block_on ( & mut fut) ?;
228
229
229
- Ok :: < _ , matter:: error:: Error > ( ( ) )
230
+ // NOTE (no_std): For no_std, replace with your own more efficient no_std executor,
231
+ // because the executor used below is a simple busy-loop poller
232
+ #[ cfg( not( feature = "std" ) ) ]
233
+ embassy_futures:: block_on ( & mut fut) ?;
234
+
235
+ Ok ( ( ) )
230
236
}
231
237
232
238
fn handler < ' a > ( matter : & ' a Matter < ' a > ) -> impl Handler + ' a {
@@ -243,12 +249,12 @@ fn handler<'a>(matter: &'a Matter<'a>) -> impl Handler + 'a {
243
249
)
244
250
}
245
251
246
- // NOTE: For no_std, implement here your own way of initializing the logger
252
+ // NOTE (no_std) : For no_std, implement here your own way of initializing the logger
247
253
#[ cfg( all( not( feature = "std" ) , not( target_os = "espidf" ) ) ) ]
248
254
#[ inline( never) ]
249
255
fn initialize_logger ( ) { }
250
256
251
- // NOTE: For no_std, implement here your own way of initializing the network
257
+ // NOTE (no_std) : For no_std, implement here your own way of initializing the network
252
258
#[ cfg( all( not( feature = "std" ) , not( target_os = "espidf" ) ) ) ]
253
259
#[ inline( never) ]
254
260
fn initialize_network ( ) -> Result < ( Ipv4Addr , Ipv6Addr , u32 ) , Error > {
0 commit comments