UART_Params_init(¶ms);
params.baudRate = 9600;
params.writeDataMode = UART_DATA_BINARY;
params.readMode = UART_MODE_CALLBACK;
params.readDataMode = UART_DATA_BINARY;
params.readCallback = readCallback;
// Open the UART and initiate the first read
handle = UART_open(Board_UART, ¶ms);
static void readCallback(UART_Handle handle, void *rxBuf, size_t size)
{
UART_write(handle, "Uart is receiving", 20);
// Copy bytes from RX buffer to TX buffer
for(size_t i = 0; i < size; i++)
txBuf[i] = ((uint8_t*)rxBuf)[i];
// Echo the bytes received back to transmitter
UART_write(handle, txBuf, size);
// Start another read, with size the same as it was during first call to
// UART_read()
UART_read(handle, rxBuf, wantedRxBytes);
}
代码如上,请问该如何修改? 请TI的工程师帮忙介绍下串口添加的说明。pdf里面只是简单描述了开启串口的步骤。