{ switch(ucChar) { case 1: case 2: case 3: case 4: case 5: ucChar-=1;break; case 9: case 10: case 11: case 12: case 13: ucChar-=4;break; case 17: case 18: case 19: case 20: case 21: ucChar-=7;break; case 25: ucChar = 0xF;break; case 26: ucChar ='+';break; case 27: ucChar ='-';break; case 28: ucChar ='*';break; case 29: ucChar = 0xFF;break; default: ucChar = 0xFE;// error
} return ucChar; }
int main() { int fd,i; char key;
if((fd=open("/dev/i2c/0",O_RDWR))==-1)//打开i2c设备
{ printf("open the key device FAILD!\n"); exit(1); } else printf("open the key device SUCCESS!\n");