清除所有的legacy support,增加编译时的内存使用预测和Werror选项,统一命名。

This commit is contained in:
NeoZng
2023-07-14 17:24:44 +08:00
parent 8943bdfe5c
commit 3faa9f1f8f
24 changed files with 94 additions and 234 deletions

View File

@@ -1,17 +0,0 @@
#include "bsp_init.h"
#include "bsp_log.h"
#include "bsp_dwt.h"
#include "bsp_usb.h"
#include "bsp_led.h"
#include "bsp_temperature.h"
// CAN和串口会在注册实例的时候自动初始化,不注册不初始化
void BSPInit()
{
DWT_Init(168);
BSPLogInit();
// legacy support待删除,将在实现了led/tempctrl/buzzer的module之后移动到app层进行XXXRegister()
LEDInit();
IMUTempInit();
}

View File

@@ -1,13 +1,24 @@
#ifndef BSP_INIT_h
#define BSP_INIT_h
#include "bsp_init.h"
#include "bsp_log.h"
#include "bsp_dwt.h"
#include "bsp_usb.h"
/**
* @brief bsp层初始化统一入口,这里仅初始化必须的bsp组件,其他组件的初始化在各自的模块中进行
* 需在实时系统启动前调用,目前由RobotoInit()调用
*
* @note 其他实例型的外设如CAN和串口会在注册实例的时候自动初始化,不注册不初始化
*/
void BSPInit();
//
void BSPInit()
{
DWT_Init(168);
BSPLogInit();
}
#endif // !BSP_INIT_h

View File

@@ -1,29 +0,0 @@
#include "bsp_led.h"
#include "main.h"
#warning this is a legacy support file, please use the new version
extern TIM_HandleTypeDef htim5;
static uint8_t tmp_output_level = 0;
void LEDInit()
{
HAL_TIM_PWM_Start(&htim5, TIM_CHANNEL_1);
HAL_TIM_PWM_Start(&htim5, TIM_CHANNEL_2);
HAL_TIM_PWM_Start(&htim5, TIM_CHANNEL_3);
}
void FlowRGBShow(uint32_t aRGB)
{
static uint8_t alpha;
static uint16_t red, green, blue;
alpha = (aRGB & 0xFF000000) >> 24;
red = ((aRGB & 0x00FF0000) >> 16) * alpha;
green = ((aRGB & 0x0000FF00) >> 8) * alpha;
blue = ((aRGB & 0x000000FF) >> 0) * alpha;
__HAL_TIM_SetCompare(&htim5, TIM_CHANNEL_1, blue);
__HAL_TIM_SetCompare(&htim5, TIM_CHANNEL_2, green);
__HAL_TIM_SetCompare(&htim5, TIM_CHANNEL_3, red);
}

View File

@@ -1,9 +0,0 @@
#ifndef BSP_LED_H
#define BSP_LED_H
#include <stdint.h>
void LEDInit();
extern void FlowRGBShow(uint32_t aRGB);
#endif

View File

@@ -1,15 +0,0 @@
#include "bsp_temperature.h"
#warning this is a legacy support file, please use the new version
extern TIM_HandleTypeDef htim10;
void IMUTempInit()
{
HAL_TIM_PWM_Start(&htim10, TIM_CHANNEL_1);
}
void IMUPWMSet(uint16_t pwm)
{
__HAL_TIM_SetCompare(&htim10, TIM_CHANNEL_1, pwm);
}

View File

@@ -1,10 +0,0 @@
#ifndef __BSP_IMU_PWM_H
#define __BSP_IMU_PWM_H
#include "stdint.h"
#include "tim.h"
void IMUTempInit();
extern void IMUPWMSet(uint16_t pwm);
#endif

View File

@@ -1,5 +0,0 @@
# legacy bsp
这些bsp实现将在v0.1删除,因为他们实际上都是用pwm实现的,应当放在module层,以彻底隔离bsp和CubeMX的初始化代码.现已提供了bsp_pwm的实现.
之后在修改CubeMX的初始化配置之后就不再需要修改bsp的内容了,所有的修改都会通过app层的初始化配置`xxx_Init_Config_s`来实现.