#include <stdarg.h>
int u_printf(const char *format, ...)
{
char loc_buf[256];
va_list arg;
va_list copy;
va_start(arg, format);
va_copy(copy, arg);
int len = vsnprintf(loc_buf, sizeof(loc_buf), format, copy);
va_end(copy);
va_end(arg);

if (len > 0 && len <= 256)
{
HAL_UART_Transmit(&huart1, (uint8_t *)loc_buf, len, 0xFF);
}
return len;
}

Posted on 2023-09-04 20:52  污钞vtor  阅读(3)  评论(0编辑  收藏  举报