已经完成了网络,DI口,RS485的数据透传,可通过RS485接收数据

This commit is contained in:
2026-05-06 10:55:55 +08:00
parent 0eea5c1424
commit 61530dccec
258 changed files with 40311 additions and 4851 deletions

View File

@ -21,7 +21,7 @@
#include "usart.h"
#include <string.h>
#include <stdio.h>
#include "multi_uart_router.h"
/*==============================================================================
* 调试宏定义
*============================================================================*/
@ -460,50 +460,26 @@ uint16_t UART2_Print_GetOverflowCount(void)
#if defined(__CC_ARM) || defined(__ARMCC_VERSION)
int fputc(int ch, FILE *f)
{
(void)f; /* 未使用参数,避免编译器警告 */
(void)f;
UART2_Print_Send((uint8_t *)&ch, 1);
MultiUART_Send(PORT_UART3, (uint8_t *)&ch, 1); /* 增加:同时发给 UART3 */
return ch;
}
#endif
/**
* @brief printf重定向函数 (GCC编译器 - 单字符版本)
* @note 将标准库printf输出重定向到UART2
*
* @param ch: 待发送字符(输入)
* @return int: 发送的字符
*
* 编译器条件编译:
* 此函数仅在__GNUC__定义时编译即GCC/Clang编译器环境下生效
*
* 实现说明:
* 新一代ARM GCC使用__io_putchar作为printf输出目标
* 此处将其重定向到UART2_Print_Send
*/
#if defined(__GNUC__)
int __io_putchar(int ch)
{
UART2_Print_Send((uint8_t *)&ch, 1);
MultiUART_Send(PORT_UART3, (uint8_t *)&ch, 1); /* 增加:同时发给 UART3 */
return ch;
}
/**
* @brief write系统调用重定向 (GCC编译器)
* @note 将文件系统write调用重定向到UART2
*
* @param file: 文件描述符(未使用,仅为兼容标准接口)
* @param ptr: 数据缓冲区指针(输入)
* @param len: 数据长度(输入)
* @return int: 已发送的字节数
*
* 实现说明:
* 有些GCC配置下printf会调用_write而非__io_putchar
* 此函数提供完整的write接口兼容
*/
int _write(int file, char *ptr, int len)
{
(void)file; /* 忽略文件描述符,只处理标准输出 */
(void)file;
UART2_Print_Send((uint8_t *)ptr, len);
MultiUART_Send(PORT_UART3, (uint8_t *)ptr, len); /* 增加:同时发给 UART3 */
return len;
}
#endif
#endif