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 );
}

 

UK Electronic Designer
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.