refactor: 完成R8裸机lwIP移植并更新文档
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#include "SEGGER_RTT.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int SEGGER_RTT_vprintf(unsigned BufferIndex, const char *sFormat, va_list *pParamList)
|
||||
{
|
||||
char buffer[SEGGER_RTT_PRINTF_BUFFER_SIZE];
|
||||
int len = vsnprintf(buffer, sizeof(buffer), sFormat, *pParamList);
|
||||
|
||||
if (len < 0) {
|
||||
return len;
|
||||
}
|
||||
if ((unsigned)len > sizeof(buffer)) {
|
||||
len = (int)sizeof(buffer);
|
||||
}
|
||||
|
||||
return (int)SEGGER_RTT_Write(BufferIndex, buffer, (unsigned)len);
|
||||
}
|
||||
|
||||
int SEGGER_RTT_printf(unsigned BufferIndex, const char *sFormat, ...)
|
||||
{
|
||||
int result;
|
||||
va_list args;
|
||||
|
||||
va_start(args, sFormat);
|
||||
result = SEGGER_RTT_vprintf(BufferIndex, sFormat, &args);
|
||||
va_end(args);
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user