4932 |
kaklik |
1 |
/************************************************************************ |
|
|
2 |
HardwareProfile.h |
|
|
3 |
|
|
|
4 |
WFF USB Generic HID Demonstration 3 |
|
|
5 |
usbGenericHidCommunication reference firmware 3_0_0_0 |
|
|
6 |
Copyright (C) 2011 Simon Inns |
|
|
7 |
|
|
|
8 |
This program is free software: you can redistribute it and/or modify |
|
|
9 |
it under the terms of the GNU General Public License as published by |
|
|
10 |
the Free Software Foundation, either version 3 of the License, or |
|
|
11 |
(at your option) any later version. |
|
|
12 |
|
|
|
13 |
This program is distributed in the hope that it will be useful, |
|
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
16 |
GNU General Public License for more details. |
|
|
17 |
|
|
|
18 |
You should have received a copy of the GNU General Public License |
|
|
19 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
|
20 |
|
|
|
21 |
Email: simon.inns@gmail.com |
|
|
22 |
|
|
|
23 |
************************************************************************/ |
|
|
24 |
|
|
|
25 |
#ifndef HARDWAREPROFILE_H |
|
|
26 |
#define HARDWAREPROFILE_H |
|
|
27 |
|
|
|
28 |
// USB stack hardware selection options ---------------------------------------------------------------- |
|
|
29 |
|
|
|
30 |
// (This section is the set of definitions required by the MCHPFSUSB framework.) |
|
|
31 |
|
|
|
32 |
// Uncomment the following define if you wish to use the self-power sense feature |
|
|
33 |
// and define the port, pin and tris for the power sense pin below: |
|
|
34 |
// #define USE_SELF_POWER_SENSE_IO |
|
|
35 |
#define tris_self_power TRISAbits.TRISA2 |
|
|
36 |
#if defined(USE_SELF_POWER_SENSE_IO) |
|
|
37 |
#define self_power PORTAbits.RA2 |
|
|
38 |
#else |
|
|
39 |
#define self_power 1 |
|
|
40 |
#endif |
|
|
41 |
|
|
|
42 |
// Uncomment the following define if you wish to use the bus-power sense feature |
|
|
43 |
// and define the port, pin and tris for the power sense pin below: |
|
|
44 |
//#define USE_USB_BUS_SENSE_IO |
|
|
45 |
#define tris_usb_bus_sense TRISAbits.TRISA1 |
|
|
46 |
#if defined(USE_USB_BUS_SENSE_IO) |
|
|
47 |
#define USB_BUS_SENSE PORTAbits.RA1 |
|
|
48 |
#else |
|
|
49 |
#define USB_BUS_SENSE 1 |
|
|
50 |
#endif |
|
|
51 |
|
|
|
52 |
// Uncomment the following line to make the output HEX of this project work with the MCHPUSB Bootloader |
|
|
53 |
//#define PROGRAMMABLE_WITH_USB_MCHPUSB_BOOTLOADER |
|
|
54 |
|
|
|
55 |
// Uncomment the following line to make the output HEX of this project work with the HID Bootloader |
|
|
56 |
#define PROGRAMMABLE_WITH_USB_HID_BOOTLOADER |
|
|
57 |
|
|
|
58 |
// Application specific hardware definitions ------------------------------------------------------------ |
|
|
59 |
|
|
|
60 |
// Oscillator frequency (48Mhz with a 20Mhz external oscillator) |
|
|
61 |
#define CLOCK_FREQ 48000000 |
|
|
62 |
|
|
|
63 |
// Device Vendor Indentifier (VID) (0x04D8 is Microchip's VID) |
|
|
64 |
#define USB_VID 0x04D8 |
|
|
65 |
|
|
|
66 |
// Device Product Indentifier (PID) (0x0042) |
|
|
67 |
#define USB_PID 0x0042 |
|
|
68 |
|
|
|
69 |
// Manufacturer string descriptor |
|
|
70 |
#define MSDLENGTH 10 |
|
|
71 |
#define MSD 'S','i','m','o','n',' ','I','n','n','s' |
|
|
72 |
|
|
|
73 |
// Product String descriptor |
|
|
74 |
#define PSDLENGTH 20 |
|
|
75 |
#define PSD 'W','F','F',' ','G','e','n','e','r','i','c',' ','H','I','D',' ','d','e','m','o' |
|
|
76 |
|
|
|
77 |
// Device serial number string descriptor |
|
|
78 |
#define DSNLENGTH 7 |
|
|
79 |
#define DSN 'W','F','F','_','3','.','0' |
|
|
80 |
|
|
|
81 |
// Common useful definitions |
|
|
82 |
#define INPUT_PIN 1 |
|
|
83 |
#define OUTPUT_PIN 0 |
|
|
84 |
#define FLAG_FALSE 0 |
|
|
85 |
#define FLAG_TRUE 1 |
|
|
86 |
|
|
|
87 |
// Comment out the following line if you do not want the debug |
|
|
88 |
// feature of the firmware (saves code and RAM space when off) |
|
|
89 |
// |
|
|
90 |
// Note: if you use this feature you must compile with the large |
|
|
91 |
// memory model on (for 24-bit pointers) so that the sprintf() |
|
|
92 |
// function will work correctly. If you do not require debug it's |
|
|
93 |
// recommended that you compile with the small memory model and |
|
|
94 |
// remove any references to <strings.h> and sprintf(). |
|
|
95 |
#define DEBUGON |
|
|
96 |
|
|
|
97 |
// PIC to hardware pin mapping and control macros |
|
|
98 |
|
|
|
99 |
// Led control macros |
|
|
100 |
#define mInitStatusLeds() LATA &= 0b00000001; TRISA &= 0b00000001; |
|
|
101 |
#define mStatusLED0 LATAbits.LATA0 |
|
|
102 |
#define mStatusLED0_on() mStatusLED0 = 1; |
|
|
103 |
#define mStatusLED0_off() mStatusLED0 = 0; |
|
|
104 |
#define mStatusLED0_Toggle() mStatusLED0 = !mStatusLED0; |
|
|
105 |
#define mStatusLED0_Get() mStatusLED0 |
|
|
106 |
|
|
|
107 |
// Switch macros |
|
|
108 |
#define mInitAllSwitches() TRISAbits.TRISA1=1; |
|
|
109 |
#define mInitSwitch0() TRISAbits.TRISA1=1; |
|
|
110 |
#define sw0 PORTAbits.RA1 |
|
|
111 |
|
|
|
112 |
|
|
|
113 |
#endif |