58
58
#define BOND_FILENAME CFG_BOND_NFFS_DIR " /%04x"
59
59
#define BOND_FILENAME_LEN (sizeof (CFG_BOND_NFFS_DIR) + 10 )
60
60
61
+ AdafruitBluefruit Bluefruit;
62
+
63
+ /* ------------------------------------------------------------------*/
64
+ /* PROTOTYPTES
65
+ *------------------------------------------------------------------*/
61
66
extern " C"
62
67
{
63
68
void hal_flash_event_cb (uint32_t event) ATTR_WEAK;
@@ -66,10 +71,9 @@ extern "C"
66
71
void adafruit_ble_task (void * arg);
67
72
void adafruit_soc_task (void * arg);
68
73
69
- AdafruitBluefruit Bluefruit;
70
74
71
75
/* ------------------------------------------------------------------*/
72
- /* IMPLEMENTATION
76
+ /* INTERNAL FUNCTION
73
77
*------------------------------------------------------------------*/
74
78
static void bluefruit_blinky_cb ( TimerHandle_t xTimer )
75
79
{
@@ -164,6 +168,19 @@ err_t AdafruitBluefruit::begin(bool prph_enable, bool central_enable)
164
168
165
169
VERIFY_STATUS ( sd_ble_enable (¶ms, &app_ram_base) );
166
170
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
+
167
184
/* ------------- Configure GAP -------------*/
168
185
169
186
// Peripheral Preferred Connection Parameters
@@ -201,6 +218,7 @@ err_t AdafruitBluefruit::begin(bool prph_enable, bool central_enable)
201
218
TaskHandle_t soc_task_hdl;
202
219
xTaskCreate ( adafruit_soc_task, " SD SOC" , CFG_SOC_TASK_STACKSIZE, NULL , TASK_PRIO_HIGH, &soc_task_hdl);
203
220
221
+ NVIC_SetPriority (SD_EVT_IRQn, 6 );
204
222
NVIC_EnableIRQ (SD_EVT_IRQn);
205
223
206
224
// Create Timer for led advertising blinky
@@ -374,6 +392,30 @@ void AdafruitBluefruit::stopConnLed(void)
374
392
/* ------------------------------------------------------------------*/
375
393
/* Thread & SoftDevice Event handler
376
394
*------------------------------------------------------------------*/
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
+
377
419
void SD_EVT_IRQHandler (void )
378
420
{
379
421
// Notify both BLE & SOC Task
0 commit comments