USBD_Write
Default mainpageat91libusbdevicecoreUSBD_Write
Description Source Call Graph
USBD_Write
Sends data through a USB endpoint.
 
Syntax / parameters
char USBD_Write (unsigned char bEndpoint, const void *pData, unsigned int size, TransferCallback callback, void *pArg)

Name Type Default Description
bEndpoint unsigned char
  Endpoint number.
pData const void *
  Pointer to a buffer with the data to send.
dLength unsigned int
  Size of the data buffer.
fCallback TransferCallback
  Optional callback function to invoke when the transfer is complete.
pArgument void *
  Optional argument to the callback function.
 
Return value char
  USBD_STATUS_SUCCESS if the transfer has been started; otherwise, the corresponding error status code.
Description
Sends data through a USB endpoint.
Sets up the transfer descriptor, writes one or two data payloads (depending on the number of FIFO bank for the endpoint) and then starts the actual transfer. The operation is complete when all the data has been sent.

If the size of the buffer is greater than the size of the endpoint (or twice the size if the endpoint has two FIFO banks), then the buffer must be kept allocated until the transfer is finished*. This means that it is not possible to declare it on the stack (i.e. as a local variable of a function which returns after starting a transfer).
 
Source
The documentation for this Member was generated from the following file:
  • USBD_UDP.c