【发布时间】:2020-11-21 08:08:42
【问题描述】:
我正在尝试编写一个名为 SerialSend 的函数,它会将环形缓冲区(名为 testbuff)的内容打印到我的控制台。这是我对 SerialSend 的定义。
void SerialSend (USInt* pusiBuffer, UDInt len, UDInt connectionId)
{
USART_WriteByte(DEMO_USART, testbuff[i]);
i++;
i %= DEMO_RING_BUFFER_SIZE;
}
调用时,SerialSend 打印 testbuff 中的第一个字符。如何让它打印缓冲区的其余内容?这是我调用 SerialSend 并且中断不起作用的 main 代码。
while(i<17)
{
SerialSend(testbuff, 17, 0) //Sends contents of testbuff to print in console
if (i==16)
{
break; //Break isn't working, probably because i never hits 16 due to the ring
}
}
【问题讨论】:
标签: while-loop console break uart