#include "..\HardwareProfile.h"

#if 0
/***********************************************************

	PICSYS18 USB Sample
	io_cfg.h

	Version 0.92: 2009/09/21

	Copyright (C) 2008-2009, MicroFan Div., PeopleMedia, Inc.
	All rights reserved.

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


#ifndef HARDWARE_PROFILE_H
#define HARDWARE_PROFILE_H


/******** Application specific definitions *************************/
#define PROGRAMMABLE_WITH_USB_HID_BOOTLOADER

/** I/O pin definitions ********************************************/
#define INPUT_PIN 1
#define OUTPUT_PIN 0


#if defined(__18F4550)

/******** USB stack hardware selection options *********************/
#define self_power          1
#define USB_BUS_SENSE       1

/** Board definition ***********************************************/
#define DEMO_BOARD PICSYS18_SP
#define PICSYS18_SP
#define CLOCK_FREQ 48000000


/** LED ************************************************************/
#define mInitAllLEDs()      LATCbits.LATC1=1; TRISCbits.TRISC1=0; LATDbits.LATD7 = 1; TRISDbits.TRISD7=0;

#define mLED_1              LATCbits.LATC1
#define mLED_2              LATDbits.LATD7
    
#define mGetLED_1()         mLED_1
#define mGetLED_2()         mLED_2

#define mLED_1_On()         mLED_1 = 0;
#define mLED_2_On()         mLED_2 = 0;
    
#define mLED_1_Off()        mLED_1 = 1;
#define mLED_2_Off()        mLED_2 = 1;
    
#define mLED_1_Toggle()     mLED_1 = !mLED_1;
#define mLED_2_Toggle()     mLED_2 = !mLED_2;
    
/** SWITCH *********************************************************/
#define mInitAllSwitches()  TRISB |= 0x38;
#define mInitSwitch2()      TRISB |= 0x38;
#define mInitSwitch3()      mInitSwitch2();
#define sw2                 PORTBbits.RB1
#define sw3                 PORTBbits.RB2
#define sw_n                 PORTBbits.RB2
#define sw_s                 PORTBbits.RB3
#define sw_e                 PORTBbits.RB5
#define sw_w                 PORTBbits.RB4
    

#elif defined(__18F26J50)

    /******** USB stack hardware selection options *********************/
    #define self_power          1
    #define USB_BUS_SENSE       1 

    /** Board definition ***********************************************/
    #define DEMO_BOARD PICSYS18_XBEE
    #define PICSYS18_XBEE
    #define CLOCK_FREQ 48000000
    #define GetSystemClock() CLOCK_FREQ   

    /** LED ************************************************************/
    #define mInitAllLEDs()      LATCbits.LATC2 = 0; LATBbits.LATB7 = 0; TRISCbits.TRISC2 = 0; TRISBbits.TRISB7 = 0;
    
    #define mLED_1              LATCbits.LATC2
    #define mLED_2              LATBbits.LATB7
    
    #define mGetLED_1()         mLED_1
    #define mGetLED_2()         mLED_2

    #define mLED_1_On()         mLED_1 = 1;
    #define mLED_2_On()         mLED_2 = 1;
    
    #define mLED_1_Off()        mLED_1 = 0;
    #define mLED_2_Off()        mLED_2 = 0;
    
    #define mLED_1_Toggle()     mLED_1 = !mLED_1;
    #define mLED_2_Toggle()     mLED_2 = !mLED_2;
    
    /** SWITCH *********************************************************/
    #define mInitAllSwitches()  TRISA |= 0xc0;TRISB |= 0x38;
    #define mInitSwitch2()      TRISA |= 0xc0;TRISB |= 0x38;
    #define mInitSwitch3()      mInitSwitch2();
    #define sw2                 PORTBbits.RB5
    #define sw3                 PORTBbits.RB2
    #define sw_n                 PORTAbits.RA6
    #define sw_s                 PORTBbits.RB4
    #define sw_e                 PORTBbits.RB3
    #define sw_w                 PORTAbits.RA7


/*------------------------------------------------------------------*/

#elif defined(__18F2550)
/******** USB stack hardware selection options *********************/
#define self_power          1
#define USB_BUS_SENSE       1

/** Board definition ***********************************************/
#define DEMO_BOARD PIC18_DEV_2550URL
#define PIC18_DEV_2550URL
#define CLOCK_FREQ 48000000


/** LED ************************************************************/
#define mInitAllLEDs()      LATA |= 0x30; TRISA &= 0xCF;

#define mLED_1              LATAbits.LATA4
#define mLED_2              LATAbits.LATA5

#define mGetLED_1()         mLED_1
#define mGetLED_2()         mLED_2

#define mLED_1_On()         mLED_1 = 0;
#define mLED_2_On()         mLED_2 = 0;

#define mLED_1_Off()        mLED_1 = 1;
#define mLED_2_Off()        mLED_2 = 1;

#define mLED_1_Toggle()     mLED_1 = !mLED_1;
#define mLED_2_Toggle()     mLED_2 = !mLED_2;


/** S W I T C H *****************************************************/
#define mInitAllSwitches()  TRISB |= 0xfc;TRISCbits.TRISC1=0;LATCbits.LATC1=0;INTCON2bits.RBPU = 0;
#define mInitSwitch2()      TRISBbits.TRISB2=1;
#define sw2                 PORTBbits.RB2
#define sw_n                 PORTBbits.RB4
#define sw_s                 PORTBbits.RB5
#define sw_e                 PORTBbits.RB7
#define sw_w                 PORTBbits.RB6

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

#endif  //HARDWARE_PROFILE_H
#endif
