@@ -295,7 +295,7 @@ static uint8_t USBD_HID_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
295
295
296
296
#ifdef USE_USBD_COMPOSITE
297
297
/* Get the Endpoints addresses allocated for this class instance */
298
- HIDInEpAdd = USBD_CoreGetEPAdd (pdev , USBD_EP_IN , USBD_EP_TYPE_INTR );
298
+ HIDInEpAdd = USBD_CoreGetEPAdd (pdev , USBD_EP_IN , USBD_EP_TYPE_INTR , ( uint8_t ) pdev -> classId );
299
299
#endif /* USE_USBD_COMPOSITE */
300
300
301
301
if (pdev -> dev_speed == USBD_SPEED_HIGH )
@@ -311,7 +311,7 @@ static uint8_t USBD_HID_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
311
311
(void )USBD_LL_OpenEP (pdev , HIDInEpAdd , USBD_EP_TYPE_INTR , HID_EPIN_SIZE );
312
312
pdev -> ep_in [HIDInEpAdd & 0xFU ].is_used = 1U ;
313
313
314
- hhid -> state = HID_IDLE ;
314
+ hhid -> state = USBD_HID_IDLE ;
315
315
316
316
return (uint8_t )USBD_OK ;
317
317
}
@@ -329,7 +329,7 @@ static uint8_t USBD_HID_DeInit(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
329
329
330
330
#ifdef USE_USBD_COMPOSITE
331
331
/* Get the Endpoints addresses allocated for this class instance */
332
- HIDInEpAdd = USBD_CoreGetEPAdd (pdev , USBD_EP_IN , USBD_EP_TYPE_INTR );
332
+ HIDInEpAdd = USBD_CoreGetEPAdd (pdev , USBD_EP_IN , USBD_EP_TYPE_INTR , ( uint8_t ) pdev -> classId );
333
333
#endif /* USE_USBD_COMPOSITE */
334
334
335
335
/* Close HID EPs */
@@ -372,19 +372,19 @@ static uint8_t USBD_HID_Setup(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *re
372
372
case USB_REQ_TYPE_CLASS :
373
373
switch (req -> bRequest )
374
374
{
375
- case HID_REQ_SET_PROTOCOL :
375
+ case USBD_HID_REQ_SET_PROTOCOL :
376
376
hhid -> Protocol = (uint8_t )(req -> wValue );
377
377
break ;
378
378
379
- case HID_REQ_GET_PROTOCOL :
379
+ case USBD_HID_REQ_GET_PROTOCOL :
380
380
(void )USBD_CtlSendData (pdev , (uint8_t * )& hhid -> Protocol , 1U );
381
381
break ;
382
382
383
- case HID_REQ_SET_IDLE :
383
+ case USBD_HID_REQ_SET_IDLE :
384
384
hhid -> IdleState = (uint8_t )(req -> wValue >> 8 );
385
385
break ;
386
386
387
- case HID_REQ_GET_IDLE :
387
+ case USBD_HID_REQ_GET_IDLE :
388
388
(void )USBD_CtlSendData (pdev , (uint8_t * )& hhid -> IdleState , 1U );
389
389
break ;
390
390
@@ -472,16 +472,24 @@ static uint8_t USBD_HID_Setup(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *re
472
472
return (uint8_t )ret ;
473
473
}
474
474
475
+
475
476
/**
476
477
* @brief USBD_HID_SendReport
477
478
* Send HID Report
478
479
* @param pdev: device instance
479
480
* @param buff: pointer to report
481
+ * @param ClassId: The Class ID
480
482
* @retval status
481
483
*/
484
+ #ifdef USE_USBD_COMPOSITE
485
+ uint8_t USBD_HID_SendReport (USBD_HandleTypeDef * pdev , uint8_t * report , uint16_t len , uint8_t ClassId )
486
+ {
487
+ USBD_HID_HandleTypeDef * hhid = (USBD_HID_HandleTypeDef * )pdev -> pClassDataCmsit [ClassId ];
488
+ #else
482
489
uint8_t USBD_HID_SendReport (USBD_HandleTypeDef * pdev , uint8_t * report , uint16_t len )
483
490
{
484
491
USBD_HID_HandleTypeDef * hhid = (USBD_HID_HandleTypeDef * )pdev -> pClassDataCmsit [pdev -> classId ];
492
+ #endif /* USE_USBD_COMPOSITE */
485
493
486
494
if (hhid == NULL )
487
495
{
@@ -490,14 +498,14 @@ uint8_t USBD_HID_SendReport(USBD_HandleTypeDef *pdev, uint8_t *report, uint16_t
490
498
491
499
#ifdef USE_USBD_COMPOSITE
492
500
/* Get the Endpoints addresses allocated for this class instance */
493
- HIDInEpAdd = USBD_CoreGetEPAdd (pdev , USBD_EP_IN , USBD_EP_TYPE_INTR );
501
+ HIDInEpAdd = USBD_CoreGetEPAdd (pdev , USBD_EP_IN , USBD_EP_TYPE_INTR , ClassId );
494
502
#endif /* USE_USBD_COMPOSITE */
495
503
496
504
if (pdev -> dev_state == USBD_STATE_CONFIGURED )
497
505
{
498
- if (hhid -> state == HID_IDLE )
506
+ if (hhid -> state == USBD_HID_IDLE )
499
507
{
500
- hhid -> state = HID_BUSY ;
508
+ hhid -> state = USBD_HID_BUSY ;
501
509
(void )USBD_LL_Transmit (pdev , HIDInEpAdd , report , len );
502
510
}
503
511
}
@@ -607,7 +615,7 @@ static uint8_t USBD_HID_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum)
607
615
UNUSED (epnum );
608
616
/* Ensure that the FIFO is empty before a new transfer, this condition could
609
617
be caused by a new transfer before the end of the previous transfer */
610
- ((USBD_HID_HandleTypeDef * )pdev -> pClassDataCmsit [pdev -> classId ])-> state = HID_IDLE ;
618
+ ((USBD_HID_HandleTypeDef * )pdev -> pClassDataCmsit [pdev -> classId ])-> state = USBD_HID_IDLE ;
611
619
612
620
return (uint8_t )USBD_OK ;
613
621
}
0 commit comments