breadboard v0.0.5 Breadboard.Pinout View Source

Manage the pinout for the supported platform.

Note that accessing the GPIO pins through sysfs in some case (i.e. ARM SoCs family from Allwinner Technology) the pinout number/label may differ from real pin reference number.

The real pin number using Circuits.GPIO.info/0 'name' key

Link to this section Summary

Functions

Get real pin reference from 'pinout label'.

Get pinout label from the pinout number.

Link to this section Functions

Link to this function

label_to_pin(label)

View Source
label_to_pin(any()) :: non_neg_integer()

Get real pin reference from 'pinout label'.

Returns the real pin number.

Example for Allwinner platform:

calling Breadboard.Pinout.label_to_pin/1 with "PG8", :pg8 or 32 the value returne is always 200 (the real reference for sysfs number):

iex> if(Breadboard.get_platform()==:sunxi ) do
iex> 200 = Breadboard.Pinout.label_to_pin("PG8")
iex> 200 = Breadboard.Pinout.label_to_pin(:pg8)
iex> 200 = Breadboard.Pinout.label_to_pin(32)
iex> 200 = Breadboard.Pinout.label_to_pin(:pin32)
iex> nil
iex> end
nil

Examples for the default 'stub' reference:

iex> if(Breadboard.get_platform()==:stub ) do
iex> 18 = Breadboard.Pinout.label_to_pin("GPIO18")
iex> 18 = Breadboard.Pinout.label_to_pin(:gpio18)
iex> 18 = Breadboard.Pinout.label_to_pin(18)
iex> 18 = Breadboard.Pinout.label_to_pin(:pin18)
iex> nil
iex> end
nil
Link to this function

pin_to_label(pin)

View Source
pin_to_label(any()) :: atom()

Get pinout label from the pinout number.

Returns the pin label as atom.

Examples (for the default 'stub' reference)

iex> if(Breadboard.get_platform()==:stub ) do
iex> :gpio18 = Breadboard.Pinout.pin_to_label(:gpio18)
iex> :gpio18 = Breadboard.Pinout.pin_to_label("GPIO18")
iex> :gpio18 = Breadboard.Pinout.pin_to_label(:pin18)
iex> :gpio18 = Breadboard.Pinout.pin_to_label(18)
iex> nil
iex> end
nil