From e3fec2976ead2014d193b51ddb54e196d2bffa11 Mon Sep 17 00:00:00 2001 From: Gabriel Lima Date: Sun, 28 Dec 2025 22:33:27 -0300 Subject: [PATCH] Firmware: Get data and size on usbd_custom_hid_if.c --- Firmware/USB_Device/App/usbd_custom_hid_if.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Firmware/USB_Device/App/usbd_custom_hid_if.c b/Firmware/USB_Device/App/usbd_custom_hid_if.c index 1b3a44e..4097841 100644 --- a/Firmware/USB_Device/App/usbd_custom_hid_if.c +++ b/Firmware/USB_Device/App/usbd_custom_hid_if.c @@ -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);