Comments about btstack_run_loop_execute (#388)
Co-authored-by: Graham Sanderson <graham.sanderson@raspberrypi.com>
This commit is contained in:
@@ -272,6 +272,20 @@ int main() {
|
||||
// turn on!
|
||||
hci_power_control(HCI_POWER_ON);
|
||||
|
||||
// btstack_run_loop_execute is only required when using the 'polling' method (e.g. using pico_cyw43_arch_poll library).
|
||||
// This example uses the 'threadsafe background` method, where BT work is handled in a low priority IRQ, so it
|
||||
// is fine to call bt_stack_run_loop_execute() but equally you can continue executing user code.
|
||||
|
||||
#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)
|
||||
btstack_run_loop_execute();
|
||||
#else
|
||||
// this core is free to do it's own stuff except when using 'polling' method (in which case you should use
|
||||
// btstacK_run_loop_ methods to add work to the run loop.
|
||||
|
||||
// this is a forever loop in place of where user code would go.
|
||||
while(true) {
|
||||
sleep_ms(1000);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,21 @@ int main() {
|
||||
|
||||
// turn on bluetooth!
|
||||
hci_power_control(HCI_POWER_ON);
|
||||
|
||||
// btstack_run_loop_execute is only required when using the 'polling' method (e.g. using pico_cyw43_arch_poll library).
|
||||
// This example uses the 'threadsafe background` method, where BT work is handled in a low priority IRQ, so it
|
||||
// is fine to call bt_stack_run_loop_execute() but equally you can continue executing user code.
|
||||
|
||||
#if 0 // btstack_run_loop_execute() is not required, so lets not use it
|
||||
btstack_run_loop_execute();
|
||||
#else
|
||||
// this core is free to do it's own stuff except when using 'polling' method (in which case you should use
|
||||
// btstacK_run_loop_ methods to add work to the run loop.
|
||||
|
||||
// this is a forever loop in place of where user code would go.
|
||||
while(true) {
|
||||
sleep_ms(1000);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ int main() {
|
||||
// register for ATT event
|
||||
att_server_register_packet_handler(packet_handler);
|
||||
|
||||
// set one-shot btstack timer
|
||||
// use an async worker for for the led
|
||||
async_context_add_at_time_worker_in_ms(cyw43_arch_async_context(), &heartbeat_worker, HEARTBEAT_PERIOD_MS);
|
||||
|
||||
// Connect to Wi-Fi
|
||||
|
||||
Reference in New Issue
Block a user