⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 button_test.c

📁 LINUX2.6下实现按键驱动
💻 C
字号:
#include  <sys/stat.h>#include <fcntl.h>#include  <stdio.h>#include  <sys/time.h>#include  <sys/types.h>#include  <unistd.h>main(){   int retval;   int fileno;   int ts, maxfd;   int ret= 0,i,j;   int number;   fileno = open("/dev/button",O_RDWR);       if (fileno == -1) {               printf("open device led errr!\n");               return 0;              }   while(1) {   read(fileno,&number,1);   printf("key=0x%x\n",number);    }      close(fileno);   return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -