Malloc a new CDC Handle in init, to be freed in deinit
* @}
*/
-// TESTING WITH STATIC USB CDC
-static USBD_CDC_HandleTypeDef h_cdc_fs, h_cdc_hs;
-
-
/** @defgroup USBD_CDC_Private_FunctionPrototypes
* @{
*/
@@ -489,9 +485,6 @@ static uint8_t USBD_CDC_Init (USBD_HandleTypeDef *pdev, uint8_t cfgidx)
CDC_DATA_HS_OUT_PACKET_SIZE);
pdev->ep_out[CDC_OUT_EP & 0xFU].is_used = 1U;
-
- // Set pClassData
- pdev->pClassData = &h_cdc_hs;
}
else
{
@@ -506,15 +499,13 @@ static uint8_t USBD_CDC_Init (USBD_HandleTypeDef *pdev, uint8_t cfgidx)
CDC_DATA_FS_OUT_PACKET_SIZE);
pdev->ep_out[CDC_OUT_EP & 0xFU].is_used = 1U;
- // Set pClassData
- pdev->pClassData = &h_cdc_fs;
}
/* Open Command IN EP */
USBD_LL_OpenEP(pdev, CDC_CMD_EP, USBD_EP_TYPE_INTR, CDC_CMD_PACKET_SIZE);
pdev->ep_in[CDC_CMD_EP & 0xFU].is_used = 1U;
- // pdev->pClassData = USBD_malloc(sizeof (USBD_CDC_HandleTypeDef));
- // USBD_memset(pdev->pClassData, 0, sizeof(USBD_CDC_HandleTypeDef));
+ pdev->pClassData = USBD_malloc(sizeof(USBD_CDC_HandleTypeDef));
+ USBD_memset(pdev->pClassData, 0, sizeof(USBD_CDC_HandleTypeDef));
if(pdev->pClassData == NULL)
{
ret = 1U;
