Functions used by the application to drive the USB CDC class.
More...
Functions used by the application to drive the USB CDC class.
◆ 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
-
- Returns
- USBD_OK on success, USBD_FAIL if the class instance is not allocated.
◆ USBD_CDC_RegisterInterface()
Register the application callbacks for the CDC class.
- Parameters
-
| pdev | device instance. |
| fops | pointer 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
-
| pdev | device instance. |
| pbuff | pointer 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
-
| pdev | device instance. |
| pbuff | pointer to the Tx buffer. |
| length | length of the data to send, in bytes. |
| ClassId | class 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
-
| pdev | device instance. |
| ClassId | class 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.