[mw_shl_code=c,true]uint8_t KeyScan(void)
{
uint8_t MKeyCord_h, MKeyCord_l, MKeyCord,i,temp;
MKey_Port=0x0f;
MKeyCord_h = MKey_Port & 0x0f;
if(MKeyCord_h!=0x0f)
{
bsp_DelayMs(10);
MKey_Port=0x0f;
if((MKey_Port & 0x0f)!=0x0f)
{
MKeyCord_h = MKey_Port & 0x0f;
bsp_Usart1Printf("MKeyCord_h is: %d\r\n",(int)MKeyCord_h);
MKey_Port = MKeyCord_h | 0xf0;
MKeyCord_l = MKey_Port & 0xf0;
bsp_Usart1Printf("MKeyCord_l is: %d\r\n",(int)MKeyCord_l);
MKeyCord = MKeyCord_l + MKeyCord_h;
while((MKey_Port & 0xf0)!=0xf0);
bsp_Usart1Printf("MKeyCord is: %d\r\n",(int)MKeyCord);
switch(MKeyCord)
{
case 0xee: i = 0; break;
case 0xed: i = 1; break;
case 0xeb: i = 2; break;
case 0xe7: i = 3; break;
case 0xde: i = 4; break;
case 0xdd: i = 5; break;
case 0xdb: i = 6; break;
case 0xd7: i = 7; break;
case 0xbe: i = 8; break;
case 0xbd: i = 9; break;
case 0xbb: i = 10; break;
case 0xb7: i = 11; break;
case 0x7e: i = 12; break;
case 0x7d: i = 13; break;
case 0x7b: i = 14; break;
case 0x77: i = 15; break;
default : break;
}
}
}
return i;
}[/mw_shl_code]
|