uint8_t getsUSBUSART( uint8_t * buffer, uint8_t len );
getsUSBUSART copies a string of BYTEs received through USB CDC Bulk OUT endpoint to a user's specified location. It is a non-blocking function. It does not wait for data if there is no data available. Instead it returns '0' to notify the caller that there is no data available.
Typical Usage:
uint8_t numBytes; uint8_t buffer[64] numBytes = getsUSBUSART(buffer,sizeof(buffer)); //until the buffer is free. if(numBytes > 0) { //we received numBytes bytes of data and they are copied into // the "buffer" variable. We can do something with the data // here. }
Value of input argument 'len' should be smaller than the maximum endpoint size responsible for receiving bulk data from USB host for CDC class. Input argument 'buffer' should point to a buffer area that is bigger or equal to the size specified by 'len'.
Parameters |
Description |
uint8_t * buffer |
Pointer to where received BYTEs are to be stored |
uint8_t len |
The number of BYTEs expected. |
uint8_t - Returns a byte indicating the total number of bytes that were actually received and copied into the specified buffer. The returned value can be anything from 0 up to the len input value. A return value of 0 indicates that no new CDC bulk OUT endpoint data was available.
MLA - USB Library Help Version : 2.16
![]() |