I am trying to modify the usb to uart mode of the wireless serial app. I would like data received from the usb to be sent over the radio, but data received over the radio should be sent to uart. I am very familiar with programming, but I know very little about C language. I modified the two while loops in the function usbToUartService() in the C file for this app as follows:
void usbToUartService()
{
uint8 signals;
// Data
while(usbComRxAvailable() && radioComTxAvailable())
{
radioComTxSendByte(usbComRxReceiveByte());
}
while(uart1TxAvailable() && radioComRxAvailable())
{
uart1TxSendByte(radioComRxReceiveByte());
}
ioTxSignals(usbComRxControlSignals());
// Need to switch bits 0 and 1 so that DTR pairs up with DSR.
signals = ioRxSignals();
usbComTxControlSignals( ((signals & 1) ? 2 : 0) | ((signals & 2) ? 1 : 0));
// TODO: report framing, parity, and overrun errors to the USB host here
}
The two while loops are the only things I changed; the rest of the file that isn’t shown here is unchanged. I don’t understand the specifics of this code, so I just switched which functions are called in this mode of the app. Will this work, or do I need to change something else too? If this won’t work, does anyone know how to accomplish what I’m trying to do? If possible, I would still like to keep the other two serial modes unchanged so that I can run the app in automatic selection mode.