diff --git a/src/hci.c b/src/hci.c index 13ec71d60..af168b599 100644 --- a/src/hci.c +++ b/src/hci.c @@ -3124,6 +3124,16 @@ void hci_init(const hci_transport_t *transport, const void *config){ hci_state_reset(); } +void hci_deinit(void){ +#ifdef HAVE_MALLOC + if (hci_stack) { + free(hci_stack); + } +#endif + hci_stack = NULL; + disable_l2cap_timeouts = 0; +} + /** * @brief Configure Bluetooth chipset driver. Has to be called before power on, or right after receiving the local version information */ diff --git a/src/hci.h b/src/hci.h index 9ce6bae57..bcf4c3f00 100644 --- a/src/hci.h +++ b/src/hci.h @@ -1311,6 +1311,11 @@ uint8_t hci_get_allow_role_switch(void); */ HCI_STATE hci_get_state(void); +/** + * @brief De-Init HCI + */ +void hci_deinit(void); + // setup test connections, used for fuzzing void hci_setup_test_connections_fuzz(void);