/*
 * ext_var.h
 *
 *  Created on: Mar 2, 2023
 *      Author: LUBI
 */
#include "stdint.h"


#ifndef INC_EXT_VAR_H_
#define INC_EXT_VAR_H_


////////////////-ADC module-/////////////////
extern uint8_t CURRENT_STATE,CURRENT_STATE_1,adc_init,adc_init_2;

extern uint32_t adc1_dat[2];

#define STATE_A   0
#define STATE_B   1
#define STATE_C   2
#define STATE_D   3

/*
#define STATE_A_LEVEL 3350	//3080//2301// 2433//2540//2580 //3460
#define STATE_B_LEVEL 2880	//2720//2224 //2108//2250//2380 //2983
#define STATE_C_LEVEL 2500	//2390//2130 //1810//1950//2180  //2549
#define STATE_D_LEVEL 2100	//2015//2015  //1980
*/
//extern uint16_t STATE_A_LEVEL,STATE_B_LEVEL,STATE_C_LEVEL,STATE_D_LEVEL;
extern uint8_t count_C,count_A,count_B,count_C_2,count_A_2,count_B_2,count_D_2;

extern uint16_t cp_val,cp_val_2;
////////////////////////commands/////////////////////
#define configmodeEn '0'
#define GFDconf '1'
#define AddRFIDgun1 '2'
#define AddRFIDgun2 '3'
#define removeReadRFIDgun1 '4'
#define removeReadRFIDgun2 '5'
#define bypassRFIDen '6'
#define readCPcnt '7'
#define setcnt '8'


/////////////////////peripheral ////////////////////////////
extern volatile uint16_t blue_led_blink,blue_led_blink_1;
extern volatile uint16_t red_led_blink,red_led_blink_1;
extern volatile uint16_t green_led_blink,green_led_blink_1;
extern volatile uint16_t Emergency_stop_count,GFD_stop_count,user1_stop_count,user2_stop_count;
extern volatile uint16_t buzzer_enable_time;
extern volatile char buzzer_enable;

extern volatile char GFD_stop,Emergency_stop,alarm,user1_stop,user2_stop;
extern char lclflagLED;
///////////////////////////////////////////////////////////
extern uint8_t ui8onesectickcnt,ui8secondcnt,ui8fivesectimeout;

extern uint16_t PWM_DutyCycle;
extern uint16_t Dutycycle;
extern uint8_t powerONflag,powerONflag1;

extern volatile uint8_t pwm_start_stop,pwm_start_stop_1;
extern char adctempcnt,adctempcnt_1;

extern uint8_t id[15],rxbuff[60],rxchar,startFrame,cmdrxd,configmode;
extern char Txbuff[100];
extern int TxbuffIndex;

extern int countdisturbance;
/////////////////////////////////////////////////////////////
struct charger_parameters
{
	uint8_t Authentication_done;
	uint8_t chargingStart,chargingStop;
	uint8_t Type2_OCPP_Authorization_Flag;
	//char TagId[20];
};

extern struct charger_parameters GUN1,GUN2;

struct configuration_para
{
	uint8_t RFIDBypassEn;
	uint8_t GFDBypassEn;
	uint16_t STATE_A_LEVEL;
	uint16_t STATE_B_LEVEL;
	uint16_t STATE_C_LEVEL;
	uint16_t STATE_D_LEVEL;
	char  gun1TagId[14];
	char gun2TagId[14];
	uint16_t magic_value;
};

extern struct configuration_para configparameters;

extern const struct configuration_para default_params;


#endif /* INC_EXT_VAR_H_ */
