blob: 54ff6af680860de793aa4056d84051507fc0e6ea [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>
Norman James02b77f32015-10-28 18:59:29 -05006#include <stdbool.h>
Norman Jamese7594922015-08-27 14:25:24 -05007
8typedef struct {
9 gchar* name;
10 gchar* dev;
11 uint16_t num;
Anthony Wilsonc0c74e72019-03-06 10:54:58 -060012 uint16_t chip_id;
Norman Jamese7594922015-08-27 14:25:24 -050013 gchar* direction;
14 int fd;
Norman James02b77f32015-10-28 18:59:29 -050015 bool irq_inited;
Norman Jamese7594922015-08-27 14:25:24 -050016} GPIO;
17
18
19//gpio functions
Norman Jamesc96f8372015-10-31 17:27:41 -050020#define GPIO_OK 0x00
21#define GPIO_ERROR 0x01
22#define GPIO_OPEN_ERROR 0x02
23#define GPIO_INIT_ERROR 0x04
24#define GPIO_READ_ERROR 0x08
25#define GPIO_WRITE_ERROR 0x10
26#define GPIO_LOOKUP_ERROR 0x20
Norman James32e74e22015-09-15 21:28:06 -050027
Norman Jamese7594922015-08-27 14:25:24 -050028void gpio_close(GPIO*);
Anthony Wilsonc0c74e72019-03-06 10:54:58 -060029int gpio_open(GPIO*, uint8_t);
Norman James32e74e22015-09-15 21:28:06 -050030int gpio_write(GPIO*, uint8_t);
Anthony Wilsonc0c74e72019-03-06 10:54:58 -060031int gpio_get_params(GPIO*);
Norman James32e74e22015-09-15 21:28:06 -050032int gpio_read(GPIO*,uint8_t*);
Matt Spinler3a70e932018-08-07 14:16:47 -050033void gpio_inits_done();
Norman Jamese7594922015-08-27 14:25:24 -050034
35#endif