mirror of
https://gitee.com/dlmu-cone/bf_original_balance_chassis
synced 2026-07-24 03:27:45 +08:00
更新了大量文档
This commit is contained in:
@@ -11,6 +11,28 @@
|
||||
|
||||
bsp_log是基于segger RTT实现的日志打印模块。
|
||||
|
||||
推荐使用`bsp_log.h`中提供了三级日志:
|
||||
|
||||
```c
|
||||
#define LOGINFO(format,...)
|
||||
#define LOGWARNING(format,...)
|
||||
#define LOGERROR(format,...)
|
||||
```
|
||||
|
||||
分别用于输出不同等级的日志。
|
||||
|
||||
**若想启用RTT,必须通过`launch.json`的`debug-jlink`启动调试(不论使用什么调试器)。**
|
||||
|
||||
注意,若你使用的是cmsis-dap和daplink,**请在调试任务启动之后再打开`log`任务。**(均在项目文件夹下的.vsocde/task.json中,有注释自行查看)。
|
||||
|
||||
在ozone中查看log输出,直接打开console调试任务台和terminal调试中断便可看到调试输出。
|
||||
|
||||
> 由于ozone版本的原因,可能出现日志不换行或没有颜色。
|
||||
|
||||
## 自定义输出
|
||||
|
||||
你也可以自定义输出格式,详见Segger RTT的文档。
|
||||
|
||||
```c
|
||||
int printf_log(const char *fmt, ...);
|
||||
void Float2Str(char *str, float va);
|
||||
@@ -33,3 +55,6 @@ printf_log("Motor %d met some problem, error code %d!\n",3,1);
|
||||
```
|
||||
|
||||
或直接通过`%f`格式符直接使用`printf_log()`发送日志,可以设置小数点位数以降低带宽开销。
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user