#ifndef	MAIN_H
#define	MAIN_H

//#define	INTERRUPT_PRIORITY

#define	OSC_FREQ		48000000		// 48 MHz
#define	FREQUENCY		OSC_FREQ / 4	// 12 MHz
#define	BUTTON_INPUT	TRISB = TRISB | 0x01
#define	BUTTON_PRESSED	(~PORTB & 0x01)

#define	PHILIPS_RC5

#ifdef	PHILIPS_RC5
	#define	TOGGLE_PERIOD	83		// (Fin / 4) / 36 000; Fin = 48MHz / 4 = 12MHz --> 83.(3)
	#define	HALF_PERIOD		41		// 83/2 = 41;
	#define	PERIOD_US		868
	#define	BASIC_DELAY		480		// 480
	#define	SAMPLE_DELAY	1020	//1020
#endif

#define	OFF				0
#define	ON				1
#define	TOGGLE			2

extern unsigned char Buffer[29], Toggle, index;

#ifdef	INTERRUPT_PRIORITY
//void YourHighPriorityISRCode ();
void YourLowPriorityISRCode ();
#else
void YourISRCode ();
#endif

#pragma code

void DelayMs (volatile unsigned int Ms);

void System_Init (void);

void Digital_PIN_Init (void);

void GPIO_Init (void);

void Clock_Init (void);

void Infrared_Init (void);

void Receiver_Init (void);

void Timer2_Init (void);

void Infrared_Transmit (char State);

void Infrared_Blink_State (char State);

void Set_Command (int Address, int Data);

#endif