chipKIT32 / chipKIT-core

Downloadable chipKIT core for use with Arduino 1.6 - 1.8+ IDE, PlatformIO, and UECIDE
http://chipkit.net/
Apache License 2.0
59 stars 53 forks source link

Implement Arduino Scheduler wrapers #428

Open JacobChrist opened 6 years ago

JacobChrist commented 6 years ago

Arduino has a scheduler that is simplistic (yet easy to learn and easy to teach) task scheduler that could be easily be implemented as a wrapper around the chipKIT-core task manager. The two functions:

startLoop() yield()

Suggested wrappers: uint32_t dummy_task_var; startLoop(taskFunc task) { createTask(task, 0, TASK_ENABLE, &dummy_task_var); } yield() { delay(0); }

What I'm unsure of is that the chipKIT tasks pass parameters to the task callback. The Arduino tasks to not take parameters. This may require making a new taskFuncArduino type to support this parameter-less callback.

typedef void (*taskFuncArduino)();

If this is done then the task manager would need to detect the pointer type.

https://www.arduino.cc/en/Reference/Scheduler