Pages: [1]   Go Down
Author Topic: "Android ARM <Scheduler.h> PORTED on AVR and included in SCoop V1.2  (Read 939 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello

I was playing with the Scheduler.h provided with the Arduino 1.51 library for the Arduino DUE / ARM Board, and I was frustrated not being able to use it on the Arduino UNO or Teensy2 based on AVR platform.

This is now solve  : I have added a task context switching in AVR asm which makes the library now compatible with both platform !

only 2560 (with __AVR_3_BYTE_PC__) s not compatible as I didnt want to break the original code behaviour.

you can download the libray from the SCoop google code project here:
https://code.google.com/p/arduino-scoop-cooperative-scheduler-arm-avr/downloads/list

and start playing with the MultipleBlink example provided.

in term of changes compared to the original version, I have added a Scheduler.delay(), including a call to yield(), to compensate the lack of this in the arduino library <1.5. So you can use this library in arduino 1.0.2/1.03 as long as you replace your delay() by this Scheduler.delay(), otherwise your scheduler will not schedule anything !

2 other macros were added to bring atomic protection and non-rentrance /concurrent protection:
yieldPORTECT() and yieldATOMIC { }

yieldPROTECT() shall just be used at the begining of the function to protect. it will yield() until the function can be reused by another task.

yieldATOMIC { } give the possibility to write a bloc of code (typically containing a delay() ), between bracket. then the global yield() will not be executed for this piece of code.

hope you enjoy it. We shall use this thread to bring support and feedback on it.

I have also included this port in the SCoop V1.2 suite which provides a more serious Cooperative scheduler approach, and fully compatible with this Scheduler.h originally witten by the Android team, so you can make your test and choose the one you prefer.
link on SCoop V1.2 announcement :
http://arduino.cc/forum/index.php?topic=137801.msg1066535#msg1066535

edit : source code has been submited in the 1.5 scheduler branch on arduino github for further review/integration :
https://github.com/fabriceo/Arduino/commit/3087d469660ac26b1bf241c04522fb62fc97feb3
« Last Edit: January 11, 2013, 09:39:03 am by maxidcx » Logged

Pages: [1]   Go Up
Jump to: