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

📄 testkeyboard.c

📁 ARM S3C2410的4X4键盘中断驱动程序(包括驱动, Makefile, 测试源码), 在Linux 2.6.8.1环境下测试过.
💻 C
字号:
/**************************start***********************/
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <asm/delay.h>

main()
{
	int fd;
	char key = 0;
	fd = open("/dev/button", O_RDWR);
	if (fd == -1)
	{
		printf("open device button errr!\n");
		return 0;
	}

	ioctl(fd, 0, 0);	//清空键盘缓冲区, 后面两个参数没有意义, 
	while(key != 16)
	{
		if (read(fd, &key, 1) > 0)
		{
			printf("*********************Key Value = %d*****************************\n", key);
		}
	}
	close(fd);
	return 0;
}

⌨️ 快捷键说明

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