#ifndef APP_END_CTR_H
#define APP_END_CTR_H

#define LEFT_LIGHT  (0x01)
#define RIGHT_LIGHT (0x02)
#define LIANG_TIME  (200)
#define ZONG_TIME    (900)

#define SHIELD_XL_TIME    (400)


//END CTR
#define KEY_END_CTR_COMMON          (0x4200)
#define KEY_END_CTR_SWI_BAT         (0x4201)
#define KEY_END_CTR_BAT_INT_EN      (0x4202)
#define KEY_END_CTR_BAT_INT_PRE     (0x4203)
#define KEY_END_CTR_SOFT_WARE       (0x4204)
#define KEY_END_CTR_SN				(0x4205)
#define KEY_END_CTR_WRITER_SN		(0x4206)
#define KEY_END_CTR_BAT_UPDATE_REQ	(0x4207)
#define KEY_END_CTR_BAT_UPDATE		(0x4208)
#define KEY_END_CTR_BAT_UPDATE_EXIT	(0x4209)
#define KEY_END_CTR_DAN_CI_LI_CHENG	(0x420A)
#define KEY_END_CTR_ZHEN_JI_CE_SHI	(0x420B)
#define KEY_END_CTR_SELF_UP         (0x4280)


#define KEY_END_CTR_QD  			(0x4301)
#define KEY_END_CTR_LOCK  			(0x4302)
#define KEY_END_CTR_ACC12  			(0x4306)
#define KEY_END_CTR_ACC12_TEST		(0x4307)
#define KEY_END_CTR_ACC12_TEST_1	(0x4308)
#define KEY_END_CTR_L_R_LIGHT		(0x4303)
#define KEY_END_CTR_CARPET_LIGHT	(0x4305)
#define KEY_END_CTR_TAIL_LIGHT		(0x4318)

#define KEY_END_CTR_HEART_TICK		(0x4800)



#pragma  pack (push,1)  
typedef struct
{
	uint16_t key;
	uint8_t op_result;
	
	uint8_t qd_sta:1;
	uint8_t lock_sta:1;
	uint8_t xl_sta:1;
	uint8_t side_sta:1;
	uint8_t sit_sta:1;
	uint8_t carpet_sta:1;
	uint8_t tail_sta:1;
	uint8_t soak_sta:1;

	uint8_t acc12_sta:1;
	uint8_t charger_in:1;
	uint8_t res4_sta:6;

	
	int8_t moto_temp;


	int8_t ps100_temp;
	uint8_t bms_1_status;
	uint8_t bms_2_status;
	uint8_t using_bms_mode;
	uint16_t nhb;
	
}END_CTR_SELF_SEND_STATUS;
#pragma pack(pop)
extern END_CTR_SELF_SEND_STATUS end_ctr_self_ss;
extern END_CTR_SELF_SEND_STATUS end_ctr_self_ss_new;
extern END_CTR_SELF_SEND_STATUS end_ctr_rsp;
extern DELAY_COMMON end_ctr_self_stimeout;


int8_t Handle_Can_Ctr_CMD(CAN_FRAME*can_ctr_frame);

int8_t Rsp_Can_Ctr_CMD(CAN_FRAME*can_ctr_frame);

void Can_End_Ctr_Self_Send_Check(CAN_FRAME*can_ctr_frame);

void End_Ctr_Initial(void);

void Check_End_Ctr_Status(void);

void End_Ctr_Self_Send_Timeout(void);

void ACC12_OVER_Loader_Timeout(void);

void ACC12_OVER_Loader_Interrupt(void);

void Shield_XL_Timeout(void);

#endif

