Norman James | e759492 | 2015-08-27 14:25:24 -0500 | [diff] [blame] | 1 | #ifndef __OBJECTS_GPIO_UTILITIES_H__ |
| 2 | #define __OBJECTS_GPIO_UTILITIES_H__ |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | #include <gio/gio.h> |
| 6 | |
| 7 | typedef struct { |
| 8 | gchar* name; |
| 9 | gchar* dev; |
| 10 | uint16_t num; |
| 11 | gchar* direction; |
| 12 | int fd; |
| 13 | } GPIO; |
| 14 | |
| 15 | |
| 16 | //gpio functions |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 17 | #define GPIO_OK 0 |
| 18 | #define GPIO_ERROR -1 |
| 19 | #define GPIO_OPEN_ERROR -2 |
| 20 | #define GPIO_INIT_ERROR -3 |
| 21 | #define GPIO_READ_ERROR -4 |
| 22 | #define GPIO_WRITE_ERROR -5 |
| 23 | #define GPIO_LOOKUP_ERROR -6 |
| 24 | |
| 25 | int gpio_init(GDBusConnection*, GPIO*); |
Norman James | e759492 | 2015-08-27 14:25:24 -0500 | [diff] [blame] | 26 | void gpio_close(GPIO*); |
| 27 | int gpio_open(GPIO*); |
Norman James | 5a7cc8d | 2015-10-06 12:31:06 -0500 | [diff] [blame] | 28 | int gpio_open_interrupt(GPIO*, GIOFunc, gpointer); |
Norman James | 32e74e2 | 2015-09-15 21:28:06 -0500 | [diff] [blame] | 29 | int gpio_write(GPIO*, uint8_t); |
| 30 | int gpio_writec(GPIO*, char); |
| 31 | int gpio_clock_cycle(GPIO*, int); |
| 32 | int gpio_read(GPIO*,uint8_t*); |
Norman James | e759492 | 2015-08-27 14:25:24 -0500 | [diff] [blame] | 33 | |
| 34 | #endif |