Deleted StdDescriptors.c, renamed USB_GetDescriptor() to CALLBACK_USB_GetDescriptor...
[pub/USBasp.git] / Demos / Device / Keyboard / 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 Denver Gingerich (denver [at] ossguy [dot] com)
11 Based on code by Dean Camera (dean [at] fourwalledcubicle [dot] com)
12
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.
21
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
29 this software.
30 */
31
32 /** \file
33 *
34 * Header file for Descriptors.c.
35 */
36
37 #ifndef _DESCRIPTORS_H_
38 #define _DESCRIPTORS_H_
39
40 /* Includes: */
41 #include <LUFA/Drivers/USB/USB.h>
42
43 #include <avr/pgmspace.h>
44
45 /* Type Defines: */
46 /** Type define for the HID class specific HID descriptor, to describe the HID device's specifications. Refer to the HID
47 * specification for details on the structure elements.
48 */
49 typedef struct
50 {
51 USB_Descriptor_Header_t Header;
52
53 uint16_t HIDSpec;
54 uint8_t CountryCode;
55
56 uint8_t TotalReportDescriptors;
57
58 uint8_t HIDReportType;
59 uint16_t HIDReportLength;
60 } USB_Descriptor_HID_t;
61
62 /** Type define for the data type used to store HID report descriptor elements. */
63 typedef uint8_t USB_Descriptor_HIDReport_Datatype_t;
64
65 /** Type define for the device configuration descriptor structure. This must be defined in the
66 * application code, as the configuration descriptor contains several sub-descriptors which
67 * vary between devices, and which describe the device's usage to the host.
68 */
69 typedef struct
70 {
71 USB_Descriptor_Configuration_Header_t Config;
72 USB_Descriptor_Interface_t Interface;
73 USB_Descriptor_HID_t KeyboardHID;
74 USB_Descriptor_Endpoint_t KeyboardEndpoint;
75 USB_Descriptor_Endpoint_t KeyboardLEDsEndpoint;
76 } USB_Descriptor_Configuration_t;
77
78 /* Macros: */
79 /** Endpoint number of the Keyboard HID reporting IN endpoint. */
80 #define KEYBOARD_EPNUM 1
81
82 /** Endpoint number of the Keyboard HID reporting OUT endpoint. */
83 #define KEYBOARD_LEDS_EPNUM 2
84
85 /** Size in bytes of the Keyboard HID reporting IN and OUT endpoints. */
86 #define KEYBOARD_EPSIZE 8
87
88 /** Descriptor header type value, to indicate a HID class HID descriptor. */
89 #define DTYPE_HID 0x21
90
91 /** Descriptor header type value, to indicate a HID class HID report descriptor. */
92 #define DTYPE_Report 0x22
93
94 /* Function Prototypes: */
95 uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
96 ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
97
98 #endif