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

📄 testkeyboard.c

📁 完整的S3C2410终端键盘驱动源程序
💻 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 + -