We are currently studying how to program AVR microcontrollers (Ansi C89 only). Part of the drivers included is the heading that is planning, i.e. launches tasks at different speeds. My question is related to a quote from the documentation:
"Each task must maintain its own state using static local variables."
What does this really mean? They seem to be passing void*
functions to maintain state, but then not using it?
Looking at the code in the file I am compiling, this is what they mean:
{.func = led_flash_task, .period = TASK_RATE / LED_TASK_RATE, .data = 0}
There is a function that works with the above parameters in the array, however it only acts as a scheduler. Then the function led_flash_task
is equal to
static void led_flash_task (__unused__ void *data) { static uint8_t state = 0; led_set (LED1, state); state = !state; }
And from the title
#define __unused__ __attribute__ ((unused))
And is the void *data
transition designed to maintain the state of the task? What is meant by this?
thanks for the help
source share