Ofcourse. I solve moving get into HID callback. Now all works ok.
Why MX dont place callback into generated main?
/* USER CODE BEGIN 0 */
char Uart_Buf[200];
void USBH_HID_EventCallback(USBH_HandleTypeDef *phost)
{
if(USBH_HID_GetDeviceType(phost) == HID_MOUSE) // if the HID is Mouse
{
HID_MOUSE_Info_TypeDef *Mouse_Info;
Mouse_Info = USBH_HID_GetMouseInfo(phost); // Get the info
int len = sprintf (Uart_Buf, "X=%d, Y=%d, Button1=%d, Button2=%d, Button3=%d\r\n", (int8_t)Mouse_Info->x, (int8_t)Mouse_Info->y, Mouse_Info->buttons[0],Mouse_Info->buttons[1], Mouse_Info->buttons[2]);
HAL_UART_Transmit(&huart3, (uint8_t *) Uart_Buf, len, 100);
}
}
/* USER CODE END 0 */
/**
* @brief The application entry point.
* @retval int
*/
int main(void)
{
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_USART3_UART_Init();
MX_USB_HOST_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
MX_USB_HOST_Process();
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}