2023-01-24 22:37:53 +08:00
|
|
|
|
#ifndef RM_REFEREE_H
|
|
|
|
|
#define RM_REFEREE_H
|
2022-11-05 21:59:03 +08:00
|
|
|
|
|
2022-11-19 16:28:39 +08:00
|
|
|
|
#include "usart.h"
|
2023-01-06 22:54:01 +08:00
|
|
|
|
#include "referee_def.h"
|
2023-01-09 16:17:03 +08:00
|
|
|
|
#include "bsp_usart.h"
|
2023-01-26 19:52:07 +08:00
|
|
|
|
extern uint8_t UI_Seq;
|
2023-01-09 16:17:03 +08:00
|
|
|
|
|
2022-11-18 22:53:53 +08:00
|
|
|
|
#pragma pack(1)
|
2022-11-18 22:06:06 +08:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2023-01-15 21:11:15 +08:00
|
|
|
|
uint8_t Robot_Color; //机器人颜色
|
|
|
|
|
uint16_t Robot_ID; //本机器人ID
|
|
|
|
|
uint16_t Cilent_ID; //本机器人对应的客户端ID
|
2023-01-26 19:52:07 +08:00
|
|
|
|
uint16_t Receiver_Robot_ID; //机器人车间通信时接收者的ID,必须和本机器人同颜色
|
2023-01-15 21:11:15 +08:00
|
|
|
|
} referee_id_t;
|
|
|
|
|
|
2023-01-24 22:37:53 +08:00
|
|
|
|
// 此结构体包含裁判系统接收数据以及UI绘制与机器人车间通信的相关信息
|
2023-01-15 21:11:15 +08:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
referee_id_t referee_id;
|
2023-01-26 19:52:07 +08:00
|
|
|
|
|
2022-11-19 16:28:39 +08:00
|
|
|
|
xFrameHeader FrameHeader; // 接收到的帧头信息
|
2022-11-18 22:06:06 +08:00
|
|
|
|
uint16_t CmdID;
|
|
|
|
|
ext_game_state_t GameState; // 0x0001
|
|
|
|
|
ext_game_result_t GameResult; // 0x0002
|
|
|
|
|
ext_game_robot_HP_t GameRobotHP; // 0x0003
|
|
|
|
|
ext_event_data_t EventData; // 0x0101
|
|
|
|
|
ext_supply_projectile_action_t SupplyProjectileAction; // 0x0102
|
2023-01-12 16:11:40 +08:00
|
|
|
|
ext_game_robot_state_t GameRobotState; // 0x0201
|
2022-11-18 22:06:06 +08:00
|
|
|
|
ext_power_heat_data_t PowerHeatData; // 0x0202
|
|
|
|
|
ext_game_robot_pos_t GameRobotPos; // 0x0203
|
|
|
|
|
ext_buff_musk_t BuffMusk; // 0x0204
|
|
|
|
|
aerial_robot_energy_t AerialRobotEnergy; // 0x0205
|
|
|
|
|
ext_robot_hurt_t RobotHurt; // 0x0206
|
|
|
|
|
ext_shoot_data_t ShootData; // 0x0207
|
|
|
|
|
|
2023-01-26 19:52:07 +08:00
|
|
|
|
//自定义交互数据的接收
|
|
|
|
|
Communicate_ReceiveData_t ReceiveData;
|
2022-12-05 21:01:26 +08:00
|
|
|
|
|
2022-11-18 22:06:06 +08:00
|
|
|
|
} referee_info_t;
|
|
|
|
|
|
2022-12-03 15:20:17 +08:00
|
|
|
|
#pragma pack()
|
|
|
|
|
|
|
|
|
|
/**
|
2022-12-05 22:10:08 +08:00
|
|
|
|
* @brief 初始化裁判系统,返回接收数据指针
|
2023-01-15 21:11:15 +08:00
|
|
|
|
*
|
|
|
|
|
* @param referee_usart_handle
|
|
|
|
|
* @return referee_info_t*
|
2022-12-03 15:20:17 +08:00
|
|
|
|
*/
|
2023-01-15 21:11:15 +08:00
|
|
|
|
referee_info_t *RefereeInit(UART_HandleTypeDef *referee_usart_handle);
|
2022-12-03 15:20:17 +08:00
|
|
|
|
|
2023-01-09 16:17:03 +08:00
|
|
|
|
/**
|
|
|
|
|
* @brief 发送函数
|
2023-01-15 21:11:15 +08:00
|
|
|
|
* @todo
|
2023-01-09 16:17:03 +08:00
|
|
|
|
* @param send 待发送数据
|
|
|
|
|
*/
|
2023-01-15 21:11:15 +08:00
|
|
|
|
void RefereeSend(uint8_t *send, uint16_t tx_len);
|
2023-01-09 16:17:03 +08:00
|
|
|
|
|
2022-11-18 22:06:06 +08:00
|
|
|
|
#endif // !REFEREE_H
|