HardwareProfile.h

Microchip USB Device Library

USB Device Library Help
HardwareProfile.h

HardwareProfile.h is a file used to define hardware specific definitions that are required by the MCHPFSUSB stack. This file should be modified to match the application hardware. 

The following definitions are used by the stack and example code. Additional definitions may be required by the function drivers used in the application. Please see the HardwareProfiles.h Topic in each of the function driver sections for additional information about class specific definition requirements. 

GetSystemClock() - this macro should be defined to return the current clock rate of the CPU. Because this rate is defined as the rate the CPU is clocked then any PLLs, pre-scalars, post-scalars, etc. should already be included in this value. 

#define GetSystemClock() 48000000 

PROGRAMMABLE_WITH_USB_HID_BOOTLOADER - The existence of this definition tells the example firmware that this application will be bootloaded using the HID bootloader. The example applications will remap any vectors required to the appropriate address if this is defined. This definition is optional. 

#define PROGRAMMABLE_WITH_USB_HID_BOOTLOADER 

PROGRAMMABLE_WITH_USB_MCHPUSB_BOOTLOADER - The existence of this definition tells the example firmware that this application will be bootloaded using the MCHPUSB bootloader. The example applications will remap any vectors required to the appropriate address if this is defined. The MCHPUSB bootloader only supports the PIC18F4550 and PIC18F4450 device families. This definition is optional. 

#define PROGRAMMABLE_WITH_USB_MCHPUSB_BOOTLOADER 

USE_SELF_POWER_SENSE_IO - The existence of this definition tells the stack that the application is capable of sensing if it is self powered or not. If this is defined then the tris_self_power and self_power definitions must also be defined. 

#define USE_SELF_POWER_SENSE_IO 

tris_self_power - This definition tells the firmware which TRIS pin to tri-state in order to detect if the device is self powered or not. If the self power is determined from something other than a port pin, then this definition can point to a dummy variable bit. 

#define tris_self_power TRISAbits.TRISA2 // Input 

self_power - This definition is what is used by the stack to determine if the device is currently self powered. This can be a function or a bit. This definition should equate to 1 if the device is self powered and 0 if the device is not currently self powered. This definition should exist irrespective of if the device is capable of sensing its own self power. 

#if defined(USE_SELF_POWER_SENSE_IO) 

#define self_power PORTAbits.RA2 

#else 

#define self_power 1 

#endif 

USE_USB_BUS_SENSE_IO - The existence of this definition tells the stack that the application is capable of sensing if it is bus powered or not. If this is defined then the tris_usb_bus_sense and USB_BUS_SENSE definitions must also be defined. 

#define USE_USB_BUS_SENSE_IO 

tris_self_power - This definition tells the firmware which TRIS pin to tri-state in order to detect if the device is bus powered or not. If the bus power is determined from something other than a port pin, then this definition can point to a dummy variable bit. 

#define tris_usb_bus_sense TRISAbits.TRISA1 // Input 

USB_BUS_SENSE - This definition is what is used by the stack to determine if the device is currently self powered. This can be a function or a bit. This definition should equate to 1 if the device is self powered and 0 if the device is not currently self powered. This definition should exist irrespective of if the device is capable of sensing its own self power. 

#if defined(USE_USB_BUS_SENSE_IO) 

#define USB_BUS_SENSE PORTAbits.RA1 

#else 

#define USB_BUS_SENSE 1 

#endif 

MCHPFSUSB Device Library > Stack > Files > HardwareProfile.h
Microchip MCHPFSUSB v2.3 - Sept 20, 2008
Copyright © 2008 Microchip Technology, Inc.  All rights reserved.