Hi,
I created an operating system for arduino which provides real multithreading, locks, exceptions, hardware abstaction and much more and wanted to share it.
You can find a more detailed description on github.
Feel free to use it and have fun with it :).
I appricate any feedback and suggestions for future releases.
Example:
#include <KernelInitializer.h>
#include <Led.h>
lock *serialLock = GetLockObject();
void setup()
{
Serial.begin(9600);
KernelInitializer::InitializeKernel(mainThread);
}
void mainThread()
{
InitTask(secondThread);
InitTaskWithStackSize(wastingCpuThread, STACK_SIZE_TINY);
while (true)
{
try
{
throw(EXCEPTION_ILLEGAL_ARGUMENT_NULL);
}
catch
{
Serial.println("There was an Exception!");
Serial.print("Error code: ");
Serial.println(GetException());
ReleaseLock(serialLock);
}
clearException();
sleep(1000);
}
}
void secondThread()
{
Led led(5); // Led on pin 5
while (true)
{
led.TurnOn();
AquireLock(serialLock);
Serial.println("Spam!");
ReleaseLock(serialLock);
sleep(1000);
led.TurnOff();
}
}
void wastingCpuThread()
{
while (true)
{
// Nothing
}
}