代码暂存 使用环形缓冲区机制轮询打印日志信息
This commit is contained in:
parent
b76977326a
commit
2f38a342f3
|
@ -59,6 +59,7 @@ void Main_Circulation()
|
|||
TMOS_SystemProcess();
|
||||
KEY_ProcessLoop();
|
||||
MultiTimerYield();
|
||||
BSP_UART3_TxLoop();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ void BSP_UART3_Init(void);
|
|||
unsigned int BSP_Uart3_Receive_Data(void *buf, unsigned int len);
|
||||
unsigned int BSP_Uart3_Send_Data(const void *buf, unsigned int len);
|
||||
void BSP_Shell_Loop(void);
|
||||
void BSP_UART3_TxLoop(void);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -519,7 +519,7 @@ static int BSP_Module_Connect_CtWing_Handle(at_env_t *e)
|
|||
{
|
||||
case 0:
|
||||
logDebug("create device...\r\n");
|
||||
e->println(e, "AT+MIPOPEN=0,\"TCP\",\"112.125.89.8\",44679,,1"); // 8.135.10.183,32994
|
||||
e->println(e, "AT+MIPOPEN=0,\"TCP\",\"112.125.89.8\",47766,,1"); // 8.135.10.183,32994
|
||||
e->reset_timer(e);
|
||||
e->state++;
|
||||
break;
|
||||
|
|
|
@ -55,9 +55,36 @@ unsigned int BSP_Uart3_Send_Data(const void *buf, unsigned int len)
|
|||
unsigned int ret;
|
||||
|
||||
ret = lwrb_write(&uart3_tx_t, buf, len);
|
||||
UART3_INTCfg(ENABLE, RB_IER_THR_EMPTY);
|
||||
// UART3_INTCfg(ENABLE, RB_IER_THR_EMPTY);
|
||||
// BSP_BlockSleep();
|
||||
BSP_UART3_TxLoop();
|
||||
// BSP_RequestSleep();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
// https://www.cnblogs.com/iot-fan/p/13439293.html
|
||||
// tx process
|
||||
// 本查询函数需要扔到主循环不断调用
|
||||
void BSP_UART3_TxLoop(void)
|
||||
{
|
||||
uint8_t data;
|
||||
while (R8_UART3_TFC < UART_FIFO_SIZE)
|
||||
{
|
||||
// 判断发送软件缓冲区,是否空,如果不空,就一个一个读出来,填到硬件fifo里
|
||||
if (lwrb_get_full(&uart3_tx_t))
|
||||
{
|
||||
lwrb_read(&uart3_tx_t, &data, 1);
|
||||
// 把软件缓冲区的数据填到uart的硬件发送fifo里
|
||||
UART3_SendByte(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Buffer event function
|
||||
*/
|
||||
|
@ -255,15 +282,15 @@ void UART3_IRQHandler(void)
|
|||
}
|
||||
break;
|
||||
case UART_II_THR_EMPTY: // 发送缓存区空,可继续发送
|
||||
if(lwrb_get_full(&uart3_tx_t))
|
||||
{
|
||||
lwrb_read(&uart3_tx_t, &data, 1);
|
||||
UART3_SendByte(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
UART3_INTCfg(DISABLE, RB_IER_THR_EMPTY);
|
||||
}
|
||||
// if(lwrb_get_full(&uart3_tx_t))
|
||||
// {
|
||||
// lwrb_read(&uart3_tx_t, &data, 1);
|
||||
// UART3_SendByte(data);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// UART3_INTCfg(DISABLE, RB_IER_THR_EMPTY);
|
||||
// }
|
||||
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue