blob: 54d912de955cea83f72d47bb7987f9e7e5a20968 [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 James32e74e22015-09-15 21:28:06 -050028int gpio_write(GPIO*, uint8_t);
29int gpio_writec(GPIO*, char);
30int gpio_clock_cycle(GPIO*, int);
31int gpio_read(GPIO*,uint8_t*);
Norman Jamese7594922015-08-27 14:25:24 -050032
33#endif