Introduction
What is hardio?
Hardio is a software framework designed to ease the development and the reuse of software drivers for any type of electronic device that can be used in various robotics fields. It mainly targets embedded applications.
Practically it is a collection of components that fall into the following categories:
- drivers, that implement a specific interface to discuss with a given electronic device or fammily of devices.
- IO board that implement the high level interface for using an electronic board. A board is typically an electronic device that provides IOs that can be used to discuss with other electronic devices.
- Protocols, that implement communication protocols between IO boards and drivers.
The main goals when using hardio are:
- reusing IO Board description (e.g. Raspberry Pi, Linux based laptop PC, etc.) among different software architectures.
- reusing protocols, whether they are user defined, system defined or board specific
- autmatically adapting drivers developped with one IO board to another IO board, thus allowing to easily follow the fast technological innovation in embedded electronics market (new board model, new manufacturer, etc.).
Concepts
Hardiocore
Hardiocore is the base package that is at the center of how hardio works. It defines all basic concepts like IO Board, Protocols, Interfaces and so on. Those concepts need to be specialized to provide new implementations for IO , protocols, etc. Those elements provide communication interfaces (for instance a serial link) used to implement drivers for electronic devices.
IO Boards
IO Board concept specialization is used to define more or less generic electronic board or boards famillies. Each board delares a (possibily configurable) set of IOs (like RS232, USB, ethernet, etc.) that are the base interfaces provided to communicate with devices.
The framework contains packages providing specific implementation for IOBoards familly like hardiopi for Raspberry-Pi cards, or hardioup for Intel Upboard cards.
Each board will have a corresponding IoCard implementation (hardiorpi for raspberry pi, hardioup for upboard, …).
IO Board is also used to represent extension boards that are really common in the embedded systems world. Such extension can represent for instance a hat that can itself provide new IOs to the main board and this later can communicate with the extension board using its own IOs (e.g. USB, I2C, etc.).
Protocols and interfaces
Protocol concept specialization is used to define more or less high level protocols. A Protocol instance is bound to a corresponding valid interface to provide communication means. For instance you can bind a IP protocol instance to an ethernet controller, to provide IP connectivity. One can add virtual interfaces to a protocol instance, allowing to build protocol stacks. You can then for instance bind a UDP client protocol on top of a IP interface, and this UDP protocol can in turn provide many access points.
Each Protocol implementation can be specific to an IO board (typically GPIOs) or to an operating system (e.g. posix sockets). There is no restriction on the number of interfaces or size of protocol stacks in hardio. So one can define high level protocols build on top of these operating system or board related interfaces. For instance there there is the Modbus protocol that is itself defined on top of a serial or UDP link.
In the end drivers are implemented using one or more interfaces provided by one or more protocols.
Drivers
Driver in hardio are just normal C/C++ classes, they simply use one or more hardio interfaces to implement the communication with the real embedded electronic device. This way, any time the driver need to be reused “as is” only an implementation of the board needs to be provide, which inludes the protocols it uses.
Please notice that an interface can be used to connect a board with another board, and this later can provide in the same time new IOs and specific functionalitities. For instane one can imagine a board able to control the power supply of motors, while providing new IOs (like PPM IOs) for controlling theses motors.
Additionnal documentation and examples
Examples on the usage of most devices, hardiocore are available in the example packages such as upboardexample and rpiexample.
The tutorial also covers some of these examples and explain how to use the various concepts of the hardio framework.