Renamed the the TotalHIDReports element of the HID descriptor structure in the HID...
[pub/USBasp.git] / Demos / Device / GenericHID / Descriptors.h
1 /*
2 LUFA Library
3 Copyright (C) Dean Camera, 2009.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
7 */
8
9 /*
10 Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, and distribute this software
13 and its documentation for any purpose and without fee is hereby
14 granted, provided that the above copyright notice appear in all
15 copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaim all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29 */
30
31 /** \file
32 *
33 * Header file for Descriptors.c.
34 */
35
36 #ifndef _DESCRIPTORS_H_
37 #define _DESCRIPTORS_H_
38
39 /* Includes: */
40 #include <LUFA/Drivers/USB/USB.h>
41
42 #include <avr/pgmspace.h>
43
44 /* Type Defines: */
45 /** Type define for the HID class specific HID descriptor, to describe the HID device's specifications. Refer to the HID
46 * specification for details on the structure elements.
47 */
48 typedef struct
49 {
50 USB_Descriptor_Header_t Header;
51
52 uint16_t HIDSpec;
53 uint8_t CountryCode;
54
55 uint8_t TotalReportDescriptors;
56
57 uint8_t HIDReportType;
58 uint16_t HIDReportLength;
59 } USB_Descriptor_HID_t;
60
61 /** Type define for the data type used to store HID report descriptor elements. */
62 typedef uint8_t USB_Descriptor_HIDReport_Datatype_t;
63
64 /** Type define for the device configuration descriptor structure. This must be defined in the
65 * application code, as the configuration descriptor contains several sub-descriptors which
66 * vary between devices, and which describe the device's usage to the host.
67 */
68 typedef struct
69 {
70 USB_Descriptor_Configuration_Header_t Config;
71 USB_Descriptor_Interface_t Interface;
72 USB_Descriptor_HID_t GenericHID;
73 USB_Descriptor_Endpoint_t GenericINEndpoint;
74 USB_Descriptor_Endpoint_t GenericOUTEndpoint;
75 } USB_Descriptor_Configuration_t;
76
77 /* Macros: */
78 /** Endpoint number of the Generic HID reporting IN endpoint. */
79 #define GENERIC_IN_EPNUM 1
80
81 /** Endpoint number of the Generic HID reporting OUT endpoint. */
82 #define GENERIC_OUT_EPNUM 2
83
84 /** Size in bytes of the Generic HID reporting endpoint. */
85 #define GENERIC_EPSIZE 8
86
87 /** Size in bytes of the Generic HID reports (including report ID byte). */
88 #define GENERIC_REPORT_SIZE 8
89
90 /** Descriptor header type value, to indicate a HID class HID descriptor. */
91 #define DTYPE_HID 0x21
92
93 /** Descriptor header type value, to indicate a HID class HID report descriptor. */
94 #define DTYPE_Report 0x22
95
96 /* Function Prototypes: */
97 uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
98 ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
99
100 #endif