修复类型支持问题和重复定义
This commit is contained in:
parent
acf93052b2
commit
076973f41e
10
Makefile
10
Makefile
|
@ -260,13 +260,13 @@ vpath %.s $(sort $(dir $(ASM_SOURCES)))
|
|||
# 以下是编译命令,命令之前被粉色高亮的@就是静默输出的指令.删除前面的@会将输出显示到命令行.
|
||||
# 如@$(CC) -c $(CFLAGS) ...... 去掉第一个@即可.
|
||||
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
|
||||
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
|
||||
@$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
|
||||
$(AS) -c $(CFLAGS) $< -o $@
|
||||
@$(AS) -c $(CFLAGS) $< -o $@
|
||||
|
||||
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
|
||||
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
|
||||
@$(CC) $(OBJECTS) $(LDFLAGS) -o $@
|
||||
$(SZ) $@
|
||||
|
||||
$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
|
||||
|
@ -276,13 +276,13 @@ $(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
|
|||
$(BIN) $< $@
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir $@
|
||||
@mkdir $@
|
||||
|
||||
#######################################
|
||||
# clean up
|
||||
#######################################
|
||||
clean:
|
||||
-rm -r $(BUILD_DIR)
|
||||
-rm -r -Force $(BUILD_DIR)
|
||||
|
||||
#######################################
|
||||
# dependencies
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef BSP_BUZZER_H
|
||||
#define BSP_BUZZER_H
|
||||
|
||||
#include "struct_typedef.h"
|
||||
#include <stdint-gcc.h>
|
||||
|
||||
void buzzer_init();
|
||||
extern void buzzer_on(uint16_t psc, uint16_t pwm,uint8_t level);
|
||||
extern void buzzer_on(uint16_t psc, uint16_t pwm, uint8_t level);
|
||||
extern void buzzer_off(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef BSP_CAN_H
|
||||
#define BSP_CAN_H
|
||||
|
||||
#include "struct_typedef.h"
|
||||
#include <stdint-gcc.h>
|
||||
#include "can.h"
|
||||
|
||||
#define MX_REGISTER_DEVICE_CNT 12 // maximum number of device can be registered to CAN service
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#ifndef BSP_LED_H
|
||||
#define BSP_LED_H
|
||||
|
||||
#include "struct_typedef.h"
|
||||
|
||||
#include <stdint-gcc.h>
|
||||
|
||||
void LED_init();
|
||||
extern void aRGB_led_show(uint32_t aRGB);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef BSP_RC_H
|
||||
#define BSP_RC_H
|
||||
|
||||
#include "struct_typedef.h"
|
||||
#include <stdint-gcc.h>
|
||||
#include "main.h"
|
||||
|
||||
#define DEVICE_USART_CNT 3 // C板至多分配3个串口
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
#ifndef STRUCT_TYPEDEF_H
|
||||
#define STRUCT_TYPEDEF_H
|
||||
|
||||
|
||||
#ifndef __PACKED
|
||||
#define __packed __attribute__((pakced))
|
||||
#endif // !__PACKED
|
||||
|
||||
typedef signed char int8_t;
|
||||
typedef signed short int int16_t;
|
||||
|
||||
#ifndef _INT32_T_DECLARED
|
||||
typedef signed int int32_t;
|
||||
#define _INT32_T_DECLARED
|
||||
#endif
|
||||
|
||||
typedef signed long long int64_t;
|
||||
|
||||
/* exact-width unsigned integer types */
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short int uint16_t;
|
||||
|
||||
#ifndef _UINT32_T_DECLARED
|
||||
typedef unsigned int uint32_t;
|
||||
#define _UINT32_T_DECLARED
|
||||
#endif
|
||||
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef unsigned char bool_t;
|
||||
typedef float fp32;
|
||||
typedef double fp64;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
****************************(C) COPYRIGHT 2019 DJI****************************
|
||||
* @file led_trigger_task.c/h
|
||||
* @brief led RGB show.led RGB灯效。
|
||||
* @note
|
||||
* @note
|
||||
* @history
|
||||
* Version Date Author Modification
|
||||
* V1.0.0 Nov-11-2019 RM 1. rgb led
|
||||
|
@ -19,62 +19,59 @@
|
|||
#include "cmsis_os.h"
|
||||
#include "main.h"
|
||||
|
||||
|
||||
#define RGB_FLOW_COLOR_CHANGE_TIME 1000
|
||||
#define RGB_FLOW_COLOR_LENGHT 6
|
||||
//blue-> green(dark)-> red -> blue(dark) -> green(dark) -> red(dark) -> blue
|
||||
//蓝 -> 绿(灭) -> 红 -> 蓝(灭) -> 绿 -> 红(灭) -> 蓝
|
||||
#define RGB_FLOW_COLOR_CHANGE_TIME 1000
|
||||
#define RGB_FLOW_COLOR_LENGHT 6
|
||||
// blue-> green(dark)-> red -> blue(dark) -> green(dark) -> red(dark) -> blue
|
||||
// 蓝 -> 绿(灭) -> 红 -> 蓝(灭) -> 绿 -> 红(灭) -> 蓝
|
||||
uint32_t RGB_flow_color[RGB_FLOW_COLOR_LENGHT + 1] = {0xFF0000FF, 0x0000FF00, 0xFFFF0000, 0x000000FF, 0xFF00FF00, 0x00FF0000, 0xFF0000FF};
|
||||
|
||||
/**
|
||||
* @brief led rgb task
|
||||
* @param[in] pvParameters: NULL
|
||||
* @retval none
|
||||
*/
|
||||
* @brief led rgb task
|
||||
* @param[in] pvParameters: NULL
|
||||
* @retval none
|
||||
*/
|
||||
/**
|
||||
* @brief led RGB任务
|
||||
* @param[in] pvParameters: NULL
|
||||
* @retval none
|
||||
*/
|
||||
* @brief led RGB任务
|
||||
* @param[in] pvParameters: NULL
|
||||
* @retval none
|
||||
*/
|
||||
void led_RGB_flow_task()
|
||||
{
|
||||
uint16_t i, j;
|
||||
fp32 delta_alpha, delta_red, delta_green, delta_blue;
|
||||
fp32 alpha,red,green,blue;
|
||||
uint32_t aRGB;
|
||||
uint16_t i, j;
|
||||
float delta_alpha, delta_red, delta_green, delta_blue;
|
||||
float alpha, red, green, blue;
|
||||
uint32_t aRGB;
|
||||
|
||||
while(1)
|
||||
while (1)
|
||||
{
|
||||
|
||||
for (i = 0; i < RGB_FLOW_COLOR_LENGHT; i++)
|
||||
{
|
||||
alpha = (RGB_flow_color[i] & 0xFF000000) >> 24;
|
||||
red = ((RGB_flow_color[i] & 0x00FF0000) >> 16);
|
||||
green = ((RGB_flow_color[i] & 0x0000FF00) >> 8);
|
||||
blue = ((RGB_flow_color[i] & 0x000000FF) >> 0);
|
||||
|
||||
for(i = 0; i < RGB_FLOW_COLOR_LENGHT; i++)
|
||||
{
|
||||
alpha = (RGB_flow_color[i] & 0xFF000000) >> 24;
|
||||
red = ((RGB_flow_color[i] & 0x00FF0000) >> 16);
|
||||
green = ((RGB_flow_color[i] & 0x0000FF00) >> 8);
|
||||
blue = ((RGB_flow_color[i] & 0x000000FF) >> 0);
|
||||
delta_alpha = (float)((RGB_flow_color[i + 1] & 0xFF000000) >> 24) - (float)((RGB_flow_color[i] & 0xFF000000) >> 24);
|
||||
delta_red = (float)((RGB_flow_color[i + 1] & 0x00FF0000) >> 16) - (float)((RGB_flow_color[i] & 0x00FF0000) >> 16);
|
||||
delta_green = (float)((RGB_flow_color[i + 1] & 0x0000FF00) >> 8) - (float)((RGB_flow_color[i] & 0x0000FF00) >> 8);
|
||||
delta_blue = (float)((RGB_flow_color[i + 1] & 0x000000FF) >> 0) - (float)((RGB_flow_color[i] & 0x000000FF) >> 0);
|
||||
|
||||
delta_alpha = (fp32)((RGB_flow_color[i + 1] & 0xFF000000) >> 24) - (fp32)((RGB_flow_color[i] & 0xFF000000) >> 24);
|
||||
delta_red = (fp32)((RGB_flow_color[i + 1] & 0x00FF0000) >> 16) - (fp32)((RGB_flow_color[i] & 0x00FF0000) >> 16);
|
||||
delta_green = (fp32)((RGB_flow_color[i + 1] & 0x0000FF00) >> 8) - (fp32)((RGB_flow_color[i] & 0x0000FF00) >> 8);
|
||||
delta_blue = (fp32)((RGB_flow_color[i + 1] & 0x000000FF) >> 0) - (fp32)((RGB_flow_color[i] & 0x000000FF) >> 0);
|
||||
delta_alpha /= RGB_FLOW_COLOR_CHANGE_TIME;
|
||||
delta_red /= RGB_FLOW_COLOR_CHANGE_TIME;
|
||||
delta_green /= RGB_FLOW_COLOR_CHANGE_TIME;
|
||||
delta_blue /= RGB_FLOW_COLOR_CHANGE_TIME;
|
||||
for (j = 0; j < RGB_FLOW_COLOR_CHANGE_TIME; j++)
|
||||
{
|
||||
alpha += delta_alpha;
|
||||
red += delta_red;
|
||||
green += delta_green;
|
||||
blue += delta_blue;
|
||||
|
||||
delta_alpha /= RGB_FLOW_COLOR_CHANGE_TIME;
|
||||
delta_red /= RGB_FLOW_COLOR_CHANGE_TIME;
|
||||
delta_green /= RGB_FLOW_COLOR_CHANGE_TIME;
|
||||
delta_blue /= RGB_FLOW_COLOR_CHANGE_TIME;
|
||||
for(j = 0; j < RGB_FLOW_COLOR_CHANGE_TIME; j++)
|
||||
{
|
||||
alpha += delta_alpha;
|
||||
red += delta_red;
|
||||
green += delta_green;
|
||||
blue += delta_blue;
|
||||
|
||||
aRGB = ((uint32_t)(alpha)) << 24 | ((uint32_t)(red)) << 16 | ((uint32_t)(green)) << 8 | ((uint32_t)(blue)) << 0;
|
||||
aRGB_led_show(aRGB);
|
||||
osDelay(1);
|
||||
}
|
||||
}
|
||||
aRGB = ((uint32_t)(alpha)) << 24 | ((uint32_t)(red)) << 16 | ((uint32_t)(green)) << 8 | ((uint32_t)(blue)) << 0;
|
||||
aRGB_led_show(aRGB);
|
||||
osDelay(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
****************************(C) COPYRIGHT 2019 DJI****************************
|
||||
* @file led_trigger_task.c/h
|
||||
* @brief led RGB show.led RGB<EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD>
|
||||
* @note
|
||||
* @note
|
||||
* @history
|
||||
* Version Date Author Modification
|
||||
* V1.0.0 Nov-11-2019 RM 1. rgb led
|
||||
|
@ -17,22 +17,18 @@
|
|||
#ifndef LED_TRIGGER_TASK_H
|
||||
#define LED_TRIGGER_TASK_H
|
||||
|
||||
|
||||
#include "struct_typedef.h"
|
||||
#include <stdint-gcc.h>
|
||||
|
||||
/**
|
||||
* @brief led rgb task
|
||||
* @param[in] pvParameters: NULL
|
||||
* @retval none
|
||||
*/
|
||||
* @brief led rgb task
|
||||
* @param[in] pvParameters: NULL
|
||||
* @retval none
|
||||
*/
|
||||
/**
|
||||
* @brief led RGB<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* @param[in] pvParameters: NULL
|
||||
* @retval none
|
||||
*/
|
||||
* @brief led RGB<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* @param[in] pvParameters: NULL
|
||||
* @retval none
|
||||
*/
|
||||
extern void led_RGB_flow_task();
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#ifndef HT04_H
|
||||
#define HT04_H
|
||||
|
||||
#include "struct_typedef.h"
|
||||
#include <stdint-gcc.h>
|
||||
#include "bsp_can.h"
|
||||
#include "controller.h"
|
||||
#include "motor_def.h"
|
||||
|
||||
#define HT_MOTOR_CNT 4
|
||||
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
#ifndef LK9025_H
|
||||
#define LK9025_H
|
||||
|
||||
#include "struct_typedef.h"
|
||||
#include "bsp_can.h"
|
||||
#include "controller.h"
|
||||
#include "motor_def.h"
|
||||
|
||||
#define LK_MOTOR_CNT 2
|
||||
#define I_MIN -2000
|
||||
#define I_MAX 2000
|
||||
|
||||
#define LIMIT_MIN_MAX(x, min, max) (x) = (((x) <= (min)) ? (min) : (((x) >= (max)) ? (max) : (x)))
|
||||
|
||||
typedef struct // 9025
|
||||
{
|
||||
uint16_t last_ecd;
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
#define MOTOR_DEF_H
|
||||
|
||||
#include "controller.h"
|
||||
#include <stdint-gcc.h>
|
||||
|
||||
#define LIMIT_MIN_MAX(x, min, max) (x) = (((x) <= (min)) ? (min) : (((x) >= (max)) ? (max) : (x)))
|
||||
|
||||
/**
|
||||
* @brief 闭环类型,如果需要多个闭环,则使用或运算
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#ifndef REMOTE_CONTROL_H
|
||||
#define REMOTE_CONTROL_H
|
||||
|
||||
#include "struct_typedef.h"
|
||||
#include <stdint-gcc.h>
|
||||
#include "main.h"
|
||||
|
||||
#define RC_CH_VALUE_MIN ((uint16_t)364)
|
||||
|
|
Loading…
Reference in New Issue