u8 btnKeyStatue[2];
u8 NewBtnKeyPreeDown[2];
void Btn_task(void)
{
u8 btnKey[2];
static u8 btnKeyBuf[2]={100,100};
static u8 _lastKeyStatue[2];
u8 i;
if(N_1ms_BtnKey<2) return ;
N_1ms_BtnKey = 0;
btnKey[0] = PBin(2);
btnKey[1] = PBin(14);
for(i=0;i<2;i++)
{
if(btnKey[i])
{
if( btnKeyBuf[i]<150) btnKeyBuf[i]++;
}
else
{
if( btnKeyBuf[i]>50) btnKeyBuf[i]--;
}
if(btnKeyBuf[i]>=140)
{
btnKeyStatue[i] = 0;
}
else if(btnKeyBuf[i]<=60)
{
btnKeyStatue[i] = 1;
}
if((btnKeyStatue[i]==1)&&(_lastKeyStatue[i]==0))
{
NewBtnKeyPreeDown[i] = 1;
}
_lastKeyStatue[i] = btnKeyStatue[i];
}
}