677 lines
17 KiB
C
677 lines
17 KiB
C
/*
|
||
裁判系统抽象。
|
||
*/
|
||
|
||
#pragma once
|
||
|
||
#ifdef __cplusplus
|
||
extern "C" {
|
||
#endif
|
||
|
||
/* Includes ----------------------------------------------------------------- */
|
||
#include <cmsis_os2.h>
|
||
#include <stdbool.h>
|
||
#include "component/ui.h"
|
||
#include "component/user_math.h"
|
||
#include "device/device.h"
|
||
#include "device/referee_proto_types.h"
|
||
#include "device/supercap.h"
|
||
#include "module/balance_chassis.h"
|
||
#include "module/gimbal.h"
|
||
#include "module/shoot.h"
|
||
|
||
/* Exported constants ------------------------------------------------------- */
|
||
/* Exported macro ----------------------------------------------------------- */
|
||
#define REF_SWITCH_STATUS(ref, stat) ((ref).ref_status = (stat))
|
||
#define CHASSIS_POWER_MAX_WITHOUT_REF 50.0f /* 裁判系统离线底盘最大功率 */
|
||
|
||
#define REF_UI_MAX_GRAPIC_NUM (7)
|
||
#define REF_UI_MAX_STRING_NUM (7)
|
||
#define REF_UI_MAX_DEL_NUM (3)
|
||
#define REF_USER_DATA_MAX_LEN 112
|
||
/* Exported types ----------------------------------------------------------- */
|
||
typedef struct __packed {
|
||
uint8_t sof;
|
||
uint16_t data_length;
|
||
uint8_t seq;
|
||
uint8_t crc8;
|
||
} Referee_Header_t;
|
||
|
||
/* 分辨率配置 */
|
||
|
||
/* Referee_Status_t, PowerHeat_t, RobotStatus_t, ShootData_t,
|
||
ForCap/AI/Chassis/Shoot_t, Screen_t, UI_CMD_t
|
||
均定义在 device/referee_proto_types.h(已在上方 include)*/
|
||
|
||
|
||
|
||
typedef enum {
|
||
REF_CMD_ID_GAME_STATUS = 0x0001,
|
||
REF_CMD_ID_GAME_RESULT = 0x0002,
|
||
REF_CMD_ID_GAME_ROBOT_HP = 0x0003,
|
||
// REF_CMD_ID_DART_STATUS = 0x0004,
|
||
REF_CMD_ID_FIELD_EVENTS = 0x0101,
|
||
REF_CMD_ID_WARNING = 0x0104,
|
||
REF_CMD_ID_DART_COUNTDOWN = 0x0105,
|
||
REF_CMD_ID_ROBOT_STATUS = 0x0201,
|
||
REF_CMD_ID_POWER_HEAT_DATA = 0x0202,
|
||
REF_CMD_ID_ROBOT_POS = 0x0203,
|
||
REF_CMD_ID_ROBOT_BUFF = 0x0204,
|
||
REF_CMD_ID_ROBOT_DMG = 0x0206,
|
||
REF_CMD_ID_SHOOT_DATA = 0x0207,
|
||
REF_CMD_ID_BULLET_REMAINING = 0x0208,
|
||
REF_CMD_ID_RFID = 0x0209,
|
||
REF_CMD_ID_DART_CLIENT = 0x020A,
|
||
REF_CMD_ID_GROUND_ROBOT_POS = 0x020B,
|
||
REF_CMD_ID_RADAR_MASK_PROC = 0x020C,
|
||
REF_CMD_ID_SENTRY_AUTO_DEC = 0x020D,
|
||
REF_CMD_ID_RADAR_AUTO_DEC = 0x020E,
|
||
REF_CMD_ID_INTER_STUDENT = 0x0301,
|
||
REF_CMD_ID_INTER_STUDENT_CUSTOM = 0x0302,
|
||
REF_CMD_ID_CLIENT_MAP = 0x0303,
|
||
REF_CMD_ID_KEYBOARD_MOUSE = 0x0304,
|
||
REF_CMD_ID_CLIENT_MAP_REC_RADAR = 0x0305,
|
||
REF_CMD_ID_CUSTOMER_CONTROLLER_CLIENT_INTERACT = 0x0306,
|
||
REF_CMD_ID_CLIENT_MAP_REC_ROUTE = 0x0307,
|
||
REF_CMD_ID_CLIENT_MAP_REC_ROBOT = 0x0308,
|
||
REF_CMD_ID_CUSTOMER_CONTROLLER_CLIENT_REC_ROBOT = 0x0309,
|
||
REF_CMD_ID_ROBOT_TO_CUSTOMER_CONTROLLER_CLIENT_REC = 0x0310,
|
||
|
||
|
||
|
||
REF_CMD_ID_SET_PICTURE_CHANNEL = 0x0F01,
|
||
REF_CMD_ID_QUERY_PICTURE_CHANNEL = 0x0F02,
|
||
REF_CMD_ID_OPPSITE_ROBOT_POS = 0x0A01,
|
||
REF_CMD_ID_OPPSITE_ROBOT_HP = 0x0A02,
|
||
REF_CMD_ID_OPPSITE_ROBOT_BULLET_REMAINING = 0x0A03,
|
||
REF_CMD_ID_OPPSITE_ROBOT_STATUs = 0x0A04,
|
||
REF_CMD_ID_OPPSITE_ROBOT_BUFF= 0x0A05,
|
||
REF_CMD_ID_OPPSITE_ROBOT_INTERF_WAVE_SRCRET_KEY= 0x0A06,
|
||
|
||
} Referee_CMDID_t;
|
||
|
||
typedef struct __packed {
|
||
uint8_t game_type : 4;
|
||
uint8_t game_progress : 4;
|
||
uint16_t stage_remain_time;
|
||
uint64_t sync_time_stamp;
|
||
} Referee_GameStatus_t;
|
||
|
||
typedef struct __packed {
|
||
uint8_t winner;
|
||
} Referee_GameResult_t;
|
||
|
||
typedef struct __packed {
|
||
uint16_t ally_1_robot_HP;
|
||
uint16_t ally_2_robot_HP;
|
||
uint16_t ally_3_robot_HP;
|
||
uint16_t ally_4_robot_HP;
|
||
uint16_t reserved;
|
||
uint16_t ally_7_robot_HP;
|
||
uint16_t ally_outpost_HP;
|
||
uint16_t ally_base_HP;
|
||
} Referee_GameRobotHP_t;
|
||
|
||
typedef struct __packed {
|
||
uint32_t event_data;
|
||
} Referee_Event_t;
|
||
|
||
typedef struct __packed {
|
||
uint8_t level;
|
||
uint8_t offending_robot_id;
|
||
uint8_t count;
|
||
} Referee_Warning_t;
|
||
|
||
typedef struct __packed {
|
||
uint8_t dart_remaining_time;
|
||
uint16_t dart_info;
|
||
} Referee_DartInfo_t;
|
||
|
||
|
||
|
||
typedef struct __packed {
|
||
float x;
|
||
float y;
|
||
float angle;
|
||
} Referee_RobotPos_t;
|
||
|
||
typedef struct {
|
||
uint8_t recovery_buff;
|
||
uint16_t cooling_buff;
|
||
uint8_t defence_buff;
|
||
uint8_t vulnerability_buff;
|
||
uint16_t attack_buff;
|
||
uint8_t remaining_energy;
|
||
} Referee_RobotBuff_t;
|
||
|
||
typedef struct __packed {
|
||
uint8_t armor_id : 4;
|
||
uint8_t damage_type : 4;
|
||
} Referee_RobotDamage_t;
|
||
|
||
|
||
typedef struct __packed {
|
||
uint16_t bullet_17_remain;
|
||
uint16_t bullet_42_remain;
|
||
uint16_t coin_remain;
|
||
uint16_t fortress_remain;
|
||
}Referee_BulletRemain_t;
|
||
|
||
typedef struct {
|
||
uint32_t rfid_status;
|
||
uint8_t rfid_status_2;
|
||
}Referee_RFID_t;
|
||
|
||
typedef struct __packed {
|
||
uint8_t dart_launch_opening_status;
|
||
uint8_t reserved;
|
||
uint16_t target_change_time;
|
||
uint16_t latest_launch_cmd_time;
|
||
}Referee_DartClient_t;
|
||
|
||
typedef struct {
|
||
float hero_x;
|
||
float hero_y;
|
||
float engineer_x;
|
||
float engineer_y;
|
||
float standard_3_x;
|
||
float standard_3_y;
|
||
float standard_4_x;
|
||
float standard_4_y;
|
||
float reserved_1;
|
||
float reserved_2;
|
||
} Referee_GroundRobotPos_t;
|
||
|
||
typedef struct __packed {
|
||
uint16_t mark_progress;
|
||
} Referee_RadarMark_t;
|
||
|
||
typedef struct __packed {
|
||
uint32_t sentry_info;
|
||
uint16_t sentry_info_2;
|
||
} Referee_SentryInfo_t;
|
||
|
||
typedef struct __packed {
|
||
uint8_t radar_info;
|
||
} Referee_RadarInfo_t;
|
||
|
||
typedef struct __packed {
|
||
uint16_t data_cmd_id;
|
||
uint16_t sender_id;
|
||
uint16_t receiver_id;
|
||
uint8_t user_data[REF_USER_DATA_MAX_LEN];
|
||
} Referee_RobotInteraction_t;
|
||
|
||
typedef struct __packed
|
||
{
|
||
uint8_t delete_type;
|
||
uint8_t layer;
|
||
}Referee_RobotInteractionLayerDelete_t;
|
||
|
||
typedef struct __packed {
|
||
uint8_t figure_name[3];
|
||
uint32_t operate_type:3;
|
||
uint32_t figure_type:3;
|
||
uint32_t layer:4;
|
||
uint32_t color:4;
|
||
uint32_t details_a:9;
|
||
uint32_t details_b:9;
|
||
uint32_t width:10;
|
||
uint32_t start_x:11;
|
||
uint32_t start_y:11;
|
||
uint32_t details_c:10;
|
||
uint32_t details_d:11;
|
||
uint32_t details_e:11;
|
||
} Referee_InteractionFigure_t;
|
||
|
||
|
||
|
||
typedef struct __packed {
|
||
Referee_InteractionFigure_t interaction_figure[2];
|
||
} Referee_InteractionFigure2_t;
|
||
|
||
typedef struct __packed {
|
||
|
||
Referee_InteractionFigure_t interaction_figure[5];
|
||
} Referee_InteractionFigure3_t;
|
||
|
||
typedef struct __packed {
|
||
Referee_InteractionFigure_t interaction_figure[7];
|
||
} Referee_InteractionFigure4_t;
|
||
|
||
typedef struct __packed {
|
||
//graphic_data_struct_t grapic_data_struct;
|
||
uint8_t data[30];
|
||
}Referee_ExtClientCustomCharacter_t;
|
||
|
||
typedef struct __packed {
|
||
uint32_t sentry_cmd;
|
||
} Referee_SentryCmd_t;
|
||
|
||
typedef struct __packed {
|
||
uint8_t radar_cmd;
|
||
uint8_t password_cmd;
|
||
uint8_t password_1;
|
||
uint8_t password_2;
|
||
uint8_t password_3;
|
||
uint8_t password_4;
|
||
uint8_t password_5;
|
||
uint8_t password_6;
|
||
} Referee_RadarCmd_t;
|
||
|
||
typedef struct __packed {
|
||
float target_position_x;
|
||
float target_position_y;
|
||
uint8_t cmd_keyboard;
|
||
uint8_t target_robot_id;
|
||
uint16_t cmd_source;
|
||
}Referee_MapCommand_t;
|
||
|
||
typedef struct __packed {
|
||
uint16_t hero_position_x;
|
||
uint16_t hero_position_y;
|
||
uint16_t engineer_position_x;
|
||
uint16_t engineer_position_y;
|
||
uint16_t infantry_3_position_x;
|
||
uint16_t infantry_3_position_y;
|
||
uint16_t infantry_4_position_x;
|
||
uint16_t infantry_4_position_y;
|
||
uint16_t infantry_5_position_x;
|
||
uint16_t infantry_5_position_y;
|
||
uint16_t sentry_position_x;
|
||
int16_t sentry_position_y;
|
||
} Referee_MapRobotData_t;
|
||
|
||
typedef struct
|
||
{
|
||
uint8_t intention;
|
||
uint16_t start_position_x;
|
||
uint16_t start_position_y;
|
||
int8_t delta_x[49];
|
||
int8_t delta_y[49];
|
||
uint16_t sender_id;
|
||
}Referee_MapData_t;
|
||
|
||
typedef struct
|
||
{
|
||
uint16_t sender_id;
|
||
uint16_t receiver_id;
|
||
uint8_t user_data[30];
|
||
}Referee_CustomInfo_t;
|
||
|
||
typedef struct
|
||
{
|
||
uint8_t data[30];
|
||
}Referee_CustomRobot_t;
|
||
|
||
typedef struct
|
||
{
|
||
uint8_t data[30];
|
||
}Referee_RobotCustom_t;
|
||
|
||
typedef struct
|
||
{
|
||
uint8_t data[30];
|
||
}Referee_RobotCustom2_t;
|
||
|
||
/* 适配 V1.2.0: 0x0311 新增指令 */
|
||
typedef struct __packed {
|
||
uint8_t data[30];
|
||
} Referee_RobotCustom3_t;
|
||
|
||
typedef struct __packed {
|
||
int16_t mouse_x;
|
||
int16_t mouse_y;
|
||
int16_t mouse_wheel;
|
||
int8_t button_l;
|
||
int8_t button_r;
|
||
uint16_t keyboard_value;
|
||
uint16_t res;
|
||
} Referee_KeyboardMouse_t;
|
||
|
||
typedef struct
|
||
{
|
||
uint16_t key_value;
|
||
uint16_t x_position:12;
|
||
uint16_t mouse_left:4;
|
||
uint16_t y_position:12;
|
||
uint16_t mouse_right:4;
|
||
uint16_t reserved;
|
||
}Referee_CustomClient_t;
|
||
|
||
typedef struct __packed {
|
||
uint8_t place_holder;
|
||
} Referee_InterStudent_Custom_t;
|
||
|
||
typedef struct __packed {
|
||
uint16_t ally_1_robot_HP;
|
||
uint16_t ally_2_robot_HP;
|
||
uint16_t ally_3_robot_HP;
|
||
uint16_t ally_4_robot_HP;
|
||
uint16_t reserved;
|
||
uint16_t ally_7_robot_HP;
|
||
} Referee_OppisiteGameRobotHP_t;
|
||
|
||
typedef struct __packed {
|
||
uint16_t hero_bullet;
|
||
uint16_t infantry3_bullet;
|
||
uint16_t infantry4_bullet;
|
||
uint16_t drone_bullet;
|
||
uint16_t sentry_bullet;
|
||
} Referee_OppsiteBulletRemain_t;
|
||
|
||
|
||
typedef struct __packed {
|
||
uint16_t remain_coins;
|
||
uint16_t total_coins;
|
||
uint32_t macro_status;
|
||
} Referee_OppsiteRobotState_t;
|
||
|
||
typedef struct __packed {
|
||
uint8_t data[36];
|
||
} Referee_OppsiteRobotBuff_t;
|
||
|
||
typedef struct __packed {
|
||
uint8_t data[6];
|
||
} Referee_OppsiteDisturbingWaveKey_t;
|
||
|
||
|
||
|
||
typedef struct __packed {
|
||
uint8_t f1_status : 1;
|
||
uint8_t f1_buff_status : 3;
|
||
uint8_t f2_status : 1;
|
||
uint8_t f2_buff_status : 3;
|
||
uint8_t f3_status : 1;
|
||
uint8_t f3_buff_status : 3;
|
||
uint8_t f4_status : 1;
|
||
uint8_t f4_buff_status : 3;
|
||
uint8_t f5_status : 1;
|
||
uint8_t f5_buff_status : 3;
|
||
uint8_t f6_status : 1;
|
||
uint8_t f6_buff_status : 3;
|
||
uint16_t red1_bullet_remain;
|
||
uint16_t red2_bullet_remain;
|
||
uint16_t blue1_bullet_remain;
|
||
uint16_t blue2_bullet_remain;
|
||
} Referee_ICRAZoneStatus_t;
|
||
|
||
typedef struct __packed {
|
||
uint8_t copter_pad : 2;
|
||
uint8_t energy_mech : 2;
|
||
uint8_t virtual_shield : 1;
|
||
uint32_t res : 27;
|
||
} Referee_FieldEvents_t;
|
||
|
||
typedef struct __packed {
|
||
uint8_t supply_id;
|
||
uint8_t robot_id;
|
||
uint8_t supply_step;
|
||
uint8_t supply_sum;
|
||
} Referee_SupplyAction_t;
|
||
|
||
typedef struct __packed {
|
||
uint8_t place_holder; /* TODO */
|
||
} Referee_RequestSupply_t;
|
||
|
||
typedef struct __packed {
|
||
uint8_t countdown;
|
||
} Referee_DartCountdown_t;
|
||
|
||
|
||
typedef struct __packed {
|
||
uint8_t attack_countdown;
|
||
} Referee_DroneEnergy_t;
|
||
|
||
|
||
|
||
|
||
/*typedef struct __packed {
|
||
uint8_t opening;
|
||
uint8_t target;
|
||
uint8_t target_changable_countdown;
|
||
uint8_t dart1_speed;
|
||
uint8_t dart2_speed;
|
||
uint8_t dart3_speed;
|
||
uint8_t dart4_speed;
|
||
uint16_t last_dart_launch_time;
|
||
uint16_t operator_cmd_launch_time;
|
||
} Referee_DartClient_t;*/
|
||
|
||
|
||
|
||
|
||
|
||
typedef struct __packed {
|
||
float position_x;
|
||
float position_y;
|
||
float position_z;
|
||
uint8_t commd_keyboard;
|
||
uint16_t robot_id;
|
||
} Referee_ClientMap_t;
|
||
|
||
typedef uint16_t Referee_Tail_t;
|
||
|
||
typedef enum {
|
||
REF_BOT_RED_HERO = 1,
|
||
REF_BOT_RED_ENGINEER = 2,
|
||
REF_BOT_RED_INFANTRY_1 = 3,
|
||
REF_BOT_RED_INFANTRY_2 = 4,
|
||
REF_BOT_RED_INFANTRY_3 = 5,
|
||
REF_BOT_RED_DRONE = 6,
|
||
REF_BOT_RED_SENTRY = 7,
|
||
REF_BOT_RED_RADER = 9,
|
||
REF_BOT_RED_OUTPOST=10,
|
||
REF_BOT_RED_BASE=11,
|
||
REF_BOT_BLU_HERO = 101,
|
||
REF_BOT_BLU_ENGINEER = 102,
|
||
REF_BOT_BLU_INFANTRY_1 = 103,
|
||
REF_BOT_BLU_INFANTRY_2 = 104,
|
||
REF_BOT_BLU_INFANTRY_3 = 105,
|
||
REF_BOT_BLU_DRONE = 106,
|
||
REF_BOT_BLU_SENTRY = 107,
|
||
REF_BOT_BLU_RADER = 109,
|
||
REF_BOT_BUL_OUTPOST=110,
|
||
REF_BOT_BUL_BASE=111,
|
||
} Referee_RobotID_t;
|
||
|
||
typedef enum {
|
||
REF_CL_RED_HERO = 0x0101,
|
||
REF_CL_RED_ENGINEER = 0x0102,
|
||
REF_CL_RED_INFANTRY_1 = 0x0103,
|
||
REF_CL_RED_INFANTRY_2 = 0x0104,
|
||
REF_CL_RED_INFANTRY_3 = 0x0105,
|
||
REF_CL_RED_DRONE = 0x0106,
|
||
REF_CL_BLU_HERO = 0x0165,
|
||
REF_CL_BLU_ENGINEER = 0x0166,
|
||
REF_CL_BLU_INFANTRY_1 = 0x0167,
|
||
REF_CL_BLU_INFANTRY_2 = 0x0168,
|
||
REF_CL_BLU_INFANTRY_3 = 0x0169,
|
||
REF_CL_BLU_DRONE = 0x016A,
|
||
|
||
} Referee_ClientID_t;
|
||
|
||
typedef enum {
|
||
REF_STDNT_CMD_ID_UI_DEL = 0x0100,
|
||
REF_STDNT_CMD_ID_UI_DRAW1 = 0x0101,
|
||
REF_STDNT_CMD_ID_UI_DRAW2 = 0x0102,
|
||
REF_STDNT_CMD_ID_UI_DRAW5 = 0x0103,
|
||
REF_STDNT_CMD_ID_UI_DRAW7 = 0x0104,
|
||
REF_STDNT_CMD_ID_UI_STR = 0x0110,
|
||
|
||
REF_STDNT_CMD_ID_CUSTOM = 0x0200,
|
||
} Referee_StudentCMDID_t;
|
||
|
||
typedef struct __packed {
|
||
Referee_StudentCMDID_t data_cmd_id;
|
||
uint16_t id_sender;
|
||
uint16_t id_receiver;
|
||
uint8_t *data;
|
||
} Referee_InterStudent_t;
|
||
|
||
|
||
|
||
typedef struct {
|
||
Referee_Status_t ref_status;
|
||
Referee_GameStatus_t game_status;
|
||
Referee_GameResult_t game_result;
|
||
Referee_GameRobotHP_t game_robot_hp;
|
||
Referee_Event_t event;
|
||
Referee_Warning_t warning;
|
||
Referee_DartInfo_t dartinfo;
|
||
Referee_RobotStatus_t robot_status;
|
||
Referee_PowerHeat_t power_heat;
|
||
Referee_RobotPos_t robot_pos;
|
||
Referee_RobotBuff_t robot_buff;
|
||
Referee_RobotDamage_t robot_danage;
|
||
Referee_ShootData_t shoot_data;
|
||
Referee_BulletRemain_t bullet_remain;
|
||
Referee_RFID_t rfid;
|
||
Referee_DartClient_t dart_client;
|
||
Referee_GroundRobotPos_t ground_robot_pos;
|
||
Referee_RadarMark_t radar_mark;
|
||
Referee_SentryInfo_t sentry_info;
|
||
Referee_RadarInfo_t radar_info;
|
||
Referee_RobotInteraction_t robot_interaction;
|
||
Referee_RobotInteractionLayerDelete_t robot_interaction_layer_delete;
|
||
Referee_InteractionFigure_t interaction_figure;
|
||
Referee_InteractionFigure2_t interaction_figure2;
|
||
Referee_InteractionFigure3_t interaction_figure3;
|
||
Referee_InteractionFigure4_t interaction_figure4;
|
||
Referee_ExtClientCustomCharacter_t ext_client_custom_character;
|
||
Referee_SentryCmd_t sentry_cmd;
|
||
Referee_RadarCmd_t radar_cmd;
|
||
Referee_MapCommand_t map_command;
|
||
Referee_MapRobotData_t map_robot_data;
|
||
Referee_MapData_t map_data;
|
||
Referee_CustomInfo_t custom_info;
|
||
Referee_CustomRobot_t custom_robot;
|
||
Referee_RobotCustom_t robot_custom;
|
||
Referee_RobotCustom2_t robot_custom2;
|
||
Referee_KeyboardMouse_t keyboard_mouse_t;
|
||
Referee_CustomClient_t custom_client;
|
||
Referee_MapRobotData_t map_oppsite_robot_data;
|
||
Referee_OppisiteGameRobotHP_t oppsite_robotHP;
|
||
Referee_OppsiteBulletRemain_t oppsite_bullet_remain;
|
||
Referee_OppsiteRobotState_t oppsite_robot_satate;
|
||
Referee_OppsiteRobotBuff_t oppsite_robot_buff;
|
||
Referee_OppsiteDisturbingWaveKey_t opsite_DisturbingWave_key;
|
||
|
||
|
||
|
||
|
||
|
||
|
||
Referee_ICRAZoneStatus_t icra_zone;
|
||
Referee_FieldEvents_t field_event;
|
||
Referee_SupplyAction_t supply_action;
|
||
Referee_RequestSupply_t request_supply;
|
||
Referee_DartCountdown_t dart_countdown;
|
||
Referee_DroneEnergy_t drone_energy;
|
||
Referee_InterStudent_Custom_t custom;
|
||
Referee_ClientMap_t client_map;
|
||
osTimerId_t ui_fast_timer_id;
|
||
osTimerId_t ui_slow_timer_id;
|
||
} Referee_t;
|
||
|
||
typedef struct __packed {
|
||
/* UI缓冲数据 */
|
||
UI_Ele_t grapic[REF_UI_MAX_GRAPIC_NUM];
|
||
UI_Drawcharacter_t character_data[REF_UI_MAX_STRING_NUM];
|
||
UI_Del_t del[REF_UI_MAX_DEL_NUM];
|
||
/* 待发送数量 */
|
||
uint8_t grapic_counter;
|
||
uint8_t character_counter;
|
||
uint8_t del_counter;
|
||
/* UI所需信息 */
|
||
Cap_RefereeUI_t cap_ui;
|
||
Chassis_RefereeUI_t chassis_ui;
|
||
Shoot_RefereeUI_t shoot_ui;
|
||
Gimbal_RefereeUI_t gimbal_ui;
|
||
bool cmd_pc;
|
||
/* 屏幕分辨率 */
|
||
const Referee_Screen_t *screen;
|
||
} Referee_UI_t;
|
||
|
||
|
||
typedef struct __packed {
|
||
uint16_t data_cmd_id;
|
||
uint16_t sender_ID;
|
||
uint16_t receiver_ID;
|
||
} Referee_Interactive_Header_t;
|
||
|
||
typedef struct __packed {
|
||
Referee_Header_t header;
|
||
uint16_t cmd_id;
|
||
Referee_Interactive_Header_t IA_header;
|
||
UI_Drawgrapic_1_t data;
|
||
uint16_t crc16;
|
||
} Referee_UI_Drawgrapic_1_t;
|
||
|
||
typedef struct __packed {
|
||
Referee_Header_t header;
|
||
uint16_t cmd_id;
|
||
Referee_Interactive_Header_t IA_header;
|
||
UI_Drawgrapic_2_t data;
|
||
uint16_t crc16;
|
||
} Referee_UI_Drawgrapic_2_t;
|
||
|
||
typedef struct __packed {
|
||
Referee_Header_t header;
|
||
uint16_t cmd_id;
|
||
Referee_Interactive_Header_t IA_header;
|
||
UI_Drawgrapic_5_t data;
|
||
uint16_t crc16;
|
||
} Referee_UI_Drawgrapic_5_t;
|
||
|
||
typedef struct __packed {
|
||
Referee_Header_t header;
|
||
uint16_t cmd_id;
|
||
Referee_Interactive_Header_t IA_header;
|
||
UI_Drawgrapic_7_t data;
|
||
uint16_t crc16;
|
||
} Referee_UI_Drawgrapic_7_t;
|
||
|
||
typedef struct __packed {
|
||
Referee_Header_t header;
|
||
uint16_t cmd_id;
|
||
Referee_Interactive_Header_t IA_header;
|
||
UI_Drawcharacter_t data;
|
||
uint16_t crc16;
|
||
} Referee_UI_Drawcharacter_t;
|
||
|
||
typedef struct __packed {
|
||
Referee_Header_t header;
|
||
uint16_t cmd_id;
|
||
Referee_Interactive_Header_t IA_header;
|
||
UI_Del_t data;
|
||
uint16_t crc16;
|
||
} Referee_UI_Del_t;
|
||
|
||
|
||
/* Exported functions prototypes -------------------------------------------- */
|
||
int8_t Referee_Init(Referee_t *ref, Referee_UI_t *ui,
|
||
const Referee_Screen_t *screen);
|
||
int8_t Referee_Restart(void);
|
||
|
||
int8_t Referee_StartReceiving(Referee_t *ref);
|
||
int8_t Referee_Parse(Referee_t *ref);
|
||
void Referee_HandleOffline(Referee_t *referee);
|
||
int8_t Referee_SetHeader(Referee_Interactive_Header_t *header,
|
||
Referee_StudentCMDID_t cmd_id, uint8_t sender_id);
|
||
int8_t Referee_StartSend(uint8_t *data, uint32_t len);
|
||
int8_t Referee_MoveData(void *data, void *tmp, uint32_t len);
|
||
int8_t Referee_PackUI(Referee_UI_t *ui, Referee_t *ref);
|
||
UI_Ele_t *Referee_GetGrapicAdd(Referee_UI_t *ref_ui);
|
||
UI_Drawcharacter_t *Referee_GetCharacterAdd(Referee_UI_t *ref_ui);
|
||
uint8_t Referee_PraseCmd(Referee_UI_t *ref_ui, Referee_UI_CMD_t cmd);
|
||
uint8_t Referee_PackCap(Referee_ForCap_t *cap, const Referee_t *ref);
|
||
uint8_t Referee_PackShoot(Referee_ForShoot_t *ai, Referee_t *ref);
|
||
uint8_t Referee_PackChassis(Referee_ForChassis_t *chassis,
|
||
const Referee_t *ref);
|
||
uint8_t Referee_PackAI(Referee_ForAI_t *shoot, const Referee_t *ref);
|
||
uint8_t Referee_UIRefresh(Referee_UI_t *ui);
|
||
#ifdef __cplusplus
|
||
}
|
||
#endif
|