STM32 core 3.0.1-dev
Arduino core for STM32 based boards: API reference
← STM32duino documentation
Loading...
Searching...
No Matches
USBD CDC Exported Functions

Functions used by the application to drive the USB CDC class. More...

Functions

uint8_t USBD_CDC_RegisterInterface (USBD_HandleTypeDef *pdev, USBD_CDC_ItfTypeDef *fops)
 Register the application callbacks for the CDC class.
 
uint8_t USBD_CDC_SetTxBuffer (USBD_HandleTypeDef *pdev, uint8_t *pbuff, uint32_t length)
 Set the buffer and length of the next data to send on the CDC IN endpoint.
 
uint8_t USBD_CDC_SetRxBuffer (USBD_HandleTypeDef *pdev, uint8_t *pbuff)
 Set the Rx buffer used for the next packet received on the CDC OUT endpoint.
 
uint8_t USBD_CDC_TransmitPacket (USBD_HandleTypeDef *pdev)
 Transmit the buffer set by USBD_CDC_SetTxBuffer() on the CDC IN endpoint.
 
uint8_t USBD_CDC_ReceivePacket (USBD_HandleTypeDef *pdev)
 Prepare the CDC OUT endpoint to receive the next packet into the Rx buffer.
 

Detailed Description

Functions used by the application to drive the USB CDC class.

Function Documentation

◆ USBD_CDC_ReceivePacket()

uint8_t USBD_CDC_ReceivePacket ( USBD_HandleTypeDef *  pdev)

Prepare the CDC OUT endpoint to receive the next packet into the Rx buffer.

Parameters
pdevdevice instance.
Returns
USBD_OK on success, USBD_FAIL if the class instance is not allocated.

◆ USBD_CDC_RegisterInterface()

uint8_t USBD_CDC_RegisterInterface ( USBD_HandleTypeDef *  pdev,
USBD_CDC_ItfTypeDef *  fops 
)

Register the application callbacks for the CDC class.

Parameters
pdevdevice instance.
fopspointer to the CDC interface callbacks.
Returns
USBD_OK on success, USBD_FAIL if fops is NULL.

◆ USBD_CDC_SetRxBuffer()

uint8_t USBD_CDC_SetRxBuffer ( USBD_HandleTypeDef *  pdev,
uint8_t *  pbuff 
)

Set the Rx buffer used for the next packet received on the CDC OUT endpoint.

Parameters
pdevdevice instance.
pbuffpointer to the Rx buffer.
Returns
USBD_OK on success, USBD_FAIL if the class instance is not allocated.

◆ USBD_CDC_SetTxBuffer()

uint8_t USBD_CDC_SetTxBuffer ( USBD_HandleTypeDef *  pdev,
uint8_t *  pbuff,
uint32_t  length 
)

Set the buffer and length of the next data to send on the CDC IN endpoint.

Note
Does not start the transfer, call USBD_CDC_TransmitPacket() for that.
Parameters
pdevdevice instance.
pbuffpointer to the Tx buffer.
lengthlength of the data to send, in bytes.
ClassIdclass ID, used only when USE_USBD_COMPOSITE is defined.
Returns
USBD_OK on success, USBD_FAIL if the class instance is not allocated.

◆ USBD_CDC_TransmitPacket()

uint8_t USBD_CDC_TransmitPacket ( USBD_HandleTypeDef *  pdev)

Transmit the buffer set by USBD_CDC_SetTxBuffer() on the CDC IN endpoint.

Note
Does nothing if a transfer is already in progress.
Parameters
pdevdevice instance.
ClassIdclass ID, used only when USE_USBD_COMPOSITE is defined.
Returns
USBD_OK if the transfer was started, USBD_BUSY if a transfer is in progress, USBD_FAIL if the class instance is not allocated.