/*
 * BHBF_ROBOT.h
 *
 *  Created on: Oct 26, 2023
 *      Author: shiya
 */

#ifndef INC_BHBF_ROBOT_H_
#define INC_BHBF_ROBOT_H_

#define DF_GL_MotorNum 4

#include "MSP/msp_TI5MOTOR.h"
#include "BSP/bsp_include.h"
#include "MSP/msp_JTBATTERY.h"
#include "MSP/msp_MK32.h"
#include "MSP/msp_OBD.h"
#include "MSP/msp_DH_W_H.h"
#include "BSP/bsp_IMU.h"
#include "MSP/msp_Water_Cannon.h"
#include "MSP/msp_MF_Gyroscope.h"

#include "MSP/msp_TL720D.h"
#include "MSP/msp_PID.h"

//FLASH (rx)     : ORIGIN = 0x08020000, LENGTH = 896K
//#define VECT_TAB_OFFSET         0x00020000U

//关键全局变量定义：GV、CV、PV
//其他变量定义：X1_X2_X3_X4
//X1：变量类型
//X2：所属层级 GL、MSP、BSP
//X3：所属模块
//X4：名称

//全局变量定义 X1=V
//宏定义 X1=DF
//结构体类型声明 X1=SP
//结构体定义 X1=ST
//指针类型定义 X1=P
//全局函数定义 X1=GF
//内部函数定义 X1为空，不要下划线，X2开头
//函数参数定义、函数局部变量定义  X1为空，下划线开头




struct CV_struct_define{
	int32_t Speed_1;
	int32_t Speed_2;
	int32_t Speed_3;
};

struct GV_struct_define
{
	int32_t State_Index_U;
	int32_t State_Index_U_Elapse;
	int32_t State_Index_N;
	int32_t State_Index_N_Elapse;

	int32_t NC_ARRAY_u8_0;//5
	int32_t NC_ARRAY_u8_01;
	int32_t NC_ARRAY_u8_1;
	int32_t NC_ARRAY_u8_11;
	int32_t NC_ARRAY_u8_2;


	MotorParameters Motor_P[6];//-28
	SP_MSP_DH_Handset_Parameters DH_WH_HandSet;
	SP_BSP_MPU6050   Robot_Angle;
//	SP_MSP_MK32_Button MK32;
	SP_MSP_RF_TL720D_Parameters   EX_RF_TL720D;

	SP_MSP_Gyro_parameters Gyro_MFOG40;


};

struct PV_struct_define{

	int32_t MK32_RxIndex_Last;
	int32_t State_Index_U_Last;
	int32_t State_Index_N_Last;
};


//Global variables related to program execution interfaces
//Interface variables, decision variables
//All types are int32_t
extern struct GV_struct_define GV;

//Process variables related to program execution buffering
//Temporary variables, buffers,intermediate variable
extern struct PV_struct_define PV;

//Configuration variables related to robots
extern struct CV_struct_define CV;

void GF_Robot_Init(void);
void GF_Robot_MainLoop(void);
void GF_WatchDog_Loop(void);

#endif /* INC_BHBF_ROBOT_H_ */
