Firmware: Get data and size on usbd_custom_hid_if.c

This commit is contained in:
2025-12-28 22:33:27 -03:00
parent dec9237bf7
commit e3fec2976e

View File

@@ -198,7 +198,13 @@ static int8_t CUSTOM_HID_OutEvent_FS(uint8_t event_idx, uint8_t state)
/* USER CODE BEGIN 6 */
UNUSED(event_idx);
UNUSED(state);
USBD_CUSTOM_HID_HandleTypeDef* hhid = (USBD_CUSTOM_HID_HandleTypeDef*)hUsbDeviceFS.pClassData;
PCD_HandleTypeDef* hpcd = (PCD_HandleTypeDef*)hUsbDeviceFS.pData;
// Get received data (64 bytes)
uint8_t *data = hhid->Report_buf;
uint8_t report_id = data[0];
uint32_t size = HAL_PCD_EP_GetRxCount(hpcd, CUSTOM_HID_EPOUT_ADDR);
/* Start next USB packet transfer once data processing is completed */
USBD_CUSTOM_HID_ReceivePacket(&hUsbDeviceFS);