snifer

(原创) ADI ADSP-BF548 EZ-KIT Lite® 评估套件4x4键盘应用

0
阅读(2629)

ADSP-BF548 EZ-KIT Lite® 评估套件4x4键盘应用

最近在学习ADSP-BF548 EZ-KIT Lite® 评估套件4x4键盘应用,做一个车库停车位的检测,应用无线的方式实现对车位信息的检测,在使用中利用ADSP-BF548 EZ-KIT Lite的4*4键盘来实现对16个车位信息的检测,如果车位信息扩展,可以使用同样的方式,呵呵,程序我自己写的,欢迎大家评点!!!

#include
#include
#include

int main(void)
{
int fd=-1;
int ret,i;
unsigned int keys_value=0;
fd = open("/dev/KEYS0",0);
if(fd<0)
{
printf("open /dev/KEYS error!\n");
return -1;
}
for(;;)
{
ret=read(fd,&keys_value,sizeof(keys_value));
if(ret<0)
{
printf("read err!\n");
continue;
}
//printf("keys_value=%d\n",keys_value);
switch(keys_value)
{
case 0xEE:printf("S1 pressed!\n");break;
case 0xDE:printf("S2 pressed!\n");break;
case 0xBE:printf("S3 pressed!\n");break;
case 0x7E:printf("S4 pressed!\n");break;
case 0xED:printf("S5 pressed!\n");break;
case 0xDD:printf("S6 pressed!\n");break;
case 0xBD:printf("S7 pressed!\n");break;
case 0x7D:printf("S8 pressed!\n");break;
case 0xEB:printf("S9 pressed!\n");break;
case 0xDB:printf("S10 pressed!\n");break;
case 0xBB:printf("S11 pressed!\n");break;
case 0x7B:printf("S12 pressed!\n");break;
case 0xE7:printf("S13 pressed!\n");break;
case 0xD7:printf("S14 pressed!\n");break;
case 0xB7:printf("S15 pressed!\n");break;
case 0x77:printf("S16 pressed!\n");break;
}
keys_value=0;
}

}
Baidu
map