Skip to content

Add optional argument to onRun #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
morganrallen opened this issue Jul 16, 2017 · 2 comments
Closed

Add optional argument to onRun #27

morganrallen opened this issue Jul 16, 2017 · 2 comments

Comments

@morganrallen
Copy link

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.

@morganrallen morganrallen changed the title Add argument to onRun Add optional argument to onRun Jul 16, 2017
@CAHEK7
Copy link
Contributor

CAHEK7 commented Jul 16, 2017

#7 looks similar

@CAHEK7 CAHEK7 mentioned this issue Aug 2, 2017
@ivanseidel
Copy link
Owner

Keeping this in #7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants