Rev Author Line No. Line
1661 kaklik 1 /********************************************************************
2 FileName: HardwareProfile - UBW.h
3 Dependencies: See INCLUDES section
4 Processor: PIC18 USB Microcontrollers
5 Hardware: PICDEM FSUSB
6 Compiler: Microchip C18
7 Company: Microchip Technology, Inc.
8  
9 Software License Agreement:
10  
11 The software supplied herewith by Microchip Technology Incorporated
12 (the “Company”) for its PIC® Microcontroller is intended and
13 supplied to you, the Company’s customer, for use solely and
14 exclusively on Microchip PIC Microcontroller products. The
15 software is owned by the Company and/or its supplier, and is
16 protected under applicable copyright laws. All rights are reserved.
17 Any use in violation of the foregoing restrictions may subject the
18 user to criminal sanctions under applicable laws, as well as to
19 civil liability for the breach of the terms and conditions of this
20 license.
21  
22 THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
23 WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
24 TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
25 PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
26 IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
27 CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
28  
29 ********************************************************************
30 File Description:
31  
32 Change History:
33 Rev Date Description
34 1.0 11/19/2004 Initial release
35 2.1 02/26/2007 Updated for simplicity and to use common
36 coding style
37 2.3 09/15/2008 Broke out each hardware platform into its own
38 "HardwareProfile - xxx.h" file
39 01/15/2009 UBW support
40 ********************************************************************/
41  
42 #ifndef HARDWARE_PROFILE_UBW_H
43 #define HARDWARE_PROFILE_UBW_H
44  
45 /*******************************************************************/
46 /******** USB stack hardware selection options *********************/
47 /*******************************************************************/
48 //This section is the set of definitions required by the MCHPFSUSB
49 // framework. These definitions tell the firmware what mode it is
50 // running in, and where it can find the results to some information
51 // that the stack needs.
52 //These definitions are required by every application developed with
53 // this revision of the MCHPFSUSB framework. Please review each
54 // option carefully and determine which options are desired/required
55 // for your application.
56  
57 //The PICDEM FS USB Demo Board platform supports the USE_SELF_POWER_SENSE_IO
58 //and USE_USB_BUS_SENSE_IO features. Uncomment the below line(s) if
59 //it is desireable to use one or both of the features.
60 //#define USE_SELF_POWER_SENSE_IO
61 #define tris_self_power TRISAbits.TRISA2 // Input
62 #if defined(USE_SELF_POWER_SENSE_IO)
63 #define self_power PORTAbits.RA2
64 #else
65 #define self_power 1
66 #endif
67  
68 //#define USE_USB_BUS_SENSE_IO
69 #define tris_usb_bus_sense TRISAbits.TRISA1 // Input
70 #if defined(USE_USB_BUS_SENSE_IO)
71 #define USB_BUS_SENSE PORTAbits.RA1
72 #else
73 #define USB_BUS_SENSE 1
74 #endif
75  
76 //Uncomment the following line to make the output HEX of this
77 // project work with the MCHPUSB Bootloader
78 #define PROGRAMMABLE_WITH_USB_MCHPUSB_BOOTLOADER
79  
80 //Uncomment the following line to make the output HEX of this
81 // project work with the HID Bootloader
82 //#define PROGRAMMABLE_WITH_USB_HID_BOOTLOADER
83  
84 /*******************************************************************/
85 /******** MDD File System selection options ************************/
86 /*******************************************************************/
87 #define USE_PIC18
88  
89 #define ERASE_BLOCK_SIZE 64
90 #define WRITE_BLOCK_SIZE 32
91  
92 /*******************************************************************/
93 /*******************************************************************/
94 /*******************************************************************/
95 /******** Application specific definitions *************************/
96 /*******************************************************************/
97 /*******************************************************************/
98 /*******************************************************************/
99  
100 /** Board definition ***********************************************/
101 //These defintions will tell the main() function which board is
102 // currently selected. This will allow the application to add
103 // the correct configuration bits as wells use the correct
104 // initialization functions for the board. These defitions are only
105 // required in the stack provided demos. They are not required in
106 // final application design.
107 #define DEMO_BOARD UBW
108 #define UBW
109 #define CLOCK_FREQ 48000000
110  
111 // Special UBW emu board by YAS
112 // #define YAS
113  
114 /** LED ************************************************************/
115  
116 /* On UBW, LED1 = RC0, LED2 = RC1, SW = RC2 */
117  
118 #define mInitAllLEDs() LATC &= 0xFC; TRISC &= 0xFC;
119  
120 #define mLED_1 LATCbits.LATC0
121 #define mLED_2 LATCbits.LATC1
122  
123 #define mLED_1_On() mLED_1 = 1;
124 #define mLED_2_On() mLED_2 = 1;
125  
126 #define mLED_1_Off() mLED_1 = 0;
127 #define mLED_2_Off() mLED_2 = 0;
128  
129 #define mLED_1_Toggle() mLED_1 = !mLED_1;
130 #define mLED_2_Toggle() mLED_2 = !mLED_2;
131  
132 #if defined(YAS)
133 #define RXTX LATBbits.LATB5
134 #else
135 #define RXTX LATAbits.LATA2
136 #endif
137  
138 #define BPF_S0 LATAbits.LATA0
139 #define BPF_S1 LATAbits.LATA1
140  
141 #if defined(YAS)
142 #define BPF_S2 LATAbits.LATA2
143 #endif
144  
145 #define BPF_S0_STATE PORTAbits.RA0
146 #define BPF_S1_STATE PORTAbits.RA1
147  
148 #if defined(YAS)
149 #define BPF_S2_STATE PORTAbits.RA2
150 #endif
151  
152 #define PADDLE_DIT PORTBbits.RB6
153 #define PADDLE_DAH PORTBbits.RB7
154  
155 #define LPF_0 LATAbits.LATA3
156 #define LPF_1 LATAbits.LATA4
157 #define LPF_2 LATAbits.LATA5
158  
159 #if defined(YAS)
160 #else
161 #define LPF_3 LATBbits.LATB2
162 #define LPF_4 LATBbits.LATB3
163 #define LPF_5 LATBbits.LATB4
164 #define LPF_6 LATBbits.LATB5
165 #endif
166  
167  
168 /** S W I T C H *****************************************************/
169 #define mInitSwitch() TRISCbits.TRISC2 = 1;
170 #define UserSW PORTCbits.RC2
171  
172 #define mLED_Both_Off() {mLED_1_Off(); mLED_2_Off();}
173 #define mLED_Both_On() {mLED_1_On(); mLED_2_On();}
174 #define mLED_Only_1_On() {mLED_1_On(); mLED_2_Off();}
175 #define mLED_Only_2_On() {mLED_1_Off(); mLED_2_On();}
176  
177  
178  
179  
180  
181  
182 #endif //HARDWARE_PROFILE_UBW_H