static uint8_t* cur_p_buf = NULL;
static uint8_t* last_p_buf = NULL;
SwapPingPongBuf(Uart0_Rx_Buf, Uart0_Rx_Buf1, &cur_p_buf, &last_p_buf);
void SwapPingPongBuf(uint8_t* buf0, uint8_t* buf1, uint8_t** cur_buf, uint8_t** last_buf)
{
if ((*cur_buf == NULL) && (*last_buf == NULL))
{
*cur_buf = buf0;
*last_buf = buf0;
//printf("!!!!!null!!!!!");
}
else if (*last_buf == buf0)
{
*cur_buf = buf1;
//printf("buf1!!!!!");
}
else if (*last_buf == buf1)
{
*cur_buf = buf0;
//printf("buf0!!!!!");
}
else
{
*cur_buf = buf0;
//printf("buf0!!!!!");
GTK_LOG_ERR(GTK_DBG_APP_SYS, "%s", __FUNCTION__);
}
}
想要即当输入又当输出,必须穿进去地址。