/*
 * ext_var.c
 *
 *  Created on: Mar 2, 2023
 *      Author: LUBI
 */
#include "ext_var.h"
////////////////-ADC module-/////////////////
uint8_t CURRENT_STATE=10,CURRENT_STATE_1=10,adc_init=0,adc_init_2;
uint8_t count_C=0,count_A=0,count_B=0,count_C_2=0,count_A_2=0,count_B_2=0,count_D_2=0;
uint32_t adc1_dat[2];

////////////////////////////////////////////

volatile uint16_t blue_led_blink=0,blue_led_blink_1=0;
volatile uint16_t red_led_blink=0,red_led_blink_1=0;
volatile uint16_t green_led_blink=0,green_led_blink_1=0;
volatile uint16_t Emergency_stop_count=0,GFD_stop_count=0,user1_stop_count=0,user2_stop_count=0;
volatile uint16_t buzzer_enable_time=0;
volatile char buzzer_enable;

volatile char GFD_stop=0,Emergency_stop=0,alarm=0,user1_stop=0,user2_stop=0;
volatile uint8_t pwm_start_stop=0,pwm_start_stop_1=0;
char lclflagLED=0;
uint16_t cp_val=0,cp_val_2;

char adctempcnt,adctempcnt_1;
//////////////////////////////////////////

uint8_t ui8onesectickcnt=0,ui8secondcnt=0,ui8fivesectimeout=0;

uint16_t PWM_DutyCycle=53;
uint16_t Dutycycle=0;
uint8_t powerONflag=0,powerONflag1=0;

uint8_t id[15],rxbuff[60],rxchar=0,startFrame=0,cmdrxd=0,configmode=0;

char Txbuff[100];
int TxbuffIndex=0;

int countdisturbance =0;

////////////////////////////////////////
struct charger_parameters GUN1,GUN2;
struct configuration_para configparameters;

const struct configuration_para default_params = {

	1,
	0,
	3650,
	3150,
	2710,
	2100,
	"00000000000000",
	"00000000000000",
	0xAA66 //Magic Value
};


/*
uint16_t STATE_A_LEVEL=3350;	//3080//2301// 2433//2540//2580 //3460
uint16_t STATE_B_LEVEL=2880;	//2720//2224 //2108//2250//2380 //2983
uint16_t STATE_C_LEVEL=2500;	//2390//2130 //1810//1950//2180  //2549
uint16_t STATE_D_LEVEL=2100;	//2015//2015  //1980
*/


union convert
{
	unsigned short int word;
	uint32_t dword;
	float dfloat;
	unsigned char byte[4];
};


