Quantcast
Channel: 蓝牙论坛 - 最近的话题
Viewing all articles
Browse latest Browse all 7485

CC2650 simpleBLEPeripheral工程下添加串口处理(非NPI),写好串口初始化以及接收回调,但无法进入接收回调处理函数。

$
0
0

UART_Params_init(&params);
     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, &params);

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里面只是简单描述了开启串口的步骤。


Viewing all articles
Browse latest Browse all 7485

Trending Articles