The GPIO subsystem
In order to resolve a real problem, we first need to introduce you to one of the most used computer interfaces, the General Purpose Input Output (GPIO) interface. Using this interface, we can read or write some electrical statuses in the environment, which allows an interaction between the hardware and software. GPIO management has already been introduced in the GPIOs management section of Chapter 2, Managing the System Console. However, this time, the same GPIO subsystem is managed by the kernel, so the functions and commands that the developer can use to interact with the GPIOs (usually called API, that is, application programming interface) are quite different.
GPIO signals are very useful input/output lines that can be used for a large variety of tasks. In a common industrial application, these lines are normally used to manage relays and/or LEDs and to read the status of a switch and/or a photocell.
In this introduction, we'll present the API interface to manage these...