#include "DSP2833x_Device.h"     // DSP281x Headerfile Include File

extern int Mode,Desk,CanDevAdr,TermoAD,TermoRS,TermoSW;

void setup_leds_line(void);

#define led1_toggle()	GpioDataRegs.GPBTOGGLE.bit.GPIO32=1
#define led2_toggle()	GpioDataRegs.GPBTOGGLE.bit.GPIO48=1
#define led1_off()	GpioDataRegs.GPBSET.bit.GPIO32=1
#define led2_off()	GpioDataRegs.GPBSET.bit.GPIO48=1
#define led1_on()	GpioDataRegs.GPBCLEAR.bit.GPIO32=1
#define led2_on()	GpioDataRegs.GPBCLEAR.bit.GPIO48=1

//	READY	---------------------------------------------------------
static inline void dat_READY(int x)
{	GpioDataRegs.GPBDAT.bit.GPIO59=!x;	}
static inline void set_READY(void)
{	GpioDataRegs.GPBCLEAR.bit.GPIO59=1;	}
static inline void clear_READY(void)
{	GpioDataRegs.GPBSET.bit.GPIO59=1;	}
static inline void toggle_READY(void)
{	GpioDataRegs.GPBTOGGLE.bit.GPIO59=1;}

//	STROBE	-----------------------------------------------------
static inline void dat_STROBE(int x)
{	GpioDataRegs.GPADAT.bit.GPIO0=!x;	}
static inline void set_STROBE(void)
{	GpioDataRegs.GPASET.bit.GPIO0=1;	}
static inline void clear_STROBE(void)
{	GpioDataRegs.GPACLEAR.bit.GPIO0=1;	}
static inline void toggle_STROBE(void)
{	GpioDataRegs.GPATOGGLE.bit.GPIO0=1;	}

//	LED OUT 1	-----------------------------------------------------
static inline void dat_LED_OUT_1(int x)
{	if(Desk==dsk_BKSD)	GpioDataRegs.GPBDAT.bit.GPIO60=x;
	else				GpioDataRegs.GPBDAT.bit.GPIO60=!x;	}
static inline void set_LED_OUT_1(void)
{	if(Desk==dsk_BKSD)	GpioDataRegs.GPBSET.bit.GPIO60=1;
	else				GpioDataRegs.GPBCLEAR.bit.GPIO60=1;	}
static inline void clear_LED_OUT_1(void)
{	if(Desk==dsk_BKSD)	GpioDataRegs.GPBCLEAR.bit.GPIO60=1;
	else				GpioDataRegs.GPBSET.bit.GPIO60=1;	}
static inline void toggle_LED_OUT_1(void)
{						GpioDataRegs.GPBTOGGLE.bit.GPIO60=1;}

//	LED OUT 2	-----------------------------------------------------
static inline void dat_LED_OUT_2(int x)
{	if(Desk==dsk_BKSD)	GpioDataRegs.GPBDAT.bit.GPIO63=x;
	else				GpioDataRegs.GPBDAT.bit.GPIO63=!x;	}
static inline void set_LED_OUT_2(void)
{	if(Desk==dsk_BKSD)	GpioDataRegs.GPBSET.bit.GPIO63=1;
	else				GpioDataRegs.GPBCLEAR.bit.GPIO63=1;	}
static inline void clear_LED_OUT_2(void)
{	if(Desk==dsk_BKSD)	GpioDataRegs.GPBCLEAR.bit.GPIO63=1;
	else				GpioDataRegs.GPBSET.bit.GPIO63=1;	}
static inline void toggle_LED_OUT_2(void)
{						GpioDataRegs.GPBTOGGLE.bit.GPIO63=1;}

extern int ExtraCanal[];
void select_tpl_canal(int n_tpl);
void select_tpl_255();

void get_Mode(void);
void get_Buttons(void);


