|
大家好,有用查询方式实现S3C6410的矩阵键盘的吗,总有问题呢?
[复制链接]
我就是照友坚提供的4*4查询方式实现的矩阵键盘,我的键盘响应总是有问题,有时候没有,有时候出好几次,
大家能有什么方法解决这个问题吗?
for(i=0;i<5;i++)// modi 4 as 5
{
g_pIOPregs->GPLDAT |= ( (0x1<<0) |(0x1<<1) |(0x1<<2) |(0x1<<3) | (0x1<<4) );
g_pIOPregs->GPLDAT &= ~(0x1<
for(j=8;j<13;j++)//modi 12 as 13
{
Sleep(5)//Sleep(10);
R =0xff;
C= 0xff;
if(!(g_pIOPregs->GPKDAT &(0x1<
{
C = i;
R = j-8;
goto over_scan;
}
}
}
over_scan:
for(j=0;j
{
HandleUp_Down[j]=FALSE;
}
RETAILMSG(denis_keypad,(TEXT("[matrix_keyboard_thread]*** R is %x C is %x .\r\n"), R,C));
//if(KEY_EVENT[R][C]==KEY_EVENT[0][0])
if(( R==0) && (C==0) )
{
Key_Press_Down[key_switch]=1;
HandleUp_Down[key_switch]=TRUE;
SetEvent(HandleDown[key_switch]);
}
else
{
Key_Press_Down[key_switch]=0;
HandleUp_Down[key_switch]=FALSE;
}
if(KEY_EVENT[R][C]==KEY_EVENT[0][1])
{
Key_Press_Down[key_light]=1;
HandleUp_Down[key_light]=TRUE;
SetEvent(HandleDown[key_light]);
}
else
{
Key_Press_Down[key_light]=0;
HandleUp_Down[key_light]=FALSE;
}
|
|