mirror of
https://gitee.com/dlmu-cone/tronone-h7-scaffold
synced 2026-07-24 11:37:44 +08:00
代码规范 prts文档
This commit is contained in:
@@ -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"
|
||||
Reference in New Issue
Block a user