getsUSBUSART Function

Microchip USB Device Library

USB Device Library Help
getsUSBUSART Function
C
BYTE getsUSBUSART(
    char * buffer, 
    BYTE len
);
Description

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:

    BYTE numBytes;
    BYTE 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.
    }
Preconditions

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
Parameters 
Description 
buffer 
Pointer to where received BYTEs are to be stored 
len 
The number of BYTEs expected. 
Microchip MCHPFSUSB v2.3 - Sept 20, 2008
Copyright © 2008 Microchip Technology, Inc.  All rights reserved.