'start a freeRTOS task with a function
is it safe to create a task with a variable?
TaskHandle_t blablaTaskHandle= NULL;
...
bool startTask = readAVariable();
if(startTask ){
xTaskCreate(&blabla, "blabla", 2048, NULL, 2, &blablaTaskHandle);
}
And also suspend it and resume:
// this is in the main loop
bool suspendTask = true;
if( suspendTask && (blablaTaskHandle!= NULL)){
vTaskSuspend(blablaTaskHandle);
}
else{
vTaskResume(blablaTaskHandle);
}
Solution 1:[1]
You create a task with a function call, not a variable, so I'm not sure what you are asking. From the API documentation, and the hundreds of provided examples, it looks like your use of the first parameter to xTaskCreate() is probably wrong.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Richard |
