The Drogon Real-time Operating System (Simplified)
Firstly, DROSS is not really an operating system – the title makes it sound a lot grander than it really is…
However… I wrote it for a commercial project running on an ATmega processor to satisfy a need to get away from the existing “big loop” type of programming style that people were doing on the Arduino, and I then later ported it to a PIC project I was working on. I only maintain the ATmega version though.
DROSS is a set of library routines available under a commercial use license.
DROSS and the supporting libraries are written entirely in C. There is no C++ code, nor any C++ support for DROSS.
The DROSS library includes:
- A “wiring” library. The usual pinMode(), digitalRead(), digitalWrite(), etc. functions.
- A task scheduler. Tasks can be called at regular intervals from 1 millisecond upwards. Tasks are expected to run in under 1mS although one (just one!) event can over-run and will subsequently be preempted. The intention was that these tasks are able read/write hardware sensors, freeing up the main program (which is preemptivly interrupted by the tasks) to carry out its main task.
- Date/Time functions.
- I2C and SPI functions
- GPIO extender functions – e.g. digitalWrite() to a pin on an mcp23017.
- LCD Library (the usual character LCD devices).
The tasks can be called at regular intervals, or they can self-schedule and say when they next want to be called.
Additionally, there is a system of co-routines too – this was developed for the PIC to overcome some of the limitations of SDCC not being able to handle re-entrant floating point code.
- A replacement for the Arduino Wiring library
Written in C and some changes to make it more compatible for running in the DROSS environment. In particular one of the PWM channels is no-longer available due to DROSS itself needing one of the timers setup in a slightly different manner to the way the Arduino system does it.
- Serial handling
Simplified but fully capable serial library utilising interrupts to send and receive data.
- Interrupt driven analog port handling
The analog ports can be sampled via an interrupt driven task with the data being fed through a simple with low-pass filter.
- 2-wire (I2C) driver code
A simplified interrrupt driven 2-wire/i2c driver for the ATmega – the driver runs the bus in master mode only.