i began with freertos, and read two times the tutorial book, very nicely written and interessting.
i'm not sure about on thingn perhaps my question will be strange for RTOS Guru but i need to understand :
in freertos, all is a task.
But in 'C' language we have function.
in a CORRECT FREERTOS programm, is ALL a TASK or i can declare classical C function and call them from a TASK.
About function i mean a function without infinite loop, just a function who do something then terminate and return 'to the caller' here, a task for example ????
A function that implements a task can't return to its caller, because there is no caller. If you want to end a task you simply call vTaskDelete(NULL) at the end of the function.
But inside the task you can call normal C functions that return without any problems. Example
void vThisIsATask(void *px)
// Normal C functions can be called here.
// Must not exit, but if you leave the while(1) you can delete the task
ok, it's more clear for me,
can i ask you an advice :
in your experience end opinion how can i choose between a C function and a C function that is a task.
i mean what "kind" of code muste be on the one but never to the other ?
A function that returns will never be a "task".
A function that never returns will rarely be anything but a task function.
A task will generally be in a loop, blocking on some resource, and when it get it, does some operation, and then normally go back and waits for the next request from that resource, or sometimes just terminating itself (if it was created as a "one shot" operation)
One the other hand, a function gets called, does something and then returns to the caller.
It is possible to fake something like a function with a task by sending it a request, and then immediately waiting for a reply. But this is generally inefficient.
Normally I create a task for each data stream from somewhere that needs to be processed, plus tasks for any periodic operations that might take some time to execute (quick periodic operations will become timer callbacks, that run as part of the time task).