Rework and cleanup some internals

Inspired and based on a patch by Fredrik Svensson.

Signed-off-by: Michael Heimpold <mhei@heimpold.de>
Mention errno values explicite in doc

Signed-off-by: Michael Heimpold <mhei@heimpold.de>
Use gpio_fd_read instead of simple read

Signed-off-by: Michael Heimpold <mhei@heimpold.de>
Move helper functions into own file

Signed-off-by: Michael Heimpold <mhei@heimpold.de>
Fix declaration of ARRAY_SIZE

Signed-off-by: Michael Heimpold <mhei@heimpold.de>
Various improvements/cleanups

- factor out gpio_{set,get}_edge to gpio_fd_...
- make gpio_fd_open interface more intuitive

Signed-off-by: Michael Heimpold <mhei@heimpold.de>
Implement some new API functions

Signed-off-by: Michael Heimpold <mhei@heimpold.de>