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] 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;