Skip to content

Crashes after calling btstack_cyw43_deinit #2446

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 1 commit into from
May 1, 2025
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
8 changes: 8 additions & 0 deletions src/rp2_common/pico_btstack/btstack_run_loop_async_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,14 @@ const btstack_run_loop_t *btstack_run_loop_async_context_get_instance(async_cont
return &btstack_run_loop_async_context;
}

void btstack_run_loop_async_context_deinit(void) {
if (btstack_async_context) {
async_context_remove_at_time_worker(btstack_async_context, &btstack_timeout_worker);
async_context_remove_when_pending_worker(btstack_async_context, &btstack_processing_worker);
btstack_async_context = NULL;
}
}

static void btstack_timeout_reached(__unused async_context_t *context, __unused async_at_time_worker_t *worker) {
// simply wakeup worker
async_context_set_work_pending(btstack_async_context, &btstack_processing_worker);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ extern "C" {
*/
const btstack_run_loop_t *btstack_run_loop_async_context_get_instance(async_context_t *context);

/**
* \brief Deinitialize the BTstack state to stop it using the async_context API
* \ingroup pico_btstack
*/
void btstack_run_loop_async_context_deinit(void);

#ifdef __cplusplus
}
#endif
Expand Down
1 change: 1 addition & 0 deletions src/rp2_common/pico_cyw43_driver/btstack_cyw43.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ bool btstack_cyw43_init(async_context_t *context) {
void btstack_cyw43_deinit(__unused async_context_t *context) {
hci_power_control(HCI_POWER_OFF);
hci_close();
btstack_run_loop_async_context_deinit();
btstack_run_loop_deinit();
btstack_memory_deinit();
}
Loading