Skip to content

Commit a1c3cc0

Browse files
committed
clean up
1 parent 00d1b32 commit a1c3cc0

File tree

3 files changed

+12
-42
lines changed

3 files changed

+12
-42
lines changed

cores/nRF5/debug.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ static const char* _gatts_evt_str[] =
213213

214214
const char* dbg_ble_event_str(uint16_t evt_id)
215215
{
216+
static char unknown_evt[7] = {0};
217+
216218
if ( is_within(BLE_EVT_BASE, evt_id, BLE_EVT_LAST) )
217219
return _base_evt_str[evt_id-BLE_EVT_BASE];
218220
else if ( is_within(BLE_GAP_EVT_BASE, evt_id, BLE_GAP_EVT_LAST) )
@@ -222,7 +224,10 @@ const char* dbg_ble_event_str(uint16_t evt_id)
222224
else if ( is_within(BLE_GATTS_EVT_BASE, evt_id, BLE_GATTS_EVT_LAST) )
223225
return _gatts_evt_str[evt_id-BLE_GATTS_EVT_BASE];
224226
else
225-
return NULL;
227+
{
228+
sprintf(unknown_evt, "0x04X", evt_id);
229+
return unknown_evt;
230+
}
226231
}
227232

228233
#endif

libraries/Bluefruit52Lib/src/BLECentral.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ class BLECentral
7878

7979
bool connected(void);
8080

81+
/*------------------------------------------------------------------*/
82+
/* GATTC Discovery
83+
*------------------------------------------------------------------*/
84+
85+
8186
typedef void (*connect_callback_t) (void);
8287
typedef void (*disconnect_callback_t) (uint8_t reason);
8388

libraries/Bluefruit52Lib/src/bluefruit.cpp

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -168,19 +168,6 @@ err_t AdafruitBluefruit::begin(bool prph_enable, bool central_enable)
168168

169169
VERIFY_STATUS( sd_ble_enable(&params, &app_ram_base) );
170170

171-
#if 0
172-
// Configure Radio inactive interrupt to use with hardtime-critical function
173-
// such as Neopixel show()
174-
s_radio_inactive_sem = xSemaphoreCreateBinary();
175-
VERIFY(s_radio_inactive_sem, NRF_ERROR_NO_MEM);
176-
177-
NVIC_ClearPendingIRQ(RADIO_NOTIFICATION_IRQn);
178-
NVIC_SetPriority(SD_EVT_IRQn, 7);
179-
// NVIC_EnableIRQ(RADIO_NOTIFICATION_IRQn);
180-
181-
VERIFY_STATUS( sd_radio_notification_cfg_set(NRF_RADIO_NOTIFICATION_TYPE_INT_ON_INACTIVE, 0) );
182-
#endif
183-
184171
/*------------- Configure GAP -------------*/
185172

186173
// Peripheral Preferred Connection Parameters
@@ -392,30 +379,6 @@ void AdafruitBluefruit::stopConnLed(void)
392379
/*------------------------------------------------------------------*/
393380
/* Thread & SoftDevice Event handler
394381
*------------------------------------------------------------------*/
395-
#if 0
396-
void RADIO_NOTIFICATION_IRQHandler(void)
397-
{
398-
// PRINT_LOCATION();
399-
xSemaphoreGiveFromISR(s_radio_inactive_sem, NULL);
400-
}
401-
402-
void waitForRadioInactive(void)
403-
{
404-
// bool radio_inactive = xSemaphoreTake(s_radio_inactive_sem, 0);
405-
// PRINT_INT(radio_inactive);
406-
407-
// NVIC_ClearPendingIRQ(RADIO_NOTIFICATION_IRQn);
408-
// NVIC_EnableIRQ(RADIO_NOTIFICATION_IRQn);
409-
410-
// // wait forever
411-
// delay(100);
412-
// radio_inactive = xSemaphoreTake(s_radio_inactive_sem, 0);
413-
//
414-
// PRINT_INT(radio_inactive);
415-
// NVIC_DisableIRQ(RADIO_NOTIFICATION_IRQn);
416-
}
417-
#endif
418-
419382
void SD_EVT_IRQHandler(void)
420383
{
421384
// Notify both BLE & SOC Task
@@ -492,10 +455,7 @@ void AdafruitBluefruit::_ble_handler(void)
492455
if( ERROR_NONE == err)
493456
{
494457
#if CFG_DEBUG
495-
Serial.print("[BLE]: ");
496-
if ( dbg_ble_event_str(evt->header.evt_id) ) Serial.print(dbg_ble_event_str(evt->header.evt_id));
497-
else Serial.printf("0x04X", evt->header.evt_id);
498-
Serial.println();
458+
Serial.printf("[BLE]: %s\n", dbg_ble_event_str(evt->header.evt_id));
499459
#endif
500460

501461
switch ( evt->header.evt_id )

0 commit comments

Comments
 (0)