TaskScheduler
vTaskStartScheduler(); //<<<This FreeRTOS call is not required as the scheduler is already started before app_main() call
Create New xTask
Tasks should never return (i.e. be a continuous loop).
xTaskCreate(
[pointer to the function which will execute when the task is scheduled to run],
[descriptive name for the the task, up to 16 chars, mainly used to facilitate debugging],
[number of 16bit variables the stack can hold for the task (if the stack is 16 bits wide), e.g. 100 = 200 bytes allocated],
[Pointer that will be used as the parameter for the task being created, or "NULL"],
[priority at which the task should run, e.g. "5"],
[pass back a handle by which the created task can be referenced, or "NULL"])
Examples
xTaskCreate(i2c_test_task, "i2c_test_task_0", 1024 * 2, (void* ) 0, 10, NULL);
Exit A Task
Tasks must not attempt to return from their implementing function or otherwise exit.
If it is necessary for a task to exit then have the task call vTaskDelete( NULL ) to ensure its exit is clean.
void vATaskFunction( void *pvParameters )
{
for( ;; )
{
//Task application code here
}
vTaskDelete( NULL );
}
