1 Star 0 Fork 1

qingsonggege / openwrt_mt7688_ctest

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
gpio_int_app.c 682 Bytes
一键复制 编辑 原始数据 按行查看 历史
Midas 提交于 2016-12-04 08:37 . first commit,put all files to git
#include <stdio.h>
//#include <curses.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
char str_dev[]="/dev/gpio_int_dev";
int main(int argc, char **argv)
{
int fd;
unsigned int INT_STATUS = 0;
//------- open driver--------
fd = open(str_dev, O_RDWR | O_NONBLOCK);
if (fd < 0)
{
printf("can't open %s\n",str_dev);
return -1;
}
//------------- read INT_STATUS -------
while(1)
{
read(fd, &INT_STATUS, sizeof(INT_STATUS));
if(INT_STATUS==1)
printf("GPIO Interrupt Triggered!\n");
usleep(200000); //--wait
}
close(fd);
return 0;
}
1
https://gitee.com/qingsonggege/openwrt_mt7688_ctest.git
git@gitee.com:qingsonggege/openwrt_mt7688_ctest.git
qingsonggege
openwrt_mt7688_ctest
openwrt_mt7688_ctest
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891