Skip to content

Commit c90609b

Browse files
committed
clean up
1 parent 3b0088f commit c90609b

File tree

1 file changed

+44
-2
lines changed

1 file changed

+44
-2
lines changed

libraries/Bluefruit52Lib/src/bluefruit.cpp

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@
5858
#define BOND_FILENAME CFG_BOND_NFFS_DIR "/%04x"
5959
#define BOND_FILENAME_LEN (sizeof(CFG_BOND_NFFS_DIR) + 10)
6060

61+
AdafruitBluefruit Bluefruit;
62+
63+
/*------------------------------------------------------------------*/
64+
/* PROTOTYPTES
65+
*------------------------------------------------------------------*/
6166
extern "C"
6267
{
6368
void hal_flash_event_cb(uint32_t event) ATTR_WEAK;
@@ -66,10 +71,9 @@ extern "C"
6671
void adafruit_ble_task(void* arg);
6772
void adafruit_soc_task(void* arg);
6873

69-
AdafruitBluefruit Bluefruit;
7074

7175
/*------------------------------------------------------------------*/
72-
/* IMPLEMENTATION
76+
/* INTERNAL FUNCTION
7377
*------------------------------------------------------------------*/
7478
static void bluefruit_blinky_cb( TimerHandle_t xTimer )
7579
{
@@ -164,6 +168,19 @@ err_t AdafruitBluefruit::begin(bool prph_enable, bool central_enable)
164168

165169
VERIFY_STATUS( sd_ble_enable(&params, &app_ram_base) );
166170

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+
167184
/*------------- Configure GAP -------------*/
168185

169186
// Peripheral Preferred Connection Parameters
@@ -201,6 +218,7 @@ err_t AdafruitBluefruit::begin(bool prph_enable, bool central_enable)
201218
TaskHandle_t soc_task_hdl;
202219
xTaskCreate( adafruit_soc_task, "SD SOC", CFG_SOC_TASK_STACKSIZE, NULL, TASK_PRIO_HIGH, &soc_task_hdl);
203220

221+
NVIC_SetPriority(SD_EVT_IRQn, 6);
204222
NVIC_EnableIRQ(SD_EVT_IRQn);
205223

206224
// Create Timer for led advertising blinky
@@ -374,6 +392,30 @@ void AdafruitBluefruit::stopConnLed(void)
374392
/*------------------------------------------------------------------*/
375393
/* Thread & SoftDevice Event handler
376394
*------------------------------------------------------------------*/
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+
377419
void SD_EVT_IRQHandler(void)
378420
{
379421
// Notify both BLE & SOC Task

0 commit comments

Comments
 (0)