tUsartSendData usSendData;
tUsartReceiveData usRecvData;
portCHAR textBuffer[100];
/*Prepare to send messages*/
usSendData.port = serCOM2;
usSendData.size = nullTerminatedMax(100); //Null termination limit
usSendData.xBlockTime = 200;
/*Prepare to receive a message*/
usRecvData.port = usSendData.port; //Same as send
usRecvData.size = nullTerminatedMax(100); //Null termination limit
usRecvData.data = (unsigned portCHAR *) textBuffer;
usRecvData.xBlockTime = portMAX_DELAY; //Wait forever a replay
while (1)
{
/*Receive message*/
cUSartReceive(&usRecvData);
/*Replay with the same message using the usart*/
usSendData.data = "You sent \"";
cUSartSend(&usSendData);
usSendData.data = (unsigned portCHAR *) textBuffer;
cUSartSend(&usSendData);
usSendData.data = "\"\n\r";
cUSartSend(&usSendData);
}