/*
 * can_comm.h
 *
 *  Created on: Jun 28, 2022
 *      Author: LUBI
 */

/**************INCLUDE BLOCK**************/
#ifndef INC_CAN_COMM_H_
#define INC_CAN_COMM_H_


/***********INCLUDE BLOCK END*************/


/***** Data Type, Constant, and Macro Definitions *****/

/* Global variables*/
struct chargersts
{
	char charging_G1;
	char charging_G2;
	char empress;
	char resetactive;
	char doorlock;
	char G1_fault;
	char G2_fault;
	char G_fault;

};

/* Extern Data Declarations */
extern volatile uint8_t relaysts_ac02sts;
extern uint8_t can2TX_msg[8], can2TX_msg_2[8], tx_can2flag;
extern uint8_t AC02_stop_flag, Authentication_done;
extern struct chargersts chrgsts;

/* Static Data Declarations */
#define enable 	1
#define disable 0

#define can2TX_stsbits				 0
#define can2TX_errorFlag 			 1
#define can2TX_ele_isolationMSB 	 2
#define can2TX_ele_isolationLSB 	 3
#define can2TX_stsbits_IMD2 		 4
#define can2TX_errorFlag_IMD2 		 5
#define can2TX_ele_isolationMSB_IMD2 6
#define can2TX_ele_isolationLSB_IMD2 7

#define can2TX_SWstatus    	0
#define can2TX_exhaustfan  	1
#define can2TX_dcpostemp   	2
#define can2TX_dcnegtemp   	3
#define can2TX_dcpostemp_2 	4
#define can2TX_dcnegtemp_2 	5
#define can2TX_SWstatus_2	6
#define can2TX_exhaust_temp 7


/***** Data Type, Constant, and Macro Definitions END *****/

/***** Public Function Bodies *****/
void maxwellTest(char id);

void can_tx_temperature(void);
void can_tx_reset(void);
void can_tx_vbmax(void);
void can_tx_Isolation_State(void);
void can_tx_Error_Flag(void);
void can_rx(void);
void can_filterconfig(void);
void can2_tx_frame(void);
void can2_filterconfig(void);
void can2_tx_frame_2(void);
/***** Public Function Bodies END *****/

#endif /* INC_CAN_COMM_H_ */
