重构bsp层,bsp层将和HAL的配置一致,修改CubeMX之后不需要修改bsp。重构bmi088。

This commit is contained in:
NeoZng
2022-12-30 23:39:04 +08:00
parent ab1a9726b1
commit a3631a5ca5
39 changed files with 842 additions and 256 deletions

34
bsp/log/bsp_log.c Normal file
View File

@@ -0,0 +1,34 @@
#include "bsp_log.h"
#include "SEGGER_RTT.h"
#include "SEGGER_RTT_Conf.h"
#include <stdio.h>
#define BUFFER_INDEX 0
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);
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);
}