Skip to content

Commit ff12326

Browse files
committed
Adding compile guards
1 parent b5475ca commit ff12326

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

libraries/Bluefruit52Lib/src/bluefruit.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ AdafruitBluefruit::AdafruitBluefruit(void)
162162

163163
_ble_event_sem = NULL;
164164
_soc_event_sem = NULL;
165-
_mprot_event_sem = NULL;
165+
#ifdef ANT_LICENSE_KEY
166+
_mprot_event_sem = NULL; //additiona semaphore for multiprotocol
167+
#endif
166168

167169
_led_blink_th = NULL;
168170
_led_conn = true;
@@ -311,11 +313,11 @@ bool AdafruitBluefruit::begin(uint8_t prph_count, uint8_t central_count)
311313
#error Clock Source is not configured, define USE_LFXO or USE_LFRC according to your board in variant.h
312314
#endif
313315

314-
/*------------------------------------------------------------------*/
315-
// BLE only Softdevices have 2-args sd_softdevice_enable()
316-
// BLE & ANT+ Softdevices have 3-args sd_softdevice_enable()
317-
/*------------------------------------------------------------------*/
318-
#ifdef ANT_LICENSE_KEY
316+
/*------------------------------------------------------------------
317+
** BLE only Softdevices have 2-args sd_softdevice_enable()
318+
** BLE & ANT+ Softdevices have 3-args sd_softdevice_enable()
319+
*/
320+
#ifdef ANT_LICENSE_KEY
319321
VERIFY_STATUS( sd_softdevice_enable(&clock_cfg, nrf_error_cb, ANT_LICENSE_KEY), false );
320322
#else //#ifdef ANT_LICENSE_KEY
321323
VERIFY_STATUS( sd_softdevice_enable(&clock_cfg, nrf_error_cb), false );
@@ -685,8 +687,10 @@ void SD_EVT_IRQHandler(void)
685687
// Notify both BLE & SOC Task
686688
xSemaphoreGiveFromISR(Bluefruit._soc_event_sem, NULL);
687689
xSemaphoreGiveFromISR(Bluefruit._ble_event_sem, NULL);
690+
#ifdef ANT_LICENSE_KEY
688691
// Notify parallel multiprotocol Task, if any
689-
if (Bluefruit._mprot_event_sem!=NULL) xSemaphoreGiveFromISR(*Bluefruit._mprot_event_sem, NULL);
692+
if (Bluefruit._mprot_event_sem) xSemaphoreGiveFromISR(Bluefruit._mprot_event_sem, NULL);
693+
#endif
690694
}
691695

692696
/**

libraries/Bluefruit52Lib/src/bluefruit.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ class AdafruitBluefruit
178178

179179
BLEConnection* Connection(uint16_t conn_hdl);
180180

181+
#ifdef ANT_LICENSE_KEY
181182
/*------------------------------------------------------------------*
182183
* Optional semaphore for additional event handlers for SD event.
183184
* It can be used for handling non-BLE SD events
@@ -186,6 +187,7 @@ class AdafruitBluefruit
186187
{
187188
_mprot_event_sem= p_mprot_event_semaphore;
188189
}
190+
#endif
189191

190192
/*------------------------------------------------------------------*/
191193
/* Callbacks
@@ -231,8 +233,12 @@ class AdafruitBluefruit
231233

232234
SemaphoreHandle_t _ble_event_sem;
233235
SemaphoreHandle_t _soc_event_sem;
236+
#ifdef ANT_LICENSE_KEY
237+
/* Optional semaphore for additional event handlers for SD event.
238+
* It can be used for handling non-BLE SD events
239+
*/
234240
SemaphoreHandle_t* _mprot_event_sem;
235-
241+
#endif
236242

237243
TimerHandle_t _led_blink_th;
238244
bool _led_conn;

0 commit comments

Comments
 (0)