|
|
|
@ -34,9 +34,9 @@ int USART_Send(char *_pBuffer, uint32_t _iSize) |
|
|
|
{ |
|
|
|
HAL_GPIO_WritePin(RS485_2_DIR_GPIO_Port, RS485_2_DIR_Pin,GPIO_PIN_SET); |
|
|
|
TUartUserData *ptUartUserData = (TUartUserData *)g_ptUartCtrl->m_pUserData; |
|
|
|
// int iRet = HAL_UART_Transmit(ptUartUserData->m_uart, (uint8_t *)_pBuffer, _iSize, 100);
|
|
|
|
// HAL_GPIO_WritePin(RS485_2_DIR_GPIO_Port, RS485_2_DIR_Pin,GPIO_PIN_RESET);
|
|
|
|
int iRet = HAL_UART_Transmit_DMA(ptUartUserData->m_uart, (uint8_t *)_pBuffer, _iSize); |
|
|
|
int iRet = HAL_UART_Transmit(ptUartUserData->m_uart, (uint8_t *)_pBuffer, _iSize, 100); |
|
|
|
HAL_GPIO_WritePin(RS485_2_DIR_GPIO_Port, RS485_2_DIR_Pin,GPIO_PIN_RESET); |
|
|
|
// int iRet = HAL_UART_Transmit_DMA(ptUartUserData->m_uart, (uint8_t *)_pBuffer, _iSize);
|
|
|
|
|
|
|
|
return iRet; |
|
|
|
} |
|
|
|
@ -189,14 +189,14 @@ WEAK int Myprint_putchar(uint8_t ch) |
|
|
|
// 遇到换行,发送 \r\n
|
|
|
|
tx_buf[0] = '\r'; |
|
|
|
tx_buf[1] = '\n'; |
|
|
|
if (rd_ComWrite(g_ptUartCtrl, tx_buf, 2) < 0) return EOF; |
|
|
|
if (rd_ComSend(g_ptUartCtrl, tx_buf, 2) < 0) return EOF; |
|
|
|
return 2; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
// 普通字符
|
|
|
|
tx_buf[0] = ch; |
|
|
|
if (rd_ComWrite(g_ptUartCtrl, tx_buf, 1) < 0) return EOF; |
|
|
|
if (rd_ComSend(g_ptUartCtrl, tx_buf, 1) < 0) return EOF; |
|
|
|
return 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|