The friendly Operating System for the Internet of Things
Arduino in RIOT. More...
This module enables users to run unmodified Arduino sketches in RIOT. For this we aim at supporting the full Arduino API.
The support of the Arduino API in RIOT is useful for multiple reasons:
Refer to Arduino API for the actual API documentation
To run your Arduino sketch in RIOT, just follow these steps:
arduinomodule to your application, your
Makefileshould now look something like this:
*.sketchto be processed.
make term, etc.
Thats all. As bonus you can of course use any existing RIOT code inside your Arduino sketches - you simply have to add the includes to your sketch and the corresponding modules to your
*.sketchto be recognized by RIOT's build system
For enabling RIOT to run Arduino sketches, we extended the build system to handle
*.sketch files and we implemented the Arduino API using RIOT's native functions.
Building Arduino sketches in RIOT is done in a two step process.
This script creates a temporary file called '_sketches.cpp' inside the application folder. Into this file, the script copies some Arduino glue code ( pre.snip and post.snip) together with the contents of all
*.sketch files contained in the application folder.
Second, the RIOT make system is called as usual, processing the temporary file containing all the Arduino code. Simple :-)
For supporting the Arduino API, we have created our own function and class definitions, using the exact same signatures as in the original Arduino header files. These headers are then implemented using standard RIOT APIs, e.g. the peripheral drivers,
To add Arduino support to a board, it has to provide the following:
ARDUINO_LEDthat is mapped to an Arduino pin number connected to any on-board LED, or to pin 0 in case no LED is defined:
In addition, you have to add the 'arduino' feature to the board. For this, just add
FEATURES_PROVIDED += arduino to the 'other features' section in your board's `Makefile.features'.
That's it, your board can now run Ardunio sketches.
Make it possible to bootstrap Arduino code manually from any RIOT application. Include a pseudomule as e.g. arduino_base, which does not implement a main function calling
loop(), so these functions have to be called manually from a RIOT application.
Implement analog outputs (PWM mapping)
Implement analog inputs (ADC mapping)
Implement SPI interface class
Add support for the 'Wire Library' (I2C)
Add means to include various Arduino Libraries (maybe as pkg?)
Implement anything else that is missing...
Adapt Arduino build script, so sketches do not have to have the file ending
|Implementation of the Arduino API in RIOT. |