This patch replaces the pinmux APIs that require users to look up an arbitrary
function number for the desired function of each pin. The replacement API
functions have intuitive names and permit users to pass board-level IO port
numbers. The API functions internally convert those to CPU-level port numbers
when necessary. Furthermore, when configuring a pin to be a digital input or
output, those API functions also perform the corresponding configuration
operation on the CPU-level GPIO port. The revised APIs halt when users attempt
to configure a currently-unsupported GPIO, specifically those in the GPIO_SUS
port range and those implemented on the expander chip EXP2. This also means
that such ports are left unconfigured during initialization, whereas the
pinmuxing for them was setup by the old implementation.
This patch revises the I2C and GPIO initialization code to always be
run during platform boot rather than within each process that requires
it.
This patch also revises the gpio-output example to use a pin that is
set as an output by the default pinmux configuration. Previously, it
used a pin that was set as an output by the pinmux configuration that
is in effect when the OS does not change the pinmux configuration.
This patch introduces an example application to demonstrate how to use
GPIO driver APIs to manipulate interrupt pins.
The application uses default galileo pinmux initialization and sets
the GPIO 5 (IO2) as output pin and GPIO 6 (IO3) as interrupt. It toggles
the output pin stat at every half second in order to emulate an interrupt.
This triggers an interrupt and the application callback is called.