GPIO binding

Binding for local GPIO subsystem, currently only this exposed to user space by Linux GPIO framework (https://www.kernel.org/doc/Documentation/gpio.txt) is supported. Consist of two components, base module (org.openhab.io.gpio) which can be used by other bindings who needs to interact with GPIOs and the binding itself (org.openhab.binding.gpio).

Prerequisites:
1. Linux OS with GPIO driver loaded (check if exists “/sys/class/gpio”)
2. Mounted “sysfs” pseudo file system, mount point can be:
• Automatically determined if “procfs” is mounted under path “/proc”
• Manually set in openHAB configuration file, key – gpio:sysfs, e.g. gpio:sysfs=/sys
3. Installed package for native JNA library, e.g. for debian-based OS use “apt-get install libjna-java”. Version 3.2.7 is used just because it’s the current package in Debian Wheezy, no other special requirements. If the library isn’t in your system library path you may need to add a parameter (e.g. -Djna.boot.library.path=/usr/lib/jni) in command line which starts openHAB.
NOTE: Some boards may need additional pin configuration prior using them, for example OMAP-based processors are using pin multiplexing. Please refer to board’s System Reference Manual for more information.

Global configuration:
gpio:sysfs – optional directory path where “sysfs” pseudo file system is mounted, if isn’t specified it will be determined automatically (if “procfs” is mounted). Example - gpio:sysfs=/sys
gpio:debounce – optional time interval in miliseconds when pin interrupts are ignored to prevent bounce effect mainly on buttons. Global option for all pins, can be overwritten per pin in item configuration. Default value if isn’t specified – “0”. Example - gpio:debounce=10

Item configuration:
• Allowed item types: “Switch” and “Contact”. “Switch” is for output pins, “Contact” – input pins.
• Configuration string:
  gpio=”pin:PIN_NUMBER [debounce:DEBOUNCE_INTERVAL] [activelow:yes|no]”
where:
  key-value pairs are separated by space
  order of pairs isn’t important, the same is valid for character’s case
  key “pin” is mandatory, “debounce” and “activelow” are optional. If omitted “activelow” is set to “no”, “debounce” - to global option in openHAB configuration file (gpio:debounce) or 0 (zero) if neither is specified
  PIN_NUMBER is the number of the pin as seen by the kernel
  DEBOUNCE_INTERVAL is the time interval in miliseconds when pin interrupts are ignored to prevent bounce effect mainly on buttons. Note that underlying OS isn’t realtime nor the application is, so debounce implementation isn’t something on which you can rely on 100%. You need to experiment with the value here.