All pastes #382404 Raw Edit

Someone

public cpp v1 · immutable
·published 2007-03-05 16:39 UTC
rendered paste body
// recieve data from moduleint USBIO::comms_recieve(unsigned char *input){    unsigned char no_of_data_bytes   = 0;    unsigned char command            = 0;    unsigned char temp [512];		usbio.ReadBuffer(temp,1);        if (temp[0]!='@') return(FALSE);	    usbio.ReadBuffer(&no_of_data_bytes,1);    usbio.ReadBuffer(&command,1);      int num_bytes = usbio.ReadBuffer(temp,no_of_data_bytes);    if (num_bytes != no_of_data_bytes ) return(FALSE);    // read data	for (int i=0;i<no_of_data_bytes;i++) input[i]=temp[i];    temp[0]=0;    usbio.ReadBuffer(temp,1);  	    if (temp[0]!='*') return(FALSE);    return(command);}