|
To make my question even simpler, what I need to change in the following USBUART example code in order to do what I asked above:
/* Start USBFS Operation with 3V operation */
USBUART_1_Start(0, USBUART_1_3V_OPERATION);
/* Wait for Device to enumerate */
while(!USBUART_1_GetConfiguration());
/* Enumeration is done, enable OUT endpoint for receive data from Host */
USBUART_1_CDC_Init();
for(;;)
{
if(USBUART_1_DataIsReady() != 0u) /* Check for input data from PC */
{
count = USBUART_1_GetAll(buffer); /* Read received data and re-enable OUT endpoint */
if(count != 0u)
{
while(USBUART_1_CDCIsReady() == 0u); /* Wait till component is ready to send more data to the PC */
USBUART_1_PutData(buffer, count); /* Send data back to PC */
}
}
state = USBUART_1_IsLineChanged(); /* Check for Line settings changed */
if(state != 0u)
{
if(state & USBUART_1_LINE_CODING_CHANGED) /* Show new settings */
{
sprintf(lineStr,"BR:%4ld,DB:%d",USBUART_1_GetDTERate(),(uint16)USBUART_1_GetDataBits());
//LCD_Position(0,0);
//LCD_PrintString(" ");
//LCD_Position(0,0);
//LCD_PrintString(lineStr);
//sprintf(lineStr,"SB:%s,Parity:%s", stop[(uint16)USBUART_1_GetCharFormat()], \
// parity[(uint16)USBUART_1_GetParityType()]);
//LCD_Position(1,0);
//LCD_PrintString(" ");
//LCD_Position(1,0);
//LCD_PrintString(lineStr);
}
if(state & USBUART_1_LINE_CONTROL_CHANGED) /* Show new settings */
{
state = USBUART_1_GetLineControl();
sprintf(lineStr,"DTR:%s,RTS:%s", (state & USBUART_1_LINE_CONTROL_DTR) ? "ON" : "OFF", \
(state & USBUART_1_LINE_CONTROL_RTS) ? "ON" : "OFF");
//LCD_Position(1,0);
//LCD_PrintString(" ");
//LCD_Position(1,0);
//LCD_PrintString(lineStr);
}
}
}
Thanks,
Michael H.
|