Skip to content

Comments about btstack_run_loop_execute #388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions pico_w/bt/standalone/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,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;
}
14 changes: 14 additions & 0 deletions pico_w/bt/standalone/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion pico_w/bt/standalone/server_with_wifi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down