case DEMO_MSG_UART_RECEIVE_DATA:
{
rx_len = uart->rx_data_len;
while (rx_len > 0)
{
printf("\n----1 rx_len----%d", rx_len);
len = (rx_len > DEMO_UART_RX_BUF_SIZE) ? DEMO_UART_RX_BUF_SIZE : rx_len;
printf("\n----2 len----%d", len);
memset(uart->rx_buf, 0, (DEMO_UART_RX_BUF_SIZE + 1));
tls_uart_read(TLS_UART_1, msg_rxfifo_buf, len);
tls_uart_read(TLS_UART_1, rx_fifo_buf1[0], len);
printf("\n----#### msg_rxfifo_buf----%s\n", msg_rxfifo_buf);
printf("\n----#### rx_fifo_buf1[0]----%s\n", rx_fifo_buf1[0]);
ret = tls_uart_read(TLS_UART_1, (u8 *)uart->rx_buf, len);
ret = tls_uart_read(TLS_UART_1, (u8 *)uart->rx_buf, len); /* input */
printf("\n----#### DEMO_MSG_UART_RECEIVE_DATA----%s\n", uart->rx_buf);
printf("\n----3 ret----%d", ret);
if (ret <= 0)
{
break;
}
rx_len -= ret;
uart->rx_data_len -= ret;
if USE_DMA_TX_FTR
// tls_uart_dma_write(uart->rx_buf, len, uart_dma_done, TLS_UART_1);
else
tls_uart_write(TLS_UART_1, uart->rx_buf, len); /* output */
printf("\n----4 DEMO_MSG_UART_RECEIVE_DATA uart->rx_buf----%s\n", uart->rx_buf);
endif
}
printf("\n----5 DEMO_MSG_UART_RECEIVE_DATA uart->rx_msg_num----%s\n", uart->rx_msg_num);
if (uart->rx_msg_num > 0)
{
uart->rx_msg_num--;
}
printf("\n----6 DEMO_MSG_UART_RECEIVE_DATA----%s\n", uart->rx_buf);
}
break;
代碼用的是開發板自帶的wm_uart_demo.c
我修改了下,運行得不到發送過來的1234
問 neptune開發板w800的UART1可以用tls_uart_write發送數據,但是怎麼用tls_uart_read獲取串口發送過來的數據?