|
|
@ -92,9 +92,37 @@ static int check_RS485_2(char *_pBuffer, uint32_t _iSize) |
|
|
return _iSize; |
|
|
return _iSize; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Myprint_Init(void) |
|
|
|
|
|
{ |
|
|
|
|
|
TUartUserData *ptUartUserData = UART_userdata_init(1, 115200, 4096); |
|
|
|
|
|
g_ptRS485_2 = rd_ComCreate(NULL, NULL, RS485_2_Send, ptUartUserData->m_buf_size, ptUartUserData); |
|
|
|
|
|
UART_IT_init(g_ptRS485_2); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int Myprint_putchar(uint8_t ch) |
|
|
|
|
|
{ |
|
|
|
|
|
char tx_buf[2]; |
|
|
|
|
|
|
|
|
|
|
|
if (ch == '\n') |
|
|
|
|
|
{ |
|
|
|
|
|
// 遇到换行,发送 \r\n
|
|
|
|
|
|
tx_buf[0] = '\r'; |
|
|
|
|
|
tx_buf[1] = '\n'; |
|
|
|
|
|
if (rd_ComSend(g_ptRS485_2, tx_buf, 2) < 0) return EOF; |
|
|
|
|
|
return 2; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
// 普通字符
|
|
|
|
|
|
tx_buf[0] = ch; |
|
|
|
|
|
if (rd_ComSend(g_ptRS485_2, tx_buf, 1) < 0) return EOF; |
|
|
|
|
|
return 1; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void SpoolendInit(void) |
|
|
void SpoolendInit(void) |
|
|
{ |
|
|
{ |
|
|
TUartUserData *ptUartUserData = UART_userdata_init(0, -1, 512); |
|
|
TUartUserData *ptUartUserData = UART_userdata_init(0, 115200, 512); |
|
|
g_ptRS485_1 = rd_ComCreate(check_RS485_1, NULL, RS485_1_Send, ptUartUserData->m_buf_size, ptUartUserData); |
|
|
g_ptRS485_1 = rd_ComCreate(check_RS485_1, NULL, RS485_1_Send, ptUartUserData->m_buf_size, ptUartUserData); |
|
|
UART_IT_init(g_ptRS485_1); |
|
|
UART_IT_init(g_ptRS485_1); |
|
|
// TUartUserData *ptUartUserData1 = UART_userdata_init(0, 115200, 512);
|
|
|
// TUartUserData *ptUartUserData1 = UART_userdata_init(0, 115200, 512);
|
|
|
|