blob: d9279e462dac316650fa4bb830b7fde911647e47 [file] [log] [blame]
Norman Jamese7594922015-08-27 14:25:24 -05001#ifndef __OBJECTS_GPIO_UTILITIES_H__
2#define __OBJECTS_GPIO_UTILITIES_H__
3
4#include <stdint.h>
5#include <gio/gio.h>
6
7typedef 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 James32e74e22015-09-15 21:28:06 -050017#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
25int gpio_init(GDBusConnection*, GPIO*);
Norman Jamese7594922015-08-27 14:25:24 -050026void gpio_close(GPIO*);
27int gpio_open(GPIO*);
Norman James5a7cc8d2015-10-06 12:31:06 -050028int gpio_open_interrupt(GPIO*, GIOFunc, gpointer);
Norman James32e74e22015-09-15 21:28:06 -050029int gpio_write(GPIO*, uint8_t);
30int gpio_writec(GPIO*, char);
31int gpio_clock_cycle(GPIO*, int);
32int gpio_read(GPIO*,uint8_t*);
Norman Jamese7594922015-08-27 14:25:24 -050033
34#endif