GetTaskId

From chipKIT
Jump to: navigation, search

Synopsis

 int getTaskId(taskFunc task)

Parameter

task  : Pointer to the task function

Description

This function returns the task identifier of the task associated with the specified task function. It returns -1 if no such task is defined. If multiple tasks are using the same task function, it returns the first one found.

Return Value

If the specified task exists, the task id is returned. If the task can’t be found, the value -1 is returned.

Conforming To

The Task Management Functions are specific to ChipKit and exceed the Arduino 1.6.x specification.

Example

 int blink_id;
 int test_id;
 unsigned long blink_var;
 void blink_task(int id, void * tptr) {
   digitalWrite(led, !digitalRead(led); // Toggle pin state
 }
 void setup() {
   pinMode(led, OUTPUT);
   blink_id = createTask(blink_task, 200, TASK_ENABLE, &blink_var);
   test_id = getTaskId( blink_task);
 }

See Also

createTask(), destroyTask(), getTaskId(), getTaskNextExec(), getTaskPeriod(), getTaskState(), getTaskVar(), setTaskPeriod(), setTaskState(), setTaskVar(), startTaskAt(),