Skip to content

Commit 840501e

Browse files
authored
Merge pull request arduino-libraries#139 from Polldo/mbed_callback_error
Adapt library to mbed-os 6.4.0
2 parents 4abb537 + 63ffef4 commit 840501e

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

src/utility/HCICordioTransport.cpp

+24-22
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919

2020
#if defined(ARDUINO_ARCH_MBED)
2121

22-
#include <driver/CordioHCITransportDriver.h>
23-
#include <driver/CordioHCIDriver.h>
24-
2522
#include <Arduino.h>
2623
#include <mbed.h>
2724

25+
#include <driver/CordioHCITransportDriver.h>
26+
#include <driver/CordioHCIDriver.h>
27+
2828
#if defined(ARDUINO_PORTENTA_H7_M4) || defined(ARDUINO_PORTENTA_H7_M7)
2929
#include "ble/BLE.h"
3030
#include <events/mbed_events.h>
@@ -47,35 +47,37 @@
4747

4848
#include "HCICordioTransport.h"
4949

50-
extern ble::vendor::cordio::CordioHCIDriver& ble_cordio_get_hci_driver();
50+
#if (MBED_VERSION > MBED_ENCODE_VERSION(6, 2, 0))
51+
#define BLE_NAMESPACE ble
52+
#else
53+
#define BLE_NAMESPACE ble::vendor::cordio
54+
#endif
55+
56+
extern BLE_NAMESPACE::CordioHCIDriver& ble_cordio_get_hci_driver();
5157

52-
namespace ble {
53-
namespace vendor {
54-
namespace cordio {
55-
struct CordioHCIHook {
56-
static CordioHCIDriver& getDriver() {
57-
return ble_cordio_get_hci_driver();
58-
}
58+
namespace BLE_NAMESPACE {
59+
struct CordioHCIHook {
60+
static CordioHCIDriver& getDriver() {
61+
return ble_cordio_get_hci_driver();
62+
}
5963

60-
static CordioHCITransportDriver& getTransportDriver() {
61-
return getDriver()._transport_driver;
62-
}
64+
static CordioHCITransportDriver& getTransportDriver() {
65+
return getDriver()._transport_driver;
66+
}
6367

64-
static void setDataReceivedHandler(void (*handler)(uint8_t*, uint8_t)) {
65-
getTransportDriver().set_data_received_handler(handler);
66-
}
67-
};
68+
static void setDataReceivedHandler(void (*handler)(uint8_t*, uint8_t)) {
69+
getTransportDriver().set_data_received_handler(handler);
6870
}
69-
}
71+
};
7072
}
7173

72-
using ble::vendor::cordio::CordioHCIHook;
74+
using BLE_NAMESPACE::CordioHCIHook;
7375

7476
#if CORDIO_ZERO_COPY_HCI
7577
extern uint8_t *SystemHeapStart;
7678
extern uint32_t SystemHeapSize;
7779

78-
void init_wsf(ble::vendor::cordio::buf_pool_desc_t& buf_pool_desc) {
80+
void init_wsf(BLE_NAMESPACE::buf_pool_desc_t& buf_pool_desc) {
7981
static bool init = false;
8082

8183
if (init) {
@@ -195,7 +197,7 @@ int HCICordioTransportClass::begin()
195197
_rxBuf.clear();
196198

197199
#if CORDIO_ZERO_COPY_HCI
198-
ble::vendor::cordio::buf_pool_desc_t bufPoolDesc = CordioHCIHook::getDriver().get_buffer_pool_description();
200+
BLE_NAMESPACE::buf_pool_desc_t bufPoolDesc = CordioHCIHook::getDriver().get_buffer_pool_description();
199201
init_wsf(bufPoolDesc);
200202
#endif
201203

0 commit comments

Comments
 (0)