/********************************************************************
* Function: void ProcessIO(void)
* Overview: This function is a place holder for other user
* routines. It is a mixture of both USB and
* non-USB tasks.
*******************************************************************/
void ProcessIO(void)
{
BYTE numBytesRead;
// User Application USB tasks
if((USBDeviceState < CONFIGURED_STATE)||(USBSuspendControl==1)) return;
if (USBUSARTIsTxTrfReady())
{
numBytesRead = getsUSBUSART(USB_Out_Buffer, 64);
if (numBytesRead != 0)
{
if (USB_Out_Buffer[0] == '\r') //Received ENTER? Ues-> End of Command
{
command_recvd = 0x01;
Command[pos++] = '\0';
putUSBUSART((char*) USB_Out_Buffer, 1);
pos = 0;
} else { Command[pos++] = USB_Out_Buffer[0]; Command[pos]='\0';} //No:- Store Character to String
if (command_recvd == 0x01)
{
if (strcmp((char*) Command, (char*) "Command 1") == 0)
{
// COMMAND CODE HERE
}
else
{
InvalidCommand = 0x01;
}
Command[0]='\0';
if (InvalidCommand ==0x00) { sprintf(output_message, "\r\nCommand Sent...!!!!\r\n");} else {
InvalidCommand=0x00;
sprintf(output_message, "\r\nInvalid Command..!!\r\n");}
putUSBUSART((char*) output_message, sizeof (output_message));
command_recvd = 0x00;
}
}
}
CDCTxService();
}