breadboard v0.0.5 Breadboard.GPIO.BaseGPIO behaviour View Source
Define the behaviour to handle GPIOs pinout mapping for a specific platform.
In order to support a Pinout mapping for a specific platform this behaviours
can be referenced by modules implementing pinout_map/0
function.
This function must return a map with the GPIOs pinout information.
Any element must support the keys:
:pin
- the pin number ():sysfs
- the pin number in user space using sysfs:pin_key
- key to identify the pin as atom:pin_label
- an atom to identify the pin label:pin_name
- the name of the pin
As convention all values are defined lowercase except for pin_name
.
Any pin is classified with a keyword list with the above keys.
For example the pin number 1 in the stub hardware abstraction is classified as:
[pin: 1, sysfs: 1, pin_key: :pin1, pin_label: :gpio1, pin_name: "GPIO1"]
so in the complete pinout map for this pin it will be generate the corrispondend key/value pair for any single item:
%{
{:pin, 1} => [pin: 1, sysfs: 1, pin_key: :pin1, pin_label: :gpio1, pin_name: "GPIO1"],
{:sysfs, 1} => [pin: 1, sysfs: 1, pin_key: :pin1, pin_label: :gpio1, pin_name: "GPIO1"],
{:pin_key, :pin1} => [pin: 1, sysfs: 1, pin_key: :pin1, pin_label: :gpio1, pin_name: "GPIO1"],
{:pin_label, :gpio1} => [pin: 1, sysfs: 1, pin_key: :pin1, pin_label: :gpio1, pin_name: "GPIO1"],
{:pin_name, "GPIO1"} => [pin: 1, sysfs: 1, pin_key: :pin1, pin_label: :gpio1, pin_name: "GPIO1"]
}
and so on for any single pin to build the entire pinout map.
As helper to build the complete pinout map can bu used the Breadboard.GPIO.BaseGPIOHelper
Reference modules as example: Breadboard.GPIO.StubHalGPIO
, Breadboard.GPIO.SunxiGPIO
Link to this section Summary
Callbacks
Return the complete pinout map for a specific platform
Link to this section Types
Complete Pinout information
pinout_item_info()
View Sourcepinout_item_info() :: {:pin, non_neg_integer()} | {:sysfs, non_neg_integer()} | {:pin_key, atom()} | {:pin_label, atom()} | {:pin_name, String.t()}
Pin single information
Link to this section Callbacks
Return the complete pinout map for a specific platform