Total noob question here, just starting with FreeRTOS
I have set up a Nordic 52832 project based upon the freertos hrs project. And now I’m trying to build my application. One of the things I want to do is when a write comes in, schedule generating a notification. And the key is “schedule” a notification. I don’t want to call the notification code directly from when the write happened, because my fear is that I will be doing “a lot” of work, and therefore I’m tying things up, and thus would violate bluetooth specs.
In a non-FreeRTOS world, I would build a buffer of the data I would want to send in the notification, set some internal flag, and the main loop, as it goes through, would see that flag set and do the work needed. And if it failed (say bluetooth was busy so the notification couldn’t be sent right now), set the flag again for processing through the main loop again.
So, I’m trying to figure out how to do something like this in a FreeRTOS context. My thoughts were “software interrupt” or “task”, or… something. But either because I don’t know the terminology to use, or I’m just overthinking it, I can’t seem to “schedule” what I want to do.
I tried creating a task through xTaskCreate, but that task never seems to execute. Here was that code
xTaskHandle TaskHandle_1;
void MyTask1(void *pvParameters) {
NRF_LOG_INFO ("MyTask1");
bsp_board_led_color(LED_COLOR_RED);
vTaskDelete(TaskHandle_1);
}
void generateResponse() {
NRF_LOG_INFO ("generateResponse");
xTaskCreate( MyTask1, (signed char *) "Task1", configMINIMAL_STACK_SIZE, NULL, 3, &TaskHandle_1);
NRF_LOG_INFO ("ok then");
}
Note that this is all done “after” the code is running, and vTaskScheduler has already been called.
I’m sorry for being so… well, noob-ish on this. I just can’t figure out what to do here.