SCoop - multitask and Simple COOPerative scheduler AVR & ARM

SCoop V1.2 is out and brings lot of goodies :slight_smile:

SCoop V1 brougth the idea of easy cooperative scheduler by extensively using OOP and by providing a (hopefully) comprehensive user guide.
Several objects class like SCoopTask SCoopTimer SCoopEvent and SCoopFifo brings good support for serious but simple multitasking. With the 3 other complementary libraries (IOFilter, TimerUp&Down) this brings a set of features that makes Arduino experience even simpler

V1.2 is very much faster and brings performance close to what we get with very basic scheduler like the "Android" one provided with arduino 1.51 for Arduino DUE, but with much more features!

the yield() routine has been optimized and is now providing a mechanism to switch to next task without coming back to the main scheduler routine which saves lot of CPU time. the result is 15us total switching time on AVR and an amazing 3.2uS on Teensy 3.0 !
lets be fair, the Android version (included in SCoop pack) is still 40% faster but it does nothing else than swiching :slight_smile:

The concept of delaying yield() by several micros seconds called "quantum time" is still in place and makes a huge difference with traditional cooperative scheduler as this brings the benefit of some CPU resource allocations to tasks, and some predictability in the cycle length, like we have with preemptive RTOS. The micros() routine have been optimized for Arduino UNO (by reusing some tips from the Teensy core) and this brings a very good 2.5us lead time to call yield() (AVR) and to check if it is time to switch or not to the nex task, so only <20% of a standard yield() which enable calling yield() everytime everywhere then.

New methods have been introduced to pause/resume timer, events or task, and to monitor their "state"

A new SCoopDelay object is introduced to rationalize timeout handling inside the library and it can be used in the main sketch (sort of simpler TimerDown)

last but not least, the SCoop pack is now provided with a copy of the standard Android Scheduler, ported for the AVR, and then compatible with both ARM or AVR platform and arduino < 1.5 (tested on 1.0.3) !
Then you have the choice : test and adopt the SCoop suite or quickly include the android scheduler.h and play multitask imediately also on AVR.

for mor details on the changes, please review the change log file as few but some important changes are NOT backward compatible with V1.1.1 including the basic defineTimer macro ...

every thing on GooGle code here:
https://code.google.com/p/arduino-scoop-cooperative-scheduler-arm-avr/

thanks for supporting us and providing your input or feedbacks

edit : change log in attachement
edit: all source code now on github : GitHub - fabriceo/SCoop at v1.2

scoop change log.txt (8.26 KB)