代码是用STM32CUBE直接生成的,接上鼠标后也能正常识别,但Appli_state一直不会变为APPLICATION_READY,也就不能进行下一步操作。对这方面不太懂,大家有没有什么资料可以参考
这是输出的调试信息
代码:
while (1)
{
/* USER CODE END WHILE */
MX_USB_HOST_Process();
/* USER CODE BEGIN 3 */
if(Appli_state == APPLICATION_READY)
{
if(USBH_HID_GetDeviceType(&hUsbHostHS) == HID_MOUSE)
{
pmouse = USBH_HID_GetMouseInfo(&hUsbHostHS);
if(pmouse != NULL)
{
printf("%d %d\n", pmouse->x, pmouse->y);
}
}
else if(USBH_HID_GetDeviceType(&hUsbHostHS) == HID_KEYBOARD)
{
pkeybd = USBH_HID_GetKeybdInfo(&hUsbHostHS);
if(pkeybd != NULL)
{
printf("key pressed\n");
}
}
}
}
|