Skip to content

Commit bbc2baa

Browse files
fabik111pennam
authored andcommitted
fix ble end on mbed portenta boards for successfully ble restart
1 parent 9712cb1 commit bbc2baa

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Diff for: src/utility/HCICordioTransport.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
#include "CordioHCICustomDriver.h"
5656

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

5960
namespace BLE_NAMESPACE {
6061
struct CordioHCIHook {
@@ -236,6 +237,13 @@ void HCICordioTransportClass::end()
236237
delete bleLoopThread;
237238
bleLoopThread = NULL;
238239
}
240+
// Reset the callback with the mbed-os default handler to properly handle the following CYW43xxx chip initializations and begins
241+
CordioHCIHook::setDataReceivedHandler(hciTrSerialRxIncoming);
242+
243+
#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)
244+
BLE &ble = BLE::Instance();
245+
ble.shutdown();
246+
#endif
239247

240248
#if !defined(TARGET_STM32H7)
241249
CordioHCIHook::getDriver().terminate();

0 commit comments

Comments
 (0)