From 52614b429467b6a300849ca6cc3b798fe36deeba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Ziegler?= Date: Thu, 2 Apr 2020 15:16:41 +0200 Subject: [PATCH 1/5] Update .gitignore Ignoring S340 SD specific license-bound files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 6a29bac3..89ce25bd 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,6 @@ # Ignore local overrides of platform.txt and boards.txt, /boards.local.txt /platform.local.txt +bootloader/feather_nrf52840_express/feather_nrf52840_express_bootloader-0.3.0_s340_6.1.1.hex +bootloader/feather_nrf52840_express/feather_nrf52840_express_bootloader-0.3.0_s340_6.1.1.zip +cores/nRF5/nordic/softdevice/s340_nrf52_6.1.1_API/* From 51925d20faee32dc43241ceeca3852583bba3bcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Ziegler?= Date: Thu, 7 May 2020 10:04:02 +0200 Subject: [PATCH 2/5] making bluefruit multiprotocol friendly --- libraries/Bluefruit52Lib/src/bluefruit.cpp | 11 +++++++++++ libraries/Bluefruit52Lib/src/bluefruit.h | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/libraries/Bluefruit52Lib/src/bluefruit.cpp b/libraries/Bluefruit52Lib/src/bluefruit.cpp index 363ab68d..707e86e1 100644 --- a/libraries/Bluefruit52Lib/src/bluefruit.cpp +++ b/libraries/Bluefruit52Lib/src/bluefruit.cpp @@ -162,6 +162,7 @@ AdafruitBluefruit::AdafruitBluefruit(void) _ble_event_sem = NULL; _soc_event_sem = NULL; + _mprot_event_sem = NULL; _led_blink_th = NULL; _led_conn = true; @@ -310,7 +311,15 @@ bool AdafruitBluefruit::begin(uint8_t prph_count, uint8_t central_count) #error Clock Source is not configured, define USE_LFXO or USE_LFRC according to your board in variant.h #endif + /*------------------------------------------------------------------*/ + /* BLE only Softdevices have 2-args sd_softdevice_enable() + /* BLE & ANT+ Softdevices have 3-args sd_softdevice_enable() + /*------------------------------------------------------------------*/ +#ifdef ANT_LICENSE_KEY + VERIFY_STATUS( sd_softdevice_enable(&clock_cfg, nrf_error_cb, ANT_LICENSE_KEY), false ); +#else //#ifdef ANT_LICENSE_KEY VERIFY_STATUS( sd_softdevice_enable(&clock_cfg, nrf_error_cb), false ); +#endif //#ifdef ANT_LICENSE_KEY #ifdef USE_TINYUSB usb_softdevice_post_enable(); @@ -676,6 +685,8 @@ void SD_EVT_IRQHandler(void) // Notify both BLE & SOC Task xSemaphoreGiveFromISR(Bluefruit._soc_event_sem, NULL); xSemaphoreGiveFromISR(Bluefruit._ble_event_sem, NULL); + // Notify parallel multiprotocol Task, if any + if (Bluefruit._mprot_event_sem!=NULL) xSemaphoreGiveFromISR(*Bluefruit._mprot_event_sem, NULL); } /** diff --git a/libraries/Bluefruit52Lib/src/bluefruit.h b/libraries/Bluefruit52Lib/src/bluefruit.h index 521dea5c..14a800cd 100644 --- a/libraries/Bluefruit52Lib/src/bluefruit.h +++ b/libraries/Bluefruit52Lib/src/bluefruit.h @@ -178,6 +178,15 @@ class AdafruitBluefruit BLEConnection* Connection(uint16_t conn_hdl); + /*------------------------------------------------------------------* + * Optional semaphore for additional event handlers for SD event. + * It can be used for handling non-BLE SD events + *------------------------------------------------------------------*/ + void setMultiprotocolSemaphore(SemaphoreHandle_t* p_mprot_event_semaphore) + { + _mprot_event_sem= p_mprot_event_semaphore; + } + /*------------------------------------------------------------------*/ /* Callbacks *------------------------------------------------------------------*/ @@ -222,6 +231,8 @@ class AdafruitBluefruit SemaphoreHandle_t _ble_event_sem; SemaphoreHandle_t _soc_event_sem; + SemaphoreHandle_t* _mprot_event_sem; + TimerHandle_t _led_blink_th; bool _led_conn; From 7d80eabeedc8fdc86219dc9fc0f796c0027f1faf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Ziegler?= Date: Sun, 10 May 2020 20:04:36 +0200 Subject: [PATCH 3/5] fixing warning: '/*' within comment [-Wcomment] --- libraries/Bluefruit52Lib/src/bluefruit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/Bluefruit52Lib/src/bluefruit.cpp b/libraries/Bluefruit52Lib/src/bluefruit.cpp index 707e86e1..6a3c177f 100644 --- a/libraries/Bluefruit52Lib/src/bluefruit.cpp +++ b/libraries/Bluefruit52Lib/src/bluefruit.cpp @@ -312,8 +312,8 @@ bool AdafruitBluefruit::begin(uint8_t prph_count, uint8_t central_count) #endif /*------------------------------------------------------------------*/ - /* BLE only Softdevices have 2-args sd_softdevice_enable() - /* BLE & ANT+ Softdevices have 3-args sd_softdevice_enable() + // BLE only Softdevices have 2-args sd_softdevice_enable() + // BLE & ANT+ Softdevices have 3-args sd_softdevice_enable() /*------------------------------------------------------------------*/ #ifdef ANT_LICENSE_KEY VERIFY_STATUS( sd_softdevice_enable(&clock_cfg, nrf_error_cb, ANT_LICENSE_KEY), false ); From b5475ca2632a4c0197a6755ac8ac7940b25ff036 Mon Sep 17 00:00:00 2001 From: orrmany Date: Fri, 5 Jun 2020 18:31:42 +0200 Subject: [PATCH 4/5] Update .gitignore --- .gitignore | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitignore b/.gitignore index 89ce25bd..6a29bac3 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,3 @@ # Ignore local overrides of platform.txt and boards.txt, /boards.local.txt /platform.local.txt -bootloader/feather_nrf52840_express/feather_nrf52840_express_bootloader-0.3.0_s340_6.1.1.hex -bootloader/feather_nrf52840_express/feather_nrf52840_express_bootloader-0.3.0_s340_6.1.1.zip -cores/nRF5/nordic/softdevice/s340_nrf52_6.1.1_API/* From ff12326ecf6bafa2584286a67e5372593f2fb1e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Ziegler?= Date: Mon, 15 Jun 2020 11:45:46 +0200 Subject: [PATCH 5/5] Adding compile guards --- libraries/Bluefruit52Lib/src/bluefruit.cpp | 18 +++++++++++------- libraries/Bluefruit52Lib/src/bluefruit.h | 8 +++++++- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/libraries/Bluefruit52Lib/src/bluefruit.cpp b/libraries/Bluefruit52Lib/src/bluefruit.cpp index 6a3c177f..4850a725 100644 --- a/libraries/Bluefruit52Lib/src/bluefruit.cpp +++ b/libraries/Bluefruit52Lib/src/bluefruit.cpp @@ -162,7 +162,9 @@ AdafruitBluefruit::AdafruitBluefruit(void) _ble_event_sem = NULL; _soc_event_sem = NULL; - _mprot_event_sem = NULL; +#ifdef ANT_LICENSE_KEY + _mprot_event_sem = NULL; //additiona semaphore for multiprotocol +#endif _led_blink_th = NULL; _led_conn = true; @@ -311,11 +313,11 @@ bool AdafruitBluefruit::begin(uint8_t prph_count, uint8_t central_count) #error Clock Source is not configured, define USE_LFXO or USE_LFRC according to your board in variant.h #endif - /*------------------------------------------------------------------*/ - // BLE only Softdevices have 2-args sd_softdevice_enable() - // BLE & ANT+ Softdevices have 3-args sd_softdevice_enable() - /*------------------------------------------------------------------*/ -#ifdef ANT_LICENSE_KEY + /*------------------------------------------------------------------ + ** BLE only Softdevices have 2-args sd_softdevice_enable() + ** BLE & ANT+ Softdevices have 3-args sd_softdevice_enable() + */ + #ifdef ANT_LICENSE_KEY VERIFY_STATUS( sd_softdevice_enable(&clock_cfg, nrf_error_cb, ANT_LICENSE_KEY), false ); #else //#ifdef ANT_LICENSE_KEY VERIFY_STATUS( sd_softdevice_enable(&clock_cfg, nrf_error_cb), false ); @@ -685,8 +687,10 @@ void SD_EVT_IRQHandler(void) // Notify both BLE & SOC Task xSemaphoreGiveFromISR(Bluefruit._soc_event_sem, NULL); xSemaphoreGiveFromISR(Bluefruit._ble_event_sem, NULL); +#ifdef ANT_LICENSE_KEY // Notify parallel multiprotocol Task, if any - if (Bluefruit._mprot_event_sem!=NULL) xSemaphoreGiveFromISR(*Bluefruit._mprot_event_sem, NULL); + if (Bluefruit._mprot_event_sem) xSemaphoreGiveFromISR(Bluefruit._mprot_event_sem, NULL); +#endif } /** diff --git a/libraries/Bluefruit52Lib/src/bluefruit.h b/libraries/Bluefruit52Lib/src/bluefruit.h index 14a800cd..f4a4a318 100644 --- a/libraries/Bluefruit52Lib/src/bluefruit.h +++ b/libraries/Bluefruit52Lib/src/bluefruit.h @@ -178,6 +178,7 @@ class AdafruitBluefruit BLEConnection* Connection(uint16_t conn_hdl); +#ifdef ANT_LICENSE_KEY /*------------------------------------------------------------------* * Optional semaphore for additional event handlers for SD event. * It can be used for handling non-BLE SD events @@ -186,6 +187,7 @@ class AdafruitBluefruit { _mprot_event_sem= p_mprot_event_semaphore; } +#endif /*------------------------------------------------------------------*/ /* Callbacks @@ -231,8 +233,12 @@ class AdafruitBluefruit SemaphoreHandle_t _ble_event_sem; SemaphoreHandle_t _soc_event_sem; +#ifdef ANT_LICENSE_KEY + /* Optional semaphore for additional event handlers for SD event. + * It can be used for handling non-BLE SD events + */ SemaphoreHandle_t* _mprot_event_sem; - +#endif TimerHandle_t _led_blink_th; bool _led_conn;