Skip to content

Commit

Permalink
fix ble end on mbed portenta boards for successfully ble restart
Browse files Browse the repository at this point in the history
  • Loading branch information
fabik111 committed Nov 25, 2024
1 parent 30e2cac commit 1b1db35
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/utility/HCICordioTransport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#include "CordioHCICustomDriver.h"

extern BLE_NAMESPACE::CordioHCIDriver& ble_cordio_get_hci_driver();
extern "C" void hciTrSerialRxIncoming(uint8_t *pBuf, uint8_t len);

namespace BLE_NAMESPACE {
struct CordioHCIHook {
Expand Down Expand Up @@ -236,6 +237,13 @@ void HCICordioTransportClass::end()
delete bleLoopThread;
bleLoopThread = NULL;
}
// Reset the callback with the mbed-os default handler to properly handle the following CYW43xxx chip initializations and begins
CordioHCIHook::setDataReceivedHandler(hciTrSerialRxIncoming);

#if (defined(ARDUINO_PORTENTA_H7_M4) || defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION) || defined(ARDUINO_GIGA) || defined(ARDUINO_OPTA)) && !defined(CUSTOM_HCI_DRIVER)
BLE &ble = BLE::Instance();
ble.shutdown();
#endif

#if !defined(TARGET_STM32H7)
CordioHCIHook::getDriver().terminate();
Expand Down

0 comments on commit 1b1db35

Please sign in to comment.