AN249 Silicon_Laboratories, AN249 Datasheet - Page 10

no-image

AN249

Manufacturer Part Number
AN249
Description
Human Interface Device Tutorial
Manufacturer
Silicon_Laboratories
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
AN2490NFHP
Manufacturer:
PANASONIC/松下
Quantity:
20 000
Part Number:
AN2491NFHP
Manufacturer:
PANASON
Quantity:
5 510
Part Number:
AN2491NFHP
Manufacturer:
MAXIM
Quantity:
5 510
AN249
5. HID Firmware Template
The remainder of this document describes the example code from the HID firmware template and the included
derivative example systems. This section gives a brief description of the firmware template and general usage
techniques.
5.1. Firmware Template Goals
The firmware template takes advantage of the fact that many HID systems differ only in the way they handle data
contained in incoming and outgoing Reports. By separating standard USB operation, which remains constant
across almost all USB-based systems, from custom USB operation, which varies according to the needs of a
particular firmware system, the template localizes customized operation to as few points as possible. The user
needs to modify only a few sections of code to create a custom HID-class firmware system.
5.2. Template Files
The HID firmware template includes the following files.
5.3. Using the Template
Below is a checklist of the locations in the firmware template that must be modified to create a customized HID
firmware solution. The modifications on this list are all discussed in detail later in this document.
5.4. Default Descriptor Declaration Values
The file F3xx_USB0_Main.c declares values for each descriptor. Some of these values will remain the same
across all HID-class devices, while others will need to be altered depending on the application. The following
subsections discuss the values of each descriptor. Items most commonly modified to implement custom devices
are highlighted in bold.
10
F3xx_USB0_Main.c—contains all global variable declarations, the main() function, and all routines for
peripherals other than USB.
F3xx_InterruptServiceRoutine.c—contains the USB Interrupt Service Routine and handler routines needed to
service data on all Endpoints.
F3xx_USB0_InterruptServiceRoutine.h —includes prototypes for all USB routines.
F3xx_USB0_Register.h—includes all USB core register addresses, register access macros, and register bit
masks.
F3xx_USB0_Standard_Requests.c—contains all standard USB-related functions called by the USB_ISR and
associated handler routines.
F3xx_USB0_Descriptor.c—where all descriptors are declared.
F3xx_USB0_ReportHandler.c—contains all code for handling input and output packets and the declaration of
the Input Vector table and Output Vector table.
F3xx_USB0_ReportHandler.h—includes definition of vector tables.
In F3xx_USB0_ReportHandler.c, modify descriptors as needed.
In F3xx_USB0_ReportHandler.c, add routines to handle all input and output data packets and populate the
Report Handler Vector tables.
In F3xx_USB0_Main.c, add any necessary foreground routines for processing USB traffic.
Add code to control any other peripherals needed to implement the system.
Rev. 0.2

Related parts for AN249