<p><iframe name="ifd" src="https://mnifdv.cn/resource/cnblogs/ESP32_CAN" frameborder="0" scrolling="auto" width="100%" height="1500"></iframe></p>
xRingbufferSend(RingbufHandleTxUart1, data, len, pdMS_TO_TICKS(2));
xTaskNotifyGive(TaskHandleTransmitUart1);//发送通知
//接收的数据发送到TCP服务器
tcpClientTransmit_t* tcpClientTransmit = (tcpClientTransmit_t*)malloc(sizeof(tcpClientTransmit_t));
if(tcpClientTransmit != NULL )
{
uint8_t *p_data = (uint8_t *) malloc(len);//待发送数据的个数
memcpy(p_data, uart1_struct.ring_buf_copy, len);//取8字节CAN数据
tcpClientTransmit->p_data = p_data;
tcpClientTransmit->data_len = len;//发送数据的个数
tcpClientTransmit->tcpClient = &tcpClient[0];//使用哪个客户端发送
/*把消息发送到消息队列*/
if (xQueueSend(QueueHandleTcpClientTransmit, &tcpClientTransmit, pdMS_TO_TICKS(10)) != pdPASS)
{
free(tcpClientTransmit);
free(p_data);
}
}
.