- void Gesture_test(void)
- { unsigned char i,status;
- unsigned char data[2]={0x00}
- unsigned short gesture_data;
- paj7620u2_selectBank(BANK0);//进入BANK0寄存器区域
- for(i=0;i<GESTURE_SIZE;i++)
- {
- GS_Write_Byte(gesture_arry[i][0],gesture_arry[i][1]);//手势识别模式初始化
- }
- paj7620u2_selectBank(BANK0);//切换回BANK0寄存器区域
- i=0;
- while(1)
- {
- if(key==WKUP_PRES)
- {
- GS_Write_Byte(PAJ_SET_INT_FLAG1,0X00);//关闭手势识别中断输出
- GS_Write_Byte(PAJ_SET_INT_FLAG2,0X00);
- break;
- }
- status = GS_Read_nByte(PAJ_GET_INT_FLAG1,2,&data[0]);//读取手势状态
- if(!status)
- {
- gesture_data =(u16)data[1]<<8 | data[0];
- if(gesture_data)
- {
- switch(gesture_data)
- {
- case GES_UP: LCD_ShowString(110,250,200,16,24,"UP ");
- printf("Up\r\n"); ledflash=1; break; //向上
- case GES_DOWM: LCD_ShowString(100,250,200,16,24,"Dowm ");
- printf("Dowm\r\n"); ledflash=1; break; //向下
- case GES_LEFT: LCD_ShowString(100,250,200,16,24,"Left ");
- printf("Left\r\n"); ledflash=1; break; //向左
- case GES_RIGHT: LCD_ShowString(100,250,200,16,24,"Right ");
- printf("Right\r\n"); ledflash=1; break; //向右
- case GES_FORWARD: LCD_ShowString(80,250,200,16,24,"Forward ");
- printf("Forward\r\n"); ledflash=1; break; //向前
- case GES_BACKWARD: LCD_ShowString(80,250,200,16,24,"Backward ");
- printf("Backward\r\n"); ledflash=1; break; //向后
- case GES_CLOCKWISE: LCD_ShowString(70,250,200,16,24,"Clockwise ");
- printf("Clockwise\r\n"); ledflash=1; break; //顺时针
- case GES_COUNT_CLOCKWISE: LCD_ShowString(50,250,200,16,24,"AntiClockwise");
- printf("AntiClockwise\r\n"); ledflash=1; break; //逆时针
- case GES_WAVE: LCD_ShowString(100,250,200,16,24,"Wave ");
- printf("Wave\r\n"); ledflash=1; break; //挥动
- default: ledflash=0; break;
-
- }
- }
-
- }
- delay_ms(50);
- i++;
- if(i==5)
- {
- LED0=!LED0;//提示系统正在运行
- i=0;
- }
- }
- }
复制代码
要是想移植成51单片机的程序,应该注意点什么
求大神讲解一下
|