Cosa, an Object-Oriented Alternative Framework for AVR Boards
Cosa is an object-oriented framework that provides an interesting alternative to the standard Wiring/Arduino framework. As at today, it supports the AVR-based boards.
Starting release 147, embedXcode+ provides support for the Cosa framework. Let's see how the standard blinky sketch is handled on each framework. |
Cosa seems to be no longer maintained, as the last version 1.20 was released almost three years ago, on 30 January 2016. |
Arduino Sketch |
Cosa Sketch |
The core library Arduino includes all the basic elements.
|
Two libraries are required:
|
The pin is defined by a number.
|
The pin is an OutputPin object, instantiated with the Board::LED.
|
The pin is initialized as output in the setup().
|
As the pin has been already defined, setup() only initializes the main Watchdog.
|
Because Cosa is fully documented, help is automatically provided in Xcode when typing.
|
The main loop() calls the blink() function.
delay() is a function. |
The main loop() calls the blink() function.
delay() is a function of the Watchdog object. |
Everything is managed by functions.
|
pin is an object, with two functions on() and off().
delay() is a function of the Watchdog object. |
Another example of the close integration provided in embedXcode. Here, the list of the functions for the object pin.
|
Conclusion
This quick introduction shows the main difference between the two frameworks: Cosa only uses objects.
embedXcode leverages the excellent documentation of Cosa by providing online help when typing. |
Posted:
Updated: 16 Jan 2019