-->
Page 1 of 1

system_os_task() undfined

PostPosted: Sat Mar 26, 2016 3:58 am
by Johanan
Trying to compile a test program which uses system_os_task(), I get a linker error that it is undefined. other os_ functions work well (like os_timer_setfn() etc.).
declaration of system_os_task() is in user_interface.h, which is included in the source.

What am I missing ( using Arduino IDE)

Thanks,
Johanan

Re: system_os_task() undfined

PostPosted: Sat Mar 26, 2016 6:07 pm
by majorb
Without seeing your code, I'm guessing that you're not feeding it the right parameters .Does the function you're trying to register with system_os_task take an os_event_t * as a parameter?
system_os_task takes, in order:
-function(os_event_t *)
-an integer representing Task Priority
-an array of os_event_t representing a queue of tasks
-The length of the queue of tasks

Sample code:

#define TASK_PRIORITY 2
#define QUEUE_LENGTH 10

os_event_t queue[QUEUE_LENGTH];

void task_to_register(os_event_t *event)
{
//code, etc
}

void user_init()
{
//...
system_os_task(task_to_register, TASK_PRIORITY, queue, QUEUE_LENGTH);
//...
}