代码规范 prts文档

This commit is contained in:
TuxMonkey
2025-11-25 14:24:06 +08:00
parent a57f882fc3
commit 2a40c85a2b
21 changed files with 10731 additions and 10 deletions

View File

@@ -1,5 +1,34 @@
//
// Created by tuxmonkey on 2025/10/28.
//
#include "bsp_log.h"
#include "SEGGER_RTT.h"
#include "SEGGER_RTT_Conf.h"
#include <stdio.h>
void BSPLogInit()
{
SEGGER_RTT_Init();
}
int PrintLog(const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
int n = SEGGER_RTT_vprintf(BUFFER_INDEX, fmt, &args); // 一次可以开启多个buffer(多个终端),我们只用一个
va_end(args);
return n;
}
void Float2Str(char *str, float va)
{
int flag = va < 0;
int head = (int) va;
int point = (int) ((va - head) * 1000);
head = abs(head);
point = abs(point);
if (flag)
sprintf(str, "-%d.%d", head, point);
else
sprintf(str, "%d.%d", head, point);
}
#include "bsp_log.h"