Home

Awesome

a_coos

rev 1.6

Very simple COoperative Operating System for Arduino based on the standard setjmp library.

Kernel uses about 1K bytes. Highly portable, it has no assembler code and it is independent from hardware. System ticks 1 ms based on millis(). Should run on any Arduino board. Tested with the following boards:

Coos made as C++ template. Library consists of a single file coos.h.

Warnings:

Usage

Place coos.h file into the same folder where the sketch is. In the sketch include coos.h as:

#include "coos.h"

Alternatively, it can be used as an Arduino library. Once installed, there is no need to copy coos.h file into every project any more. To install it as library, locate your Arduino libraries folder. Typically it is:

C:\Users\user\Documents\Arduino\libraries\

Add folder coos:

C:\Users\user\Documents\Arduino\libraries\coos\

Copy files coos.h, library.properties, keywords.txt and folder examples there. In your sketch include coos library as:

#include <coos.h>

Required number of coos tasks and coos tick should be declared in your sketch as follows:

Coos <6, 0> coos; // number 6 in the angle brackets specifies number of user tasks; 0 selects 1 ms tick

Instance name coos must be used, otherwise macro COOS_DELAY(x) cannot operate correctly.

When 1 ms tick selected

Coos <6, 0> coos; 

60,000 ticks in 60 sec:

== COOS demo ==
tick 1 ms average
............................................................ uptime = 60 sec 
............................................................ uptime = 120 sec 
............................................................ uptime = 180 sec 
............................................................ uptime = 240 sec 
............................................................ uptime = 300 sec 

When 1.024 ms tick selected

Coos <6, 1> coos; 

60,000 ticks in aprrox 61 sec:

== COOS demo ==
tick 1.024 ms
............................................................ uptime = 61 sec 
............................................................ uptime = 122 sec 
............................................................ uptime = 184 sec 
............................................................ uptime = 245 sec 
............................................................ uptime = 307 sec