不能在bois下工作

[复制链接]
207|9
手机看帖
扫描二维码
随时随地手机跟帖
kangzj|  楼主 | 2018-10-20 12:43 | 显示全部楼层 |阅读模式
用Cy7C64251做了一个HID键盘,目前问题:不能在bois下工作。
liuzaiy| | 2018-10-20 12:46 | 显示全部楼层
windows下没问题吧

使用特权

评论回复
pangb| | 2018-10-20 12:50 | 显示全部楼层
接口描述什么的呢?

使用特权

评论回复
kangzj|  楼主 | 2018-10-20 12:52 | 显示全部楼层
windows下没问题。接口描述等等都对照了,没问题。

使用特权

评论回复
zyf部长| | 2018-10-20 12:54 | 显示全部楼层
程序看看

使用特权

评论回复
kangzj|  楼主 | 2018-10-20 12:58 | 显示全部楼层

void main(void)  
{  
    int temp,i;

M8C_EnableGInt;                       //Enable Global Interrupts   
Timer8_1_EnableInt();               // Enable the Timer8 interrupt
Timer8_1_Start();                   // Timer8 Start and initialization


USBFS_Start(0, USB_5V_OPERATION);      //Start USBFS Operation using device 0 and with 5V operation  
while(!USBFS_bGetConfiguration());     //Wait for Device to enumerate  

   

  
//Enumeration is completed load endpoint 1. Do not toggle the first time  
USBFS_LoadInEP(1, keycode, 8, USB_NO_TOGGLE);  
while(!USBFS_bGetEPAckState(1)); //Check and see if ACK has occured  
while(!(USBFS_bGetEPState(1) & IN_BUFFER_EMPTY));
USBFS_LoadInEP(1, keycode, 8, USB_TOGGLE);

USBFS_EnableOutEP(2);


while(1)  
{

      
   
   scan();
   PRT0DR_BUF&=0xcf;
      PRT0DR=PRT0DR_BUF;
      temp=PRT0DR&0x07;
      if(temp==0x07)
      {
     if(codeflag==1)
     {
        
      for(i=0;i<8;i++)
   {
          keycode[i]=0;
   }
   
   
    if(USBFS_bGetEPAckState(1))    //Wait for ACK before loading data
        {
          USBFS_LoadInEP(1, keycode, 8, USB_TOGGLE);  
              }
      for(i=0;i<6;i++)
   {
   OldInbuf[i]=0;
   Inbuf[i]=0;
   }
   codeflag=0;
     }
   }
   
   if(USBFS_bGetEPState(2))
         {
          USBFS_bReadOutEP(2, Buf, 8);
       USBFS_EnableOutEP(2);
          if(Buf[0]&0x02)
        {
        PRT0DR_BUF&=0xf7;
                 PRT0DR=PRT0DR_BUF;
     
        }
          else
        {
                 PRT0DR_BUF|=0xcf;
                 PRT0DR=PRT0DR_BUF;         
        }
     USBFS_EnableOutEP(2);
       Delay(4000);
   }
}  
}

使用特权

评论回复
zwll| | 2018-10-20 13:02 | 显示全部楼层

要确保在usb通信没有ACK的时候重新枚举USB device

使用特权

评论回复
kangzj|  楼主 | 2018-10-20 13:04 | 显示全部楼层

工作上要用,赚啥钱呀?
现在是boot下,重新插拔就好了。
但是进入windows之后,也要重新插拔。
boot下灯也不亮,郁闷啊

使用特权

评论回复
chuxh| | 2018-10-20 13:07 | 显示全部楼层

不懂了。。。

使用特权

评论回复
kangzj|  楼主 | 2018-10-20 13:09 | 显示全部楼层

唉,还是没有什么结果,算了,先结贴吧,多谢大家啦

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

672

主题

7007

帖子

2

粉丝