/********************************************************************
 FileName:     	HardwareProfile.h
 Dependencies:	See INCLUDES section
 Processor:		PIC18 or PIC24 USB Microcontrollers
 Hardware:		The code is natively intended to be used on the following
 				hardware platforms: PICDEM™ FS USB Demo Board, 
 				PIC18F87J50 FS USB Plug-In Module, or
 				Explorer 16 + PIC24 USB PIM.  The firmware may be
 				modified for use on other USB platforms by editing this
 				file (HardwareProfile.h).
 Complier:  	Microchip C18 (for PIC18) or C30 (for PIC24)
 Company:		Microchip Technology, Inc.

 Software License Agreement:

 The software supplied herewith by Microchip Technology Incorporated
 (the “Company”) for its PIC® Microcontroller is intended and
 supplied to you, the Company’s customer, for use solely and
 exclusively on Microchip PIC Microcontroller products. The
 software is owned by the Company and/or its supplier, and is
 protected under applicable copyright laws. All rights are reserved.
 Any use in violation of the foregoing restrictions may subject the
 user to criminal sanctions under applicable laws, as well as to
 civil liability for the breach of the terms and conditions of this
 license.

 THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
 WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
 TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
 IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
 CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.

********************************************************************
 File Description:

 Change History:
  Rev   Date         Description
  1.0   11/19/2004   Initial release
  2.1   02/26/2007   Updated for simplicity and to use common
                     coding style

********************************************************************/

#ifndef HARDWARE_PROFILE_H
#define HARDWARE_PROFILE_H

//ETT:ET-BASE PIC16/18F(PIC18F4550-USB)
#define DEMO_BOARD 				ET_BASE_PIC18_USB 
#define ET_BASE_PIC18_USB
#define CLOCK_FREQ 				48000000
#define GetSystemClock()        48000000

/** USB ************************************************************/
#if defined(ET_BASE_PIC18_USB)
	//The PICDEM FS USB Demo Board platform supports the USE_SELF_POWER_SENSE_IO
	//and USE_USB_BUS_SENSE_IO features.  Uncomment the below line(s) if
	//it is desireable to use one or both of the features.
	//#define USE_SELF_POWER_SENSE_IO	

	#define USE_USB_BUS_SENSE_IO

	//#define PROGRAMMABLE_WITH_USB_MCHPUSB_BOOTLOADER	//Uncomment this to make the output HEX of this project work with the MCHPUSB Bootloader
	//#define PROGRAMMABLE_WITH_USB_HID_BOOTLOADER		//Uncomment this to make the output HEX of this project work with the HID Bootloader

    #define tris_usb_bus_sense  TRISCbits.TRISC2    	// Input RC2 : Detect VBUS
    
    #if defined(USE_USB_BUS_SENSE_IO)
    #define USB_BUS_SENSE       PORTCbits.RC2
    #else
    #define USB_BUS_SENSE       1
    #endif
    
    #define self_power          1
  
    /** LED(RA2)*******************************************************/
    #define mInitLED1()         LATA &= 0xFB; TRISA &= 0xFB;	
    #define mLED_1              LATAbits.LATA2    
    #define mLED_1_On()         mLED_1 = 1;    
    #define mLED_1_Off()        mLED_1 = 0;
    #define mLED_1_Toggle()     mLED_1 = !mLED_1;

    /** SWITCH(RA1)****************************************************/
    #define mInitSwitch1()      TRISAbits.TRISA1=1;
    #define sw1                 PORTAbits.RA1
    
    /** POT(RA0)*******************************************************/
    #define mInitPOT()          {TRISAbits.TRISA0=1;ADCON0=0x01;ADCON2=0x3C;ADCON2bits.ADFM = 1;}

    /** RS232 lines(UART1)*********************************************/
    #define UART_TRISTx   		TRISCbits.TRISC6
    #define UART_Tx       		PORTCbits.RC6 
	#define UART_TRISRx   		TRISCbits.TRISC7
	#define UART_Rx       		PORTCbits.RC7    
    #define UART_ENABLE 		RCSTAbits.SPEN 

#endif
//ETT:ET-BASE PIC16/18F(PIC18F4550-USB)

#if !defined(DEMO_BOARD)
    #error "Demo board not defined.  Either define DEMO_BOARD for a custom board or select the correct processor for the demo board."
#endif

/** TRIS ***********************************************************/
#define INPUT_PIN           	1
#define OUTPUT_PIN          	0

#endif  //HARDWARE_PROFILE_H
