-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathgpioconfig.h
32 lines (30 loc) · 875 Bytes
/
gpioconfig.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <poll.h>
#include <stdlib.h>
#include <errno.h>
#include <signal.h>
#include<sys/epoll.h>
/*** constants ***/
#define SYSFS_GPIO_DIR "/sys/class/gpio"
#define POLL_TIMEOUT (3 * 1000) /* 3 seconds */
#define MAX_BUF 64
/*** gpio functions ***/
/* gpio export */
int gpio_export(unsigned int gpio);
/* gpio unexport */
int gpio_unexport(unsigned int gpio);
/* gpio set dir */
int gpio_set_dir(unsigned int gpio, const char *dir);
/* gpio set value */
int gpio_set_value(unsigned int gpio, unsigned int value);
/* gpio get value */
int gpio_get_value(unsigned int gpio, unsigned int *value);
/* gpio set edge */
int gpio_set_edge(unsigned int gpio, const char *edge);
/* gpio fd open */
int gpio_fd_open(unsigned int gpio, unsigned int dir);
/* gpio fd close */
int gpio_fd_close(int fd);