fix epout connection

This commit is contained in:
Conor Patrick 2019-05-31 15:58:13 -04:00
parent ba581db49c
commit a51417bf61
3 changed files with 28 additions and 12 deletions

View File

@ -32,7 +32,7 @@ USBD_ClassTypeDef USBD_CCID =
NULL, /* EP0_TxSent, */
USBD_CCID_EP0_RxReady,
USBD_CCID_DataIn,
USBD_CCID_DataOut,
usb_ccid_recieve_callback,
NULL,
NULL,
NULL,
@ -259,7 +259,7 @@ void ccid_send_status(CCID_HEADER * c)
memset(msg,0,sizeof(msg));
msg[0] = CCID_SLOT_STATUS_RES;
msg[6] = c->seq;
msg[6] = 1;
USBD_CCID_TransmitPacket(msg, sizeof(msg));
@ -277,6 +277,12 @@ void handle_ccid(uint8_t * msg, int len)
ccid_send_status(h);
break;
default:
// while(1)
// {
// led_rgb(0xff3520);
// }
//Y
ccid_send_status(h);
break;
}
}
@ -288,12 +294,9 @@ void handle_ccid(uint8_t * msg, int len)
* @param epnum: endpoint number
* @retval status
*/
static uint8_t USBD_CCID_DataOut (USBD_HandleTypeDef *pdev, uint8_t epnum)
uint8_t usb_ccid_recieve_callback(USBD_HandleTypeDef *pdev, uint8_t epnum)
{
while(1)
{
led_rgb(0xff3520);
}
USBD_CCID_HandleTypeDef *hcdc = (USBD_CCID_HandleTypeDef*) pdev->pClassData;
/* Get the received data length */
@ -312,10 +315,18 @@ static uint8_t USBD_CCID_DataOut (USBD_HandleTypeDef *pdev, uint8_t epnum)
}
else
{
while(1)
{
led_rgb(0xff3520);
}
return USBD_FAIL;
}
}
/**
* @brief USBD_CDC_EP0_RxReady
* Handle EP0 Rx Ready event
@ -326,9 +337,9 @@ static uint8_t USBD_CCID_EP0_RxReady (USBD_HandleTypeDef *pdev)
{
USBD_CCID_HandleTypeDef *hcdc = (USBD_CCID_HandleTypeDef*) pdev->pClassData;
if((pdev->pUserData != NULL) && (hcdc->CmdOpCode != 0xFFU))
{
hcdc->CmdOpCode = 0xFFU;
}
// if((pdev->pUserData != NULL) && (hcdc->CmdOpCode != 0xFFU))
// {
// hcdc->CmdOpCode = 0xFFU;
// }
return USBD_OK;
}

View File

@ -38,4 +38,6 @@ typedef struct
}
USBD_CCID_HandleTypeDef;
uint8_t usb_ccid_recieve_callback(USBD_HandleTypeDef *pdev, uint8_t epnum);
#endif

View File

@ -119,9 +119,12 @@ void HAL_PCD_DataOutStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
USBD_LL_DataOutStage((USBD_HandleTypeDef*)hpcd->pData, epnum, hpcd->OUT_ep[epnum].xfer_buff);
switch(epnum)
{
case HID_ENDPOINT:
case HID_EPOUT_ADDR:
usb_hid_recieve_callback(epnum);
break;
case CCID_OUT_EP:
usb_ccid_recieve_callback((USBD_HandleTypeDef*)hpcd->pData, epnum);
break;
}
}