From dd0db8cb6049135db68985fc6a635f112f4e71ac Mon Sep 17 00:00:00 2001 From: Paolo Calao Date: Tue, 10 Nov 2020 18:33:49 +0100 Subject: [PATCH 1/4] Move mbed includes after Arduino.h --- src/utility/HCICordioTransport.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utility/HCICordioTransport.cpp b/src/utility/HCICordioTransport.cpp index ab92818b..ce8ba5d5 100644 --- a/src/utility/HCICordioTransport.cpp +++ b/src/utility/HCICordioTransport.cpp @@ -19,12 +19,12 @@ #if defined(ARDUINO_ARCH_MBED) -#include -#include - #include #include +#include +#include + #if defined(ARDUINO_PORTENTA_H7_M4) || defined(ARDUINO_PORTENTA_H7_M7) #include "ble/BLE.h" #include From 947ec7bfff8d27889d73afb5d4c06bcc8da181f7 Mon Sep 17 00:00:00 2001 From: Paolo Calao Date: Tue, 10 Nov 2020 18:44:59 +0100 Subject: [PATCH 2/4] Remove cordio vendor namespace for adapting to mbed-os-6.4.0 --- src/utility/HCICordioTransport.cpp | 36 +++++++++++++----------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/src/utility/HCICordioTransport.cpp b/src/utility/HCICordioTransport.cpp index ce8ba5d5..be0dcf6a 100644 --- a/src/utility/HCICordioTransport.cpp +++ b/src/utility/HCICordioTransport.cpp @@ -47,35 +47,31 @@ #include "HCICordioTransport.h" -extern ble::vendor::cordio::CordioHCIDriver& ble_cordio_get_hci_driver(); +extern ble::CordioHCIDriver& ble_cordio_get_hci_driver(); namespace ble { - namespace vendor { - namespace cordio { - struct CordioHCIHook { - static CordioHCIDriver& getDriver() { - return ble_cordio_get_hci_driver(); - } - - static CordioHCITransportDriver& getTransportDriver() { - return getDriver()._transport_driver; - } - - static void setDataReceivedHandler(void (*handler)(uint8_t*, uint8_t)) { - getTransportDriver().set_data_received_handler(handler); - } - }; + struct CordioHCIHook { + static CordioHCIDriver& getDriver() { + return ble_cordio_get_hci_driver(); } - } + + static CordioHCITransportDriver& getTransportDriver() { + return getDriver()._transport_driver; + } + + static void setDataReceivedHandler(void (*handler)(uint8_t*, uint8_t)) { + getTransportDriver().set_data_received_handler(handler); + } + }; } -using ble::vendor::cordio::CordioHCIHook; +using ble::CordioHCIHook; #if CORDIO_ZERO_COPY_HCI extern uint8_t *SystemHeapStart; extern uint32_t SystemHeapSize; -void init_wsf(ble::vendor::cordio::buf_pool_desc_t& buf_pool_desc) { +void init_wsf(ble::buf_pool_desc_t& buf_pool_desc) { static bool init = false; if (init) { @@ -195,7 +191,7 @@ int HCICordioTransportClass::begin() _rxBuf.clear(); #if CORDIO_ZERO_COPY_HCI - ble::vendor::cordio::buf_pool_desc_t bufPoolDesc = CordioHCIHook::getDriver().get_buffer_pool_description(); + ble::buf_pool_desc_t bufPoolDesc = CordioHCIHook::getDriver().get_buffer_pool_description(); init_wsf(bufPoolDesc); #endif From 70af90971dcde66677da2e195323e5c92f780ede Mon Sep 17 00:00:00 2001 From: Paolo Calao Date: Tue, 10 Nov 2020 18:47:51 +0100 Subject: [PATCH 3/4] Prepare namespace macro for current mbed version Prepare namespace macro for adapting the library to the used mbed version --- src/utility/HCICordioTransport.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/utility/HCICordioTransport.cpp b/src/utility/HCICordioTransport.cpp index be0dcf6a..bbdfae45 100644 --- a/src/utility/HCICordioTransport.cpp +++ b/src/utility/HCICordioTransport.cpp @@ -47,6 +47,12 @@ #include "HCICordioTransport.h" +#if (MBED_VERSION > MBED_ENCODE_VERSION(6, 2, 0)) +#define BLE_NAMESPACE ble +#else +#define BLE_NAMESPACE ble::cordio::vendor +#endif + extern ble::CordioHCIDriver& ble_cordio_get_hci_driver(); namespace ble { From 63ffef4ce546c569eed9c4b90dd6ce9f16988275 Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Wed, 11 Nov 2020 09:23:57 +0100 Subject: [PATCH 4/4] squashme: Adapt to both mbed cores --- src/utility/HCICordioTransport.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/utility/HCICordioTransport.cpp b/src/utility/HCICordioTransport.cpp index bbdfae45..bfb87618 100644 --- a/src/utility/HCICordioTransport.cpp +++ b/src/utility/HCICordioTransport.cpp @@ -50,12 +50,12 @@ #if (MBED_VERSION > MBED_ENCODE_VERSION(6, 2, 0)) #define BLE_NAMESPACE ble #else -#define BLE_NAMESPACE ble::cordio::vendor +#define BLE_NAMESPACE ble::vendor::cordio #endif -extern ble::CordioHCIDriver& ble_cordio_get_hci_driver(); +extern BLE_NAMESPACE::CordioHCIDriver& ble_cordio_get_hci_driver(); -namespace ble { +namespace BLE_NAMESPACE { struct CordioHCIHook { static CordioHCIDriver& getDriver() { return ble_cordio_get_hci_driver(); @@ -71,13 +71,13 @@ namespace ble { }; } -using ble::CordioHCIHook; +using BLE_NAMESPACE::CordioHCIHook; #if CORDIO_ZERO_COPY_HCI extern uint8_t *SystemHeapStart; extern uint32_t SystemHeapSize; -void init_wsf(ble::buf_pool_desc_t& buf_pool_desc) { +void init_wsf(BLE_NAMESPACE::buf_pool_desc_t& buf_pool_desc) { static bool init = false; if (init) { @@ -197,7 +197,7 @@ int HCICordioTransportClass::begin() _rxBuf.clear(); #if CORDIO_ZERO_COPY_HCI - ble::buf_pool_desc_t bufPoolDesc = CordioHCIHook::getDriver().get_buffer_pool_description(); + BLE_NAMESPACE::buf_pool_desc_t bufPoolDesc = CordioHCIHook::getDriver().get_buffer_pool_description(); init_wsf(bufPoolDesc); #endif