1
µTasker general / Re: Different UARTs for send and recieve
« on: April 28, 2008, 02:49:13 PM »
Thanks for the reply Mark, that is what I figured....
I've done the following:
1) Made global variables for the interface parameters:
2) Modified fnSetNewSerialMode to set up the appropriate channel based on the additional param:
It may not be the cleanest approach, but it's working for me....
I've done the following:
1) Made global variables for the interface parameters:
Code: [Select]
TTYTABLE tInterfaceParametersIn;
TTYTABLE tInterfaceParametersOut;
2) Modified fnSetNewSerialMode to set up the appropriate channel based on the additional param:
Code: [Select]
#ifdef SERIAL_INTERFACE
// After changes, we set up the new serial configuration
//
extern QUEUE_HANDLE fnSetNewSerialMode(unsigned char ucDriverMode, unsigned int uiUartChannel)
{
//TTYTABLE tInterfaceParameters; // table for passing information to driver
//Jesse //tInterfaceParameters.Channel = DEMO_UART; // set UART channel for serial use
if(uiUartChannel == 1)
{
tInterfaceParametersIn.Channel = uiUartChannel; // set UART channel for serial use
tInterfaceParametersIn.ucSpeed = temp_pars->temp_parameters.ucSerialSpeed; // baud rate
tInterfaceParametersIn.Rx_tx_sizes.RxQueueSize = RX_BUFFER_SIZE; // input buffer size
tInterfaceParametersIn.Rx_tx_sizes.TxQueueSize = TX_BUFFER_SIZE; // output buffer size
tInterfaceParametersIn.Task_to_wake = OWN_TASK; // wake self when messages have been received
#ifdef SUPPORT_FLOW_HIGH_LOW
tInterfaceParametersIn.ucFlowHighWater = temp_pars->temp_parameters.ucFlowHigh;// set the flow control high and low water levels in %
tInterfaceParametersIn.ucFlowLowWater = temp_pars->temp_parameters.ucFlowLow;
#endif
tInterfaceParametersIn.usConfig = temp_pars->temp_parameters.usSerialMode;
#ifdef TEST_MSG_MODE
tInterfaceParametersIn.usConfig |= (MSG_MODE);
#if defined (TEST_MSG_CNT_MODE) && defined (SUPPORT_MSG_CNT)
tInterfaceParametersIn.usConfig |= (MSG_MODE_RX_CNT);
#endif
tInterfaceParametersIn.usConfig &= ~USE_XON_OFF;
tInterfaceParametersIn.ucMessageTerminator = '\r';
#endif
#ifdef SERIAL_SUPPORT_DMA
tInterfaceParametersIn.ucDMAConfig = UART_TX_DMA; // activate DMA on transmission
#endif
if (SerialPortIDIn = fnOpen( TYPE_TTY, ucDriverMode, &tInterfaceParametersIn )) { // open or change the channel with defined configurations (initially inactive)
fnDriver( SerialPortIDIn, ( RX_ON ), 0 ); // enable rx and tx
}
return SerialPortIDIn;
}
else if( uiUartChannel == 0 )
{
tInterfaceParametersOut.Channel = uiUartChannel; // set UART channel for serial use
tInterfaceParametersOut.ucSpeed = temp_pars->temp_parameters.ucSerialSpeed; // baud rate
tInterfaceParametersOut.Rx_tx_sizes.RxQueueSize = RX_BUFFER_SIZE; // input buffer size
tInterfaceParametersOut.Rx_tx_sizes.TxQueueSize = TX_BUFFER_SIZE; // output buffer size
tInterfaceParametersOut.Task_to_wake = OWN_TASK; // wake self when messages have been received
#ifdef SUPPORT_FLOW_HIGH_LOW
tInterfaceParametersOut.ucFlowHighWater = temp_pars->temp_parameters.ucFlowHigh;// set the flow control high and low water levels in %
tInterfaceParametersOut.ucFlowLowWater = temp_pars->temp_parameters.ucFlowLow;
#endif
tInterfaceParametersOut.usConfig = temp_pars->temp_parameters.usSerialMode;
#ifdef TEST_MSG_MODE
tInterfaceParametersOut.usConfig |= (MSG_MODE);
#if defined (TEST_MSG_CNT_MODE) && defined (SUPPORT_MSG_CNT)
tInterfaceParametersOut.usConfig |= (MSG_MODE_RX_CNT);
#endif
tInterfaceParametersOut.usConfig &= ~USE_XON_OFF;
tInterfaceParametersOut.ucMessageTerminator = '\r';
#endif
#ifdef SERIAL_SUPPORT_DMA
tInterfaceParametersOut.ucDMAConfig = UART_TX_DMA; // activate DMA on transmission
#endif
if (SerialPortIDOut = fnOpen( TYPE_TTY, ucDriverMode, &tInterfaceParametersOut )) { // open or change the channel with defined configurations (initially inactive)
fnDriver( SerialPortIDOut, ( TX_ON ), 0 ); // enable rx and tx
}
return SerialPortIDOut;
}
}
#endif
It may not be the cleanest approach, but it's working for me....