初级会员

- 积分
- 90
- 金钱
- 90
- 注册时间
- 2015-3-31
- 在线时间
- 0 小时
|
5金钱
不知道这样写符不符合规矩,求大神检验一下
uint8_t rdkey()
{uint8_t scan1,scan2,keycode,j;
unsigned char result1,result2,t1,t2;
t1=0x000f;
t2=0x00f0;
KEY1_Init();
GPIOA->BSRR=t1;
GPIOA->BRR = (~t1)& 0x00f0;
result1 = (GPIO_ReadInputData(GPIOA));
if((result&0x000f)!=0x000f)
{ delayms(30);
result1 = (GPIO_ReadInputData(GPIOA));
if((result&0x000f)!=0x000f)
{t=0x000f;
KEY1_Init();
GPIOA->BSRR=t2;
GPIOA->BRR = (~t2)& 0x00f0;
result2 = (GPIO_ReadInputData(GPIOA));
keycode=result1|result2;
for(j=0;j<=15;j++)
{if (keycode==keys[j])
{key=j;
return(key);
|
|