Release v2.11.4

This commit is contained in:
slimih
2025-04-15 10:28:24 +01:00
parent 0b06460a43
commit 2a0a3521ac
27 changed files with 408 additions and 167 deletions

View File

@@ -284,6 +284,11 @@ static uint8_t USBD_CUSTOM_HID_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
pdev->ep_in[CUSTOMHIDInEpAdd & 0xFU].is_used = 1U;
if (USBD_CUSTOMHID_OUTREPORT_BUF_SIZE < CUSTOM_HID_EPOUT_SIZE)
{
return (uint8_t)USBD_FAIL;
}
/* Open EP OUT */
(void)USBD_LL_OpenEP(pdev, CUSTOMHIDOutEpAdd, USBD_EP_TYPE_INTR,
CUSTOM_HID_EPOUT_SIZE);
@@ -397,9 +402,17 @@ static uint8_t USBD_CUSTOM_HID_Setup(USBD_HandleTypeDef *pdev,
}
#endif /* USBD_CUSTOMHID_CTRL_REQ_COMPLETE_CALLBACK_ENABLED */
#ifndef USBD_CUSTOMHID_EP0_OUT_PREPARE_RECEIVE_DISABLED
if (req->wLength > USBD_CUSTOMHID_OUTREPORT_BUF_SIZE)
{
/* Stall EP0 */
USBD_CtlError(pdev, req);
return USBD_FAIL;
}
hhid->IsReportAvailable = 1U;
(void)USBD_CtlPrepareRx(pdev, hhid->Report_buf,
MIN(req->wLength, USBD_CUSTOMHID_OUTREPORT_BUF_SIZE));
(void)USBD_CtlPrepareRx(pdev, hhid->Report_buf, req->wLength);
#endif /* USBD_CUSTOMHID_EP0_OUT_PREPARE_RECEIVE_DISABLED */
break;
#ifdef USBD_CUSTOMHID_CTRL_REQ_GET_REPORT_ENABLED
@@ -701,8 +714,13 @@ static uint8_t USBD_CUSTOM_HID_DataOut(USBD_HandleTypeDef *pdev, uint8_t epnum)
/* USB data will be immediately processed, this allow next USB traffic being
NAKed till the end of the application processing */
#ifdef USBD_CUSTOMHID_REPORT_BUFFER_EVENT_ENABLED
((USBD_CUSTOM_HID_ItfTypeDef *)pdev->pUserData[pdev->classId])->OutEvent(hhid->Report_buf);
#else
((USBD_CUSTOM_HID_ItfTypeDef *)pdev->pUserData[pdev->classId])->OutEvent(hhid->Report_buf[0],
hhid->Report_buf[1]);
#endif /* USBD_CUSTOMHID_REPORT_BUFFER_EVENT_ENABLED */
return (uint8_t)USBD_OK;
}
@@ -755,8 +773,12 @@ static uint8_t USBD_CUSTOM_HID_EP0_RxReady(USBD_HandleTypeDef *pdev)
if (hhid->IsReportAvailable == 1U)
{
#ifdef USBD_CUSTOMHID_REPORT_BUFFER_EVENT_ENABLED
((USBD_CUSTOM_HID_ItfTypeDef *)pdev->pUserData[pdev->classId])->OutEvent(hhid->Report_buf);
#else
((USBD_CUSTOM_HID_ItfTypeDef *)pdev->pUserData[pdev->classId])->OutEvent(hhid->Report_buf[0],
hhid->Report_buf[1]);
#endif /* USBD_CUSTOMHID_REPORT_BUFFER_EVENT_ENABLED */
hhid->IsReportAvailable = 0U;
}

View File

@@ -32,7 +32,11 @@ EndBSPDependencies */
static int8_t TEMPLATE_CUSTOM_HID_Init(void);
static int8_t TEMPLATE_CUSTOM_HID_DeInit(void);
#ifdef USBD_CUSTOMHID_REPORT_BUFFER_EVENT_ENABLED
static int8_t TEMPLATE_CUSTOM_HID_OutEvent(uint8_t *report_buffer);
#else
static int8_t TEMPLATE_CUSTOM_HID_OutEvent(uint8_t event_idx, uint8_t state);
#endif /* USBD_CUSTOMHID_REPORT_BUFFER_EVENT_ENABLED */
#ifdef USBD_CUSTOMHID_CTRL_REQ_COMPLETE_CALLBACK_ENABLED
static int8_t TEMPLATE_CUSTOM_HID_CtrlReqComplete(uint8_t request, uint16_t wLength);
@@ -49,6 +53,9 @@ __ALIGN_BEGIN static uint8_t TEMPLATE_CUSTOM_HID_ReportDesc[USBD_CUSTOM_HID_REPO
USBD_CUSTOM_HID_ItfTypeDef USBD_CustomHID_template_fops =
{
TEMPLATE_CUSTOM_HID_ReportDesc,
#ifdef USBD_CUSTOMHID_REPORT_DESC_SIZE_ENABLED
USBD_CUSTOM_HID_REPORT_DESC_SIZE,
#endif /* USBD_CUSTOMHID_REPORT_DESC_SIZE_ENABLED */
TEMPLATE_CUSTOM_HID_Init,
TEMPLATE_CUSTOM_HID_DeInit,
TEMPLATE_CUSTOM_HID_OutEvent,
@@ -95,10 +102,17 @@ static int8_t TEMPLATE_CUSTOM_HID_DeInit(void)
* @param state: event state
* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
*/
#ifdef USBD_CUSTOMHID_REPORT_BUFFER_EVENT_ENABLED
static int8_t TEMPLATE_CUSTOM_HID_OutEvent(uint8_t *report_buffer)
{
UNUSED(report_buffer);
#else
static int8_t TEMPLATE_CUSTOM_HID_OutEvent(uint8_t event_idx, uint8_t state)
{
UNUSED(event_idx);
UNUSED(state);
#endif /* USBD_CUSTOMHID_REPORT_BUFFER_EVENT_ENABLED */
/* Start next USB packet transfer once data processing is completed */
if (USBD_CUSTOM_HID_ReceivePacket(&USBD_Device) != (uint8_t)USBD_OK)
@@ -151,7 +165,7 @@ static int8_t TEMPLATE_CUSTOM_HID_CtrlReqComplete(uint8_t request, uint16_t wLen
static uint8_t *TEMPLATE_CUSTOM_HID_GetReport(uint16_t *ReportLength)
{
UNUSED(ReportLength);
uint8_t *pbuff;
uint8_t *pbuff = NULL;
return (pbuff);
}