Skip to content

Commit eab5631

Browse files
committed
fix ble end on mbed portenta boards for successfully ble restart
1 parent 30e2cac commit eab5631

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Diff for: src/utility/HCICordioTransport.cpp

+8-1
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,12 @@ void HCICordioTransportClass::end()
236237
delete bleLoopThread;
237238
bleLoopThread = NULL;
238239
}
240+
CordioHCIHook::setDataReceivedHandler(hciTrSerialRxIncoming);
241+
242+
#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)
243+
BLE &ble = BLE::Instance();
244+
ble.shutdown();
245+
#endif
239246

240247
#if !defined(TARGET_STM32H7)
241248
CordioHCIHook::getDriver().terminate();
@@ -290,7 +297,7 @@ size_t HCICordioTransportClass::write(const uint8_t* data, size_t length)
290297
}
291298

292299
void HCICordioTransportClass::handleRxData(uint8_t* data, uint8_t len)
293-
{
300+
{
294301
if (_rxBuf.availableForStore() < len) {
295302
// drop!
296303
return;

0 commit comments

Comments
 (0)