@@ -82,10 +82,10 @@ static uint8_t UserTxBufPtrWaitCount = 0; // used to implement a timeout waiting
8282static uint8_t UserTxNeedEmptyPacket = 0 ; // used to flush the USB IN endpoint if the last packet was exactly the endpoint packet size
8383
8484/* Private function prototypes -----------------------------------------------*/
85- static int8_t CDC_Itf_Init (void );
85+ static int8_t CDC_Itf_Init (USBD_HandleTypeDef * pdev );
8686static int8_t CDC_Itf_DeInit (void );
8787static int8_t CDC_Itf_Control (uint8_t cmd , uint8_t * pbuf , uint16_t length );
88- static int8_t CDC_Itf_Receive (uint8_t * pbuf , uint32_t * Len );
88+ static int8_t CDC_Itf_Receive (USBD_HandleTypeDef * pdev , uint8_t * pbuf , uint32_t * Len );
8989
9090const USBD_CDC_ItfTypeDef USBD_CDC_fops = {
9191 CDC_Itf_Init ,
@@ -102,7 +102,7 @@ const USBD_CDC_ItfTypeDef USBD_CDC_fops = {
102102 * @param None
103103 * @retval Result of the opeartion: USBD_OK if all operations are OK else USBD_FAIL
104104 */
105- static int8_t CDC_Itf_Init (void )
105+ static int8_t CDC_Itf_Init (USBD_HandleTypeDef * pdev )
106106{
107107#if 0
108108 /*##-1- Configure the UART peripheral ######################################*/
@@ -141,8 +141,8 @@ static int8_t CDC_Itf_Init(void)
141141#endif
142142
143143 /*##-5- Set Application Buffers ############################################*/
144- USBD_CDC_SetTxBuffer (& hUSBDDevice , UserTxBuffer , 0 );
145- USBD_CDC_SetRxBuffer (& hUSBDDevice , cdc_rx_packet_buf );
144+ USBD_CDC_SetTxBuffer (pdev , UserTxBuffer , 0 );
145+ USBD_CDC_SetRxBuffer (pdev , cdc_rx_packet_buf );
146146
147147 cdc_rx_buf_put = 0 ;
148148 cdc_rx_buf_get = 0 ;
@@ -317,7 +317,7 @@ void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd) {
317317 * @note The buffer we are passed here is just cdc_rx_packet_buf, so we are
318318 * free to modify it.
319319 */
320- static int8_t CDC_Itf_Receive (uint8_t * Buf , uint32_t * Len ) {
320+ static int8_t CDC_Itf_Receive (USBD_HandleTypeDef * pdev , uint8_t * Buf , uint32_t * Len ) {
321321#if 0
322322 // this sends the data over the UART using DMA
323323 HAL_UART_Transmit_DMA (& UartHandle , Buf , * Len );
@@ -339,8 +339,8 @@ static int8_t CDC_Itf_Receive(uint8_t* Buf, uint32_t *Len) {
339339 }
340340
341341 // initiate next USB packet transfer
342- USBD_CDC_SetRxBuffer (& hUSBDDevice , cdc_rx_packet_buf );
343- USBD_CDC_ReceivePacket (& hUSBDDevice );
342+ USBD_CDC_SetRxBuffer (pdev , cdc_rx_packet_buf );
343+ USBD_CDC_ReceivePacket (pdev );
344344
345345 return USBD_OK ;
346346}
0 commit comments