3 Copyright (C) Dean Camera, 2009.
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
10 Copyright 2009 Denver Gingerich (denver [at] ossguy [dot] com)
11 Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
13 Permission to use, copy, modify, and distribute this software
14 and its documentation for any purpose and without fee is hereby
15 granted, provided that the above copyright notice appear in all
16 copies and that both that the copyright notice and this
17 permission notice and warranty disclaimer appear in supporting
18 documentation, and that the name of the author not be used in
19 advertising or publicity pertaining to distribution of the
20 software without specific, written prior permission.
22 The author disclaim all warranties with regard to this
23 software, including all implied warranties of merchantability
24 and fitness. In no event shall the author be liable for any
25 special, indirect or consequential damages or any damages
26 whatsoever resulting from loss of use, data or profits, whether
27 in an action of contract, negligence or other tortious action,
28 arising out of or in connection with the use or performance of
34 * Header file for Descriptors.c.
37 #ifndef _DESCRIPTORS_H_
38 #define _DESCRIPTORS_H_
41 #include <LUFA/Drivers/USB/USB.h>
43 #include <avr/pgmspace.h>
46 /** Type define for the HID class specific HID descriptor. A HID descriptor is used in HID class devices
47 * to give information about the HID device, including the HID specification used, and the report descriptors
48 * the device contains to describe how the HID device should be controlled.
52 USB_Descriptor_Header_t Header
; /**< Standard USB descriptor header */
54 uint16_t HIDSpec
; /**< HID specification implemented by the device, in BCD form */
55 uint8_t CountryCode
; /**< Country code for the country the HID device is localised for */
57 uint8_t TotalHIDDescriptors
; /**< Total number of HID reports linked to this HID interface */
59 uint8_t HIDReportType
; /**< Type of the first HID report descriptor */
60 uint16_t HIDReportLength
; /**< Length of the first HID report descriptor */
61 } USB_Descriptor_HID_t
;
63 /** Type define for the data type used for the HID Report descriptor data elements. A HID report
64 * descriptor contains an array of this data type, indicating how the reports from and to the
65 * device are formatted and how the report data is to be used by the host.
67 typedef uint8_t USB_Descriptor_HIDReport_Datatype_t
;
69 /** Type define for the device configuration descriptor structure. This must be defined in the
70 * application code, as the configuration descriptor contains several sub-descriptors which
71 * vary between devices, and which describe the device's usage to the host.
75 USB_Descriptor_Configuration_Header_t Config
; /**< Configuration descriptor header structure */
76 USB_Descriptor_Interface_t Interface
; /**< Keyboard interface descriptor */
77 USB_Descriptor_HID_t KeyboardHID
; /**< Keyboard HID descriptor */
78 USB_Descriptor_Endpoint_t KeyboardEndpoint
; /**< Keyboard key report endpoint descriptor */
79 } USB_Descriptor_Configuration_t
;
82 /** Endpoint number of the keyboard key press reporting endpoint. */
83 #define KEYBOARD_EPNUM 1
85 /** Size of the keyboard report endpoints, in bytes. */
86 #define KEYBOARD_EPSIZE 8
88 /** Descriptor type value for a HID descriptor. */
89 #define DTYPE_HID 0x21
91 /** Descriptor type value for a HID report. */
92 #define DTYPE_Report 0x22
94 /* Function Prototypes: */
95 uint16_t USB_GetDescriptor(const uint16_t wValue
, const uint8_t wIndex
, void** const DescriptorAddress
)
96 ATTR_WARN_UNUSED_RESULT
ATTR_NON_NULL_PTR_ARG(3);