===== Tasks ===== * Tasks are implemented as functions with infinite loops. * Optional data can be passed to the function through the pdata pointer. .. code-block:: c void task(void *pdata) { while(1) { // Do work } } Task Stack ========== * Each task requires a stack to be allocated before the task is created. * Allocations can be static or dynamic. * Static global .. code-block:: c static OS_STK TaskOneStack[size]; * Dynamic * Using malloc. * On another tasks stack if small and short lived. Task States =========== .. image:: Task_States.png