Skip to content

Add optional argument to onRun #27

Closed
@morganrallen

Description

@morganrallen

It would be great to be able to add an optional void (*arg) argument to onRun and have that passed to your callback.

(poorly written) example

void shutoff(void (*arg)) {
  uint8_t *pin = (uint8_t*)arg;
  digitalWrite(pin, LOW);
}

void setup() {
  Thread t1 = Thread();
  t1.onRun(shutoff, 1);

  Thread t1 = Thread();
  t1.onRun(shutoff, 2);
}

This will dramatically simplify code by not requiring individual callbacks for each thread that perform the same function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions