小弟我在做USB HID相关的项目,用到例子程序JoyStick mouse 改成键盘输入。在USB_send()中 buffer[8] = {0,0,0x1B,0,0,0,0,0};
我打算就发送一次,结果不停的给PC打印字符'x',打印的速率很快。苦恼啊!!!求帮助!检测到的通信过程如图:
发送完0x1B后,紧接着发送最后一条。我看USB usage上说01代表Keyboard ErrorRollOver,难道就是这个一直给PC打印数据木?主函数:
int main()
{
M3_system_init();
while(1)
{
USB_Send();
delay_s(4);
}
}
USB_Send()为:
void USB_Send()
{
uint8_t buffer[8] = {0};
buffer[0] = 0;
buffer[1] = 0;
buffer[2] = 0x1B;
/* Copy mouse position info in ENDP1 Tx Packet Memory Area*/
USB_SIL_Write(EP1_IN, buffer, 8);
/* enable endpoint for transmission */
SetEPTxValid(ENDP1);
}
麻烦各位大神啦。。。。
|