mraa.c: Fixed potential segfault on free()-ing NULL in mraa_deinit()

Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
mraa.c: fix aio mraa_pin_mode_test

test was adding board gpio_count to pin so that 0 would use the info for pin 14
on some boards when asking for aio capability

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
mraa.c: fix uart mraa_pin_mode_test

switch statement was missing a clause for MRAA_PIN_UART meaning it always
returned False

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
mraa.c: add syslog msg in case we get an unknown pinmode

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
mraa.c: mraa_pin_mode_test should check against b->gpio_count -1

It's already the case for rpi & MMAX but it should be noted that on 1 indexed
boards gpio_count should be +1

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
contributing.md: fix styling issues

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
gpio.c: add advance_func->gpio_close_pre

Signed-off-by: Kurt Eckhardt <kurte@rockisland.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
x86/edison: Speed up mraa_gpio_dir

Reasonable speed up in the mraa_gpio_dir on the Edison Arduino board

Signed-off-by: Kurt Eckhardt <kurte@rockisland.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
x86/galileo-gen2: Speed up mraa_gpio_dir

Made like changes to Edison to cache the output enable.

Note: different than Edison as the pin structure holds enable pin number
instead of external array.

2nd note: noticed PU resistors are also in structure but there is also
external array.

Signed-off-by: Kurt Eckhardt <kurte@rockisland.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
gpio: Add a function to get a pin number from mraa_gpio_context

Signed-off-by: Kenta Yonekura <yoneken@ieee.org>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>