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 Oct 29, 2024
1 parent 30e2cac commit eab5631
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion 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,12 @@ void HCICordioTransportClass::end()
delete bleLoopThread;
bleLoopThread = NULL;
}
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 Expand Up @@ -290,7 +297,7 @@ size_t HCICordioTransportClass::write(const uint8_t* data, size_t length)
}

void HCICordioTransportClass::handleRxData(uint8_t* data, uint8_t len)
{
{
if (_rxBuf.availableForStore() < len) {
// drop!
return;
Expand Down

0 comments on commit eab5631

Please sign in to comment.