Other Parts Discussed in Thread: CC2640
spi以及uart的中断程序在cc2640例程的那个地方?、
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
更多信息您可以查看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_BYTES 1000 // Maximum RX bytes to receive in one go
#define MAX_NUM_TX_BYTES 1000 // 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 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);
}
static void taskFxn(UArg a0, UArg a1)
{
UART_Handle handle;
UART_Params params;
// Init UART and specify non-default parameters
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);
wantedRxBytes = 16;
int rxBytes = UART_read(handle, rxBuf, wantedRxBytes);
while(true); // Wait forever
}