#ifndef APP_CAN_H
#define APP_CAN_H

enum
{
	OPERATE_GND_INPUT = 1,
	OPERATE_NOR_INPUT,	
	OPERATE_UN_INPUT,
	OPERATE_UNIBA_INPUT,
	OPERATE_UNIBB_INPUT,
	
	OPERATE_POWERA_INPUT,
	OPERATE_POWERB_INPUT,
	
	OPERATE_UNIBA0_INPUT,
	OPERATE_UNIBB0_INPUT,
	OPERATE_READ_DATA,//0X0A
	OPERATE_POWER_DATA,
	OPERATE_ENERGY_DATA,

	OPERATE_DEEP_DATA,
	
	OPERATE_ERASE_RECORD_TIMES,// 0X0E

	OPERATE_RECORD_DATA,//0x0F

	OPERATE_LOW_SHAKE_DATA,//0x10

	OPERATE_MEASURE_LOW_VOL,//0x11

	OPERATE_TIMES_DATA,//0X12
	
	OPERATE_MAX 
};

#define CAN_BMS_TX_BUF_MAX  (CAN_TX_BUF_MAX >> 0)
#define CAN_CTR_TX_BUF_MAX  (CAN_TX_BUF_MAX >> 0)
#define CAN_ADAS_TX_BUF_MAX  (CAN_TX_BUF_MAX >> 2)

#pragma  pack (push,1)  
typedef struct
{
	uint16_t key;
	
	uint8_t m_percent;
	
	uint8_t charge_flag;

	uint16_t work_status;

	uint8_t bms_status;
}BMS_SELF_SEND_STATUS;
#define RESOLUTION_DELTA_50M    (50)
#define RESOLUTION_DELTA_10M    (10)
typedef struct
{
	uint16_t key;
	
	int16_t m_cur;
	
	uint16_t m_vol;

}BMS_SELF_CUR_VOL_STATUS;
#pragma pack(pop)

void Can_Com_Initial(void);

int8_t Handle_Can_Data(void);

void Can_Test(void);

int8_t Resend_can_bms_1_frame(void);

int8_t Resend_can_bms_2_frame(void);

int8_t Resend_can_ctr_frame(void);

int8_t Resend_can_adas_frame(void);

int8_t Timeout_Resend_can_bms_1_frame(void);

int8_t Timeout_Resend_can_bms_2_frame(void);

int8_t Timeout_Resend_can_ctr_frame(void);

int8_t Timeout_Resend_can_adas_frame(void);

void ADAS_Self_Send_Up(void);

void Check_Can_Self_Send_Status(void);

#endif

