Get data from USB_ReadPacket function
I am using a STM32F4 on a custom board with USB configured as custom hid device.
I need to know how to get the received data from the USB_ReadPacket placed inside the HAL_PCD_IRQHandler (I suppose this is the function called when the device receive data from USB).
This is the function:
/**
* @brief USB_ReadPacket : read a packet from the RX FIFO
* @param USBx Selected device
* @param dest source pointer
* @param len Number of bytes to read
* @retval pointer to destination buffer
*/
void *USB_ReadPacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *dest, uint16_t len)
{
uint32_t USBx_BASE = (uint32_t)USBx;
uint32_t *pDest = (uint32_t *)dest;
uint32_t i;
uint32_t count32b = ((uint32_t)len + 3U) / 4U;
for (i = 0U; i < count32b; i++)
{
__UNALIGNED_UINT32_WRITE(pDest, USBx_DFIFO(0U));
pDest++;
}
return ((void *)pDest);
}
Thank you
