另外一个与这个差不多,只是x值不一样、
我定义了两个数组,如下:
code uint speed_x[14]=
{
87,126,140,173,184,224,239,280,290,335,159,173,236,266
};
code uint dose_x[14]=
{
154,196,206,250,258,298,306,346,352,398,236,242,310,320
};
原子程序改为
void Calculator_key(uint *q)
{
if((X>=*q)&&(X<=(*(q+1)))&&(Y>=KEY04YL)&&(Y<=KEY04YH)) //0
keycode=13;
else if((X>=(*(q+2)))&&(X<=(*(q+3)))&&(Y>=KEY04YL)&&(Y<=KEY04YH)) //1
keycode=14;
else if((X>=(*(q+4)))&&(X<=(*(q+5)))&&(Y>=KEY04YL)&&(Y<=KEY04YH)) //2
keycode=15;
else if((X>=(*(q+6)))&&(X<=(*(q+7)))&&(Y>=KEY04YL)&&(Y<=KEY04YH)) //3
keycode=16;
else if((X>=(*(q+8)))&&(X<=(*(q+9)))&&(Y>=KEY04YL)&&(Y<=KEY04YH)) //4
keycode=17;
else if((X>=*q)&&(X<=(*(q+1)))&&(Y>=KEY59YL)&&(Y<=KEY59YH)) //5
keycode=18;
else if((X>=(*(q+2)))&&(X<=(*(q+3)))&&(Y>=KEY59YL)&&(Y<=KEY59YH)) //6
keycode=19;
else if((X>=(*(q+4)))&&(X<=(*(q+5)))&&(Y>=KEY59YL)&&(Y<=KEY59YH)) //7
keycode=20;
else if((X>=(*(q+6)))&&(X<=(*(q+7)))&&(Y>=KEY59YL)&&(Y<=KEY59YH)) //8
keycode=21;
else if((X>=(*(q+8)))&&(X<=(*(q+9)))&&(Y>=KEY59YL)&&(Y<=KEY59YH)) //9
keycode=22;
else if((X>=*q)&&(X<=(*(q+10)))&&(Y>=KEYCOKYL)&&(Y<=KEYCOKYH)) //C
keycode=24;
else if((X>=(*(q+11)))&&(X<=(*(q+12)))&&(Y>=KEYCOKYL)&&(Y<=KEYCOKYH)) //.
keycode=23;
else if((X>=(*(q+13)))&&(X<=(*(q+9)))&&(Y>=KEYCOKYL)&&(Y<=KEYCOKYH)) //OK
keycode=26;
else
keycode=0xff;
}
调用时如下:
Calculator_key(speed_x);
。。。。。。。。。。。。。。。。。。。
Calculator_key(dose_x); |