Commit fe96f8b0 authored by schneider's avatar schneider Committed by Tobias Schneider
Browse files

fix(ble): Use a reserved interrupt to dispatch FreeRTOS functions

parent 1bb2b9f0
...@@ -161,12 +161,17 @@ void WsfTimerNotify(void) ...@@ -161,12 +161,17 @@ void WsfTimerNotify(void)
//printf("WsfTimerNotify\n"); //printf("WsfTimerNotify\n");
// TODO: Can we do this without waking up the task? // TODO: Can we do this without waking up the task?
// xTimerChangePeriodFromISR exists // xTimerChangePeriodFromISR exists
notify(); NVIC->STIR = RSV11_IRQn;
} }
/*************************************************************************************************/ /*************************************************************************************************/
void wsf_ble_signal_event(void) void wsf_ble_signal_event(void)
{ {
//printf("wsf_ble_signal_event\n"); //printf("wsf_ble_signal_event\n");
NVIC->STIR = RSV11_IRQn;
}
/*************************************************************************************************/
void RSV11_IRQHandler(void)
{
notify(); notify();
} }
/*************************************************************************************************/ /*************************************************************************************************/
...@@ -243,6 +248,12 @@ void vBleTask(void *pvParameters) ...@@ -243,6 +248,12 @@ void vBleTask(void *pvParameters)
*/ */
vTaskDelay(pdMS_TO_TICKS(500)); vTaskDelay(pdMS_TO_TICKS(500));
/* We are going to execute FreeRTOS functions from callbacks
* coming from this interrupt. Its priority needs to be
* reduced to allow this. */
NVIC_SetPriority(RSV11_IRQn, 2);
NVIC_EnableIRQ(RSV11_IRQn);
WsfInit(); WsfInit();
taskENTER_CRITICAL(); taskENTER_CRITICAL();
/* Critical section to prevent a loop in iq_capture2 / meas_freq in /* Critical section to prevent a loop in iq_capture2 / meas_freq in
...@@ -253,12 +264,6 @@ void vBleTask(void *pvParameters) ...@@ -253,12 +264,6 @@ void vBleTask(void *pvParameters)
BbBleDrvSetTxPower(0); BbBleDrvSetTxPower(0);
setAddress(); setAddress();
/* We are going to execute FreeRTOS functions from callbacks
* coming from these interrupts. Their priority needs to be
* reduced to allow this. */
NVIC_SetPriority(BTLE_SFD_TO_IRQn, 2);
NVIC_SetPriority(BTLE_TX_DONE_IRQn, 2);
NVIC_SetPriority(BTLE_RX_RCVD_IRQn, 2);
AppInit(); AppInit();
BleStart(); BleStart();
AttsDynInit(); AttsDynInit();
......
...@@ -194,6 +194,9 @@ int hardware_early_init(void) ...@@ -194,6 +194,9 @@ int hardware_early_init(void)
*/ */
max30001_mutex_init(); max30001_mutex_init();
/* Allow user space to trigger interrupts.
* Used for BLE, not sure if needed. */
SCB->CCR |= SCB_CCR_USERSETMPEND_Msk;
return 0; return 0;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment