哪位大佬帮忙翻译下代码关于按键的控制
最主要的是0xff这种的看不懂。。。
void key()
{
uchar fs=255;
key_scan();
if((key_n!=0xff&&C_Mode==0)||discern_flag)
{
delay(1000);
key_n=0xff;
key_scan();
if((key_n!=0xff&&C_Mode==0)||discern_flag)
{
key_scan();
if((key_n!=0xff&&C_Mode==0))
{
time=0;
fs=key_n;
}
else if(discern_flag)
{
fs=yuyin_n;
yuyin_n=0;
time=0;
delay(1000);
}
key_n=0xff;
key_scan();
while((key_n!=0xff&&C_Mode==0))
{
key_scan();
if(time>39&&Again==0)
{
Again=1;
// time=40;
switch(fs)
{
case 0x7f:
if(vol<30) vol=15;
if(vox<30) vox++;
send_6(0x7E,0x04,0x31,vox,0x22,0xEF);
break;
case 0xbf:
if(vol>0) vol=15;
if(vox>0) vox--;
send_6(0x7E,0x04,0x31,vox,0x22,0xEF);
break;
case 0xdf:
if(set_s)
{
if(ch_song<sum)
ch_song++;
}
else
{
times+=28;
if(times>timer) times=timer;
min=times/600;
sec=times/10%60;
send_5(0x7E,0x03,0x0A,0x09,0xEF);
}
break;
case 0xef:
if(set_s)
{
if(ch_song>1)
ch_song--;
}
else
{
if(times>27)times-=28;
else times=0;
min=times/600;
sec=times/10%60;
send_5(0x7E,0x03,0x0B,0x08,0xEF);
}
break;
}
}
show();
// read_dat();
}
switch(fs)
{
case 0x7f:
if(time<40)
{
send_5(0x7E,0x03,0x04,0x07,0xEF);
state=1;
once=1;
ACIS=6;
discern_flag=0;
fs=0;
}
break;
case 0xbf:
if(time<40)
{
send_5(0x7E,0x03,0x03,0x00,0xEF);
state=1;
once=1;
ACIS=6;
discern_flag=0;
fs=0;
}
break;
case 0xdf:
if(discern_flag)
{
if(vol<30) vol=15;
if(vox<30) vox++;
send_6(0x7E,0x04,0x31,vox,0x22,0xEF);
discern_flag=0;
fs=0;
}
else
{
if(time<40)
{
times+=27;
if(times>timer) times=timer;
min=times/600;
sec=times/10%60;
send_5(0x7E,0x03,0x0A,0x09,0xEF);
}
}
break;
case 0xef:
if(discern_flag)
{
if(vol>0) vol=15;
if(vox>0) vox--;
send_6(0x7E,0x04,0x31,vox,0x22,0xEF);
discern_flag=0;
fs=0;
}
else
{
if(time<40)
{
if(times>26)times-=27;
else times=0;
min=times/600;
sec=times/10%60;
send_5(0x7E,0x03,0x0B,0x08,0xEF);
}
}
break;
case 0xf7:
if(state==2|state==0)
{
state=1;
send_5(0x7E,0x03,0x01,0x02,0xEF);
discern_flag=0;
fs=0;
}else
{
state=2;
send_5(0x7E,0x03,0x02,0x01,0xEF);
discern_flag=0;
fs=0;
}
break;
case 0xfb:
state=0;
send_5(0x7E,0x03,0x0E,0x0D,0xEF);
discern_flag=0;
fs=0;
break;
case 0xfd:
EQ=(EQ+1)%6;
send_6(0x7E,0x04,0x32,EQ,0x36,0xEF);
break;
case 0xfe:
mode=(mode+1)%5;
send_6(0x7E,0x04,0x33,mode,0x35,0xEF);
break;
}
}
}
if(!key9)
{
if(key_flag9)
{
key_flag9=0;
C_Mode=~C_Mode;
}
}
else
key_flag9=1;
}
|