chipKIT® Development Platform

Inspired by Arduino™

Last edit: 2021-03-21 22:34 by Majenko

StartTaskAt

  1. Synopsis

  2. Parameter

  3. Description

  4. Return Value

  5. Conforming To

  6. Example

  7. See Also

Synopsis

 void startTaskAt(int id, unsigned long start, unsigned short state) 

Parameter

id : Task identifier for the task to be run
start : System millisecond tick time at which to run the task
state : Enable state for the task

Description

This function will schedule the specified task to begin execution at the time specified by start. The time is given as the value of the system millisecond tick counter (as returned by the millis() function) at which the task will be run. The values for the enable state parameter, state, are the same as specified for createTask(). Specifying TASK_DISABLE is allowed, but not useful as it simply leaves the task disabled, and thus will not execute at the specified time. State can have the following values:

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.

Return Value

None.

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);
   startTaskAt( blink_id, 10000, TASK_RUN_ONCE);
 }

See Also

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