mirror of
https://gitee.com/dlmu-cone/bf_original_balance_chassis
synced 2026-07-24 03:27:45 +08:00
update doc
This commit is contained in:
10
bsp/bsp.md
10
bsp/bsp.md
@@ -0,0 +1,10 @@
|
||||
BSP
|
||||
|
||||
这是BSP层的说明文档。
|
||||
|
||||
> TODO:
|
||||
> 1. 增加SPI和I2C支持
|
||||
> 2. 增加外部中断支持
|
||||
> 3. 增加软件中断支持
|
||||
> 4. 增加硬件CRC支持
|
||||
> 5. 增加USB和虚拟串口支持
|
||||
@@ -4,6 +4,11 @@
|
||||
extern TIM_HandleTypeDef htim4;
|
||||
static uint8_t tmp_warning_level=0;
|
||||
|
||||
void buzzer_init()
|
||||
{
|
||||
HAL_TIM_PWM_Start(&htim4,TIM_CHANNEL_3);
|
||||
}
|
||||
|
||||
void buzzer_on(uint16_t psc, uint16_t pwm,uint8_t level)
|
||||
{
|
||||
if(level>tmp_warning_level)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "struct_typedef.h"
|
||||
|
||||
void buzzer_init();
|
||||
extern void buzzer_on(uint16_t psc, uint16_t pwm,uint8_t level);
|
||||
extern void buzzer_off(void);
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#include "bsp_init.h"
|
||||
#include "bsp_log.h"
|
||||
#include "bsp_dwt.h"
|
||||
#include "bsp_buzzer.h"
|
||||
#include "bsp_led.h"
|
||||
#include "bsp_temperature.h"
|
||||
|
||||
// CAN和串口会在注册实例的时候自动初始化,不注册不初始化
|
||||
void BSPInit()
|
||||
{
|
||||
DWT_Init(168);
|
||||
BSP_Log_Init();
|
||||
LED_init();
|
||||
IMUTempInit();
|
||||
buzzer_init();
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
#ifndef BSP_INIT_h
|
||||
#define BSP_INIT_h
|
||||
|
||||
|
||||
/**
|
||||
* @brief bsp层初始化统一入口
|
||||
*
|
||||
*/
|
||||
void BSPInit();
|
||||
|
||||
#endif // !BSP_INIT_h
|
||||
|
||||
|
||||
@@ -2,12 +2,19 @@
|
||||
#include "main.h"
|
||||
|
||||
extern TIM_HandleTypeDef htim5;
|
||||
static tmp_output_level=0;
|
||||
static tmp_output_level = 0;
|
||||
|
||||
void LED_init()
|
||||
{
|
||||
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 aRGB_led_show(uint32_t aRGB)
|
||||
{
|
||||
static uint8_t alpha;
|
||||
static uint16_t red,green,blue;
|
||||
static uint16_t red, green, blue;
|
||||
|
||||
alpha = (aRGB & 0xFF000000) >> 24;
|
||||
red = ((aRGB & 0x00FF0000) >> 16) * alpha;
|
||||
@@ -18,5 +25,3 @@ void aRGB_led_show(uint32_t aRGB)
|
||||
__HAL_TIM_SetCompare(&htim5, TIM_CHANNEL_2, green);
|
||||
__HAL_TIM_SetCompare(&htim5, TIM_CHANNEL_3, red);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "struct_typedef.h"
|
||||
|
||||
|
||||
void LED_init();
|
||||
extern void aRGB_led_show(uint32_t aRGB);
|
||||
|
||||
#endif
|
||||
@@ -2,8 +2,12 @@
|
||||
|
||||
extern TIM_HandleTypeDef htim10;
|
||||
|
||||
void IMUTempInit()
|
||||
{
|
||||
HAL_TIM_PWM_Start(&htim10, TIM_CHANNEL_1);
|
||||
}
|
||||
|
||||
void imu_pwm_set(uint16_t pwm)
|
||||
{
|
||||
__HAL_TIM_SetCompare(&htim10, TIM_CHANNEL_1, pwm);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "stdint.h"
|
||||
#include "tim.h"
|
||||
|
||||
void IMUTempInit();
|
||||
extern void imu_pwm_set(uint16_t pwm);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user