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

📄 test-b-a.c

📁 这是一个基于S3C2410的8位按键的驱动程序源代码
💻 C
字号:
#include <sys/stat.h>#include <fcntl.h>#include <stdio.h>#include <sys/time.h>#include <sys/types.h>#include <unistd.h> #include<time.h>main(){  int retval;   int fileno;   int ts, maxfd;   int  ret= 0,i,j;   int number;int size;   fileno = open("/dev/buttons",O_RDWR); if (fileno == -1)    {      printf("open device led errr!\n");      return 0;    }/*if(select(fileno+1,NULL,NULL,NULL,NULL)<0){printf("select error");}*/   while(1) {  number=0;  size=read(fileno,&number,1);if(number!=0) {  printf("read %d number\n",size);  printf("key=%d\n",number);  usleep(200000);     }}     close(fileno);   return 0;}

⌨️ 快捷键说明

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