unsigned short getTaskState(int id)
task | : | Pointer to the task function |
---|
This function returns the current enable state of the specified task. The task enable states are the same as specified by createTask(). The value TASK_DISABLE is returned for both valid, disabled tasks, and when the task identifier is invalid.
Current task enable state:
TASK_ENABLE | The task is enabled and will be run at the specified intervals. |
---|---|
TASK_DISABLE | The task is disabled and will not be run. |
TASK_RUN_ONCE | The task is enabled to run once and then will become disabled after running. |
Number ‘n’ | The task is enabled to run and will run ‘n’ times. After the ‘n’th execution, the task becomes disabled. |
The Task Management Functions are specific to ChipKit and exceed the Arduino 1.6.x specification.
int blink_id;
short task_state;
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);
task_state = getTaskState( blink_id);
}
createTask(), destroyTask(), getTaskId(), getTaskNextExec(), getTaskPeriod(), getTaskState(), getTaskVar(), setTaskPeriod(), setTaskState(), setTaskVar(), startTaskAt(),