修改编译器的类型支持,将老旧的struct_typedef替换为新的stdint-gcc.h
This commit is contained in:
parent
6c56d4d19f
commit
1dc8622f53
|
@ -1,6 +1,8 @@
|
|||
{
|
||||
"files.associations": {
|
||||
"memory.h": "c"
|
||||
"memory.h": "c",
|
||||
"stdint-gcc.h": "c",
|
||||
"led_task.h": "c",
|
||||
"stdint.h": "c"
|
||||
},
|
||||
"C_Cpp.errorSquiggles": "Disabled"
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
#ifndef BSP_BUZZER_H
|
||||
#define BSP_BUZZER_H
|
||||
|
||||
#include "struct_typedef.h"
|
||||
#include <stdint-gcc.h>
|
||||
#include <stdint.h>
|
||||
|
||||
void buzzer_init();
|
||||
extern void buzzer_on(uint16_t psc, uint16_t pwm, uint8_t level);
|
||||
|
|
|
@ -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个串口
|
||||
|
|
|
@ -22,10 +22,7 @@ typedef unsigned int uint32_t;
|
|||
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef unsigned char bool_t;
|
||||
typedef float fp32;
|
||||
typedef float float;
|
||||
typedef double fp64;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#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
|
||||
|
@ -39,8 +38,8 @@ uint32_t RGB_flow_color[RGB_FLOW_COLOR_LENGHT + 1] = {0xFF0000FF, 0x0000FF00, 0x
|
|||
void led_RGB_flow_task()
|
||||
{
|
||||
uint16_t i, j;
|
||||
fp32 delta_alpha, delta_red, delta_green, delta_blue;
|
||||
fp32 alpha,red,green,blue;
|
||||
float delta_alpha, delta_red, delta_green, delta_blue;
|
||||
float alpha, red, green, blue;
|
||||
uint32_t aRGB;
|
||||
|
||||
while (1)
|
||||
|
@ -53,10 +52,10 @@ void led_RGB_flow_task()
|
|||
green = ((RGB_flow_color[i] & 0x0000FF00) >> 8);
|
||||
blue = ((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 = (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 /= RGB_FLOW_COLOR_CHANGE_TIME;
|
||||
delta_red /= RGB_FLOW_COLOR_CHANGE_TIME;
|
||||
|
@ -76,5 +75,3 @@ void led_RGB_flow_task()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
#ifndef LED_TRIGGER_TASK_H
|
||||
#define LED_TRIGGER_TASK_H
|
||||
|
||||
|
||||
#include "struct_typedef.h"
|
||||
#include <stdint-gcc.h>
|
||||
|
||||
/**
|
||||
* @brief led rgb task
|
||||
|
@ -33,6 +32,3 @@
|
|||
extern void led_RGB_flow_task();
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef HT04_H
|
||||
#define HT04_H
|
||||
|
||||
#include "struct_typedef.h"
|
||||
#include <stdint-gcc.h>
|
||||
#include "bsp_can.h"
|
||||
#include "controller.h"
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef LK9025_H
|
||||
#define LK9025_H
|
||||
|
||||
#include "struct_typedef.h"
|
||||
#include <stdint-gcc.h>
|
||||
#include "bsp_can.h"
|
||||
#include "controller.h"
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __CRC_H_
|
||||
#define __CRC_H_
|
||||
|
||||
#include "struct_typedef.h"
|
||||
#include <stdint-gcc.h>
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
|
|
@ -13,7 +13,6 @@ usart_instance referee_usart_instance;
|
|||
|
||||
/**************裁判系统数据******************/
|
||||
referee_info_t referee_info;
|
||||
bool_t Judge_Data_TF = FALSE; //裁判数据是否可用,辅助函数调用
|
||||
uint8_t Judge_Self_ID; //当前机器人的ID
|
||||
uint16_t Judge_SelfClient_ID; //发送者机器人对应的客户端ID
|
||||
|
||||
|
@ -21,7 +20,7 @@ uint16_t Judge_SelfClient_ID; //发送者机器人对应的客户端ID
|
|||
|
||||
static void ReceiveCallback()
|
||||
{
|
||||
Judge_Data_TF=Judge_Read_Data(referee_usart_instance.recv_buff);
|
||||
Judge_Read_Data(referee_usart_instance.recv_buff);
|
||||
}
|
||||
|
||||
void referee_init(UART_HandleTypeDef *referee_usart_handle)
|
||||
|
@ -39,9 +38,8 @@ void referee_init(UART_HandleTypeDef *referee_usart_handle)
|
|||
* @retval 是否对正误判断做处理
|
||||
* @attention 在此判断帧头和CRC校验,无误再写入数据,不重复判断帧头
|
||||
*/
|
||||
bool_t Judge_Read_Data(uint8_t *ReadFromUsart)
|
||||
void Judge_Read_Data(uint8_t *ReadFromUsart)
|
||||
{
|
||||
bool_t retval_tf = FALSE; //数据正确与否标志,每次调用读取裁判系统数据函数都先默认为错误
|
||||
uint16_t judge_length; //统计一帧数据长度
|
||||
// referee_info.CmdID = 0; //数据命令码解析
|
||||
//空数据包,则不作任何处理
|
||||
|
@ -64,7 +62,6 @@ bool_t Judge_Read_Data(uint8_t *ReadFromUsart)
|
|||
//帧尾CRC16校验
|
||||
if (Verify_CRC16_Check_Sum(ReadFromUsart, judge_length) == TRUE)
|
||||
{
|
||||
retval_tf = TRUE; //都校验过了则说明数据可用
|
||||
// 2个8位拼成16位int
|
||||
referee_info.CmdID = (ReadFromUsart[6] << 8 | ReadFromUsart[5]);
|
||||
//解析数据命令码,将数据拷贝到相应结构体中(注意拷贝数据的长度)
|
||||
|
@ -129,21 +126,8 @@ bool_t Judge_Read_Data(uint8_t *ReadFromUsart)
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
return retval_tf; //返回此次接收到的数据是否时有效的
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief 数据是否可用
|
||||
* @param void
|
||||
* @retval TRUE可用 FALSE不可用
|
||||
* @attention 在裁判读取函数中实时改变返回值
|
||||
*/
|
||||
bool_t JUDGE_sGetDataState(void)
|
||||
{
|
||||
return Judge_Data_TF;
|
||||
}
|
||||
/**
|
||||
* @brief 读取瞬时功率
|
||||
* @param void
|
||||
|
|
|
@ -342,9 +342,7 @@ typedef struct
|
|||
extern referee_info_t referee_info;
|
||||
|
||||
void referee_init(UART_HandleTypeDef *referee_usart_handle);
|
||||
bool_t Judge_Read_Data(uint8_t *ReadFromUsart);
|
||||
|
||||
bool_t JUDGE_sGetDataState(void);
|
||||
void Judge_Read_Data(uint8_t *ReadFromUsart);
|
||||
float JUDGE_fGetChassisPower(void);
|
||||
|
||||
#endif // !REFEREE_H
|
||||
|
|
|
@ -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