File tree 3 files changed +29
-1
lines changed 3 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -272,6 +272,20 @@ int main() {
272
272
// turn on!
273
273
hci_power_control (HCI_POWER_ON );
274
274
275
+ // btstack_run_loop_execute is only required when using the 'polling' method (e.g. using pico_cyw43_arch_poll library).
276
+ // This example uses the 'threadsafe background` method, where BT work is handled in a low priority IRQ, so it
277
+ // is fine to call bt_stack_run_loop_execute() but equally you can continue executing user code.
278
+
279
+ #if 1 // this is only necessary when using polling (which we aren't, but we're showing it is still safe to call in this case)
275
280
btstack_run_loop_execute ();
281
+ #else
282
+ // this core is free to do it's own stuff except when using 'polling' method (in which case you should use
283
+ // btstacK_run_loop_ methods to add work to the run loop.
284
+
285
+ // this is a forever loop in place of where user code would go.
286
+ while (true) {
287
+ sleep_ms (1000 );
288
+ }
289
+ #endif
276
290
return 0 ;
277
291
}
Original file line number Diff line number Diff line change @@ -73,7 +73,21 @@ int main() {
73
73
74
74
// turn on bluetooth!
75
75
hci_power_control (HCI_POWER_ON );
76
+
77
+ // btstack_run_loop_execute is only required when using the 'polling' method (e.g. using pico_cyw43_arch_poll library).
78
+ // This example uses the 'threadsafe background` method, where BT work is handled in a low priority IRQ, so it
79
+ // is fine to call bt_stack_run_loop_execute() but equally you can continue executing user code.
76
80
81
+ #if 0 // btstack_run_loop_execute() is not required, so lets not use it
77
82
btstack_run_loop_execute ();
83
+ #else
84
+ // this core is free to do it's own stuff except when using 'polling' method (in which case you should use
85
+ // btstacK_run_loop_ methods to add work to the run loop.
86
+
87
+ // this is a forever loop in place of where user code would go.
88
+ while (true) {
89
+ sleep_ms (1000 );
90
+ }
91
+ #endif
78
92
return 0 ;
79
93
}
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ int main() {
85
85
// register for ATT event
86
86
att_server_register_packet_handler (packet_handler );
87
87
88
- // set one-shot btstack timer
88
+ // use an async worker for for the led
89
89
async_context_add_at_time_worker_in_ms (cyw43_arch_async_context (), & heartbeat_worker , HEARTBEAT_PERIOD_MS );
90
90
91
91
// Connect to Wi-Fi
You can’t perform that action at this time.
0 commit comments