TI中文支持网
TI专业的中文技术问题搜集分享网站

cc2640例程 中串口程序问题

spi以及uart的中断程序在cc2640例程的那个地方?、

Susan Yang:

更多信息您可以查看tirtos_cc13xx_cc26xx安装文件夹内的

/tirtos_cc13xx_cc26xx_2_21_01_08/products/tidrivers_cc13xx_cc26xx_2_21_01_01/docs/doxygen/html/_u_a_r_t_c_c26_x_x_8h.html

#define MAX_NUM_RX_BYTES1000// Maximum RX bytes to receive in one go
#define MAX_NUM_TX_BYTES1000// Maximum TX bytes to send in one go
uint32_t wantedRxBytes;// Number of bytes received so far
uint8_t rxBuf[MAX_NUM_RX_BYTES];// Receive buffer
uint8_t txBuf[MAX_NUM_TX_BYTES];// Transmit buffer
// Callback function
static void readCallback(UART_Handle handle, void *rxBuf, size_t size)
{// Copy bytes from RX buffer to TX bufferfor(size_t i = 0; i < size; i++)txBuf[i] = ((uint8_t*)rxBuf)[i];// Echo the bytes received back to transmitterUART_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);
}
static void taskFxn(UArg a0, UArg a1)
{UART_Handle handle;UART_Params params;// Init UART and specify non-default parametersUART_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 readhandle = UART_open(Board_UART, &params);wantedRxBytes = 16;int rxBytes = UART_read(handle, rxBuf, wantedRxBytes);while(true); // Wait forever
}

user6123782:

回复 Susan Yang:

好的哦感谢你的回答

Susan Yang:

回复 user6123782:

很高兴能帮到您

user6123782:

回复 Susan Yang:

再问一下这个中断是怎么产生的呢

Susan Yang:

回复 user6123782:

您需要在SimpleBLEPeripheral_init(void)中调用注册初始化函数,如:

Uart_Init(UartCallBack);// 收到串口数据时将执行 UartCallBack 函数

当串口收到数据后就会执行callback

网上有些中文版的教程,您可以先实验一下

blog.csdn.net/…/78188703

user6123782:

回复 Susan Yang:

好的谢谢

user6123782:

回复 Susan Yang:

好的谢谢

赞(0)
未经允许不得转载:TI中文支持网 » cc2640例程 中串口程序问题
分享到: 更多 (0)