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.

LAUNCHXL-CC26X2R1: 设置UART读回调,但是没响应

Part Number: LAUNCHXL-CC26X2R1

UART读数据为回调方式,当串口输入数据时,并没有效果

//UART读取回调函数。修改灯状态
void uart_read_datdCB(UART2_Handle handle, void *buf, size_t count, void *userArg, int_fast16_t status)
{
static int flag = 0;

flag = ~flag;
GPIO_write(CONFIG_GPIO_LED, flag);
}

//UART初始化

void uart_init2(void)
{
UART2_Params params;
UART2_Params_init(&params);
params.baudRate = 115200;
params.writeMode = UART2_Mode_BLOCKING;
params.readMode = UART2_Mode_CALLBACK;
params.readCallback = &uart_read_datdCB;

// Open the UART
uart = UART2_open(CONFIG_UART2_0_CONST, &params);
if (uart == NULL) {
// UART2_open() failed
while (1);
}

// Enable receiver, inhibit low power mode
UART2_rxEnable(uart);
uint8_t buffer_tmp[] = "UART2 init ok\r\n";
UART2_write(uart, buffer_tmp, sizeof(buffer_tmp), NULL);
}