This files provide a simple fixed priority preemptive multithreading for ATMEGAs from Atmel or Micrchip, respectively. It is based on the publication "RIOS: A Lightweight Task Scheduler for Embedded Systems" by Bailey Miller et al. (https://www.ics.uci.edu/~givargis/pubs/C50.pdf). The properties of this solution are:
- Periodically call of functions (this ist not a RTOS)
- Small footprint in usage of FLASH and especially RAM usage because it uses only one stack for all threads.
- The functions must programmed as "run to completition", i.e. they must return if they have to wait for anything. The usage of state-machines in this case is recommended.
- The usual endless loop becomes a idle loop, which is executed if no thread has to be processed. This makes it a good place for a sleep command.
- The macro F_CPU must be set to the frequency of the device