Fixed PrinterHost demo returning invalid Device ID data when the attached device...
[pub/USBasp.git] / LUFA / Drivers / USB / Class / Common / HID.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 /** \ingroup Group_USBClassHID
32 * @defgroup Group_USBClassHIDCommon Common Class Definitions
33 *
34 * \section Module Description
35 * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB
36 * HID Class.
37 *
38 * @{
39 */
40
41 #ifndef _HID_CLASS_COMMON_H_
42 #define _HID_CLASS_COMMON_H_
43
44 /* Includes: */
45 #include "../../USB.h"
46
47 #include <string.h>
48
49 /* Macros: */
50 /** HID Class Specific Request to get the current HID report from the device. */
51 #define REQ_GetReport 0x01
52
53 /** HID Class Specific Request to get the current device idle count. */
54 #define REQ_GetIdle 0x02
55
56 /** HID Class Specific Request to set the current HID report to the device. */
57 #define REQ_SetReport 0x09
58
59 /** HID Class Specific Request to set the device's idle count. */
60 #define REQ_SetIdle 0x0A
61
62 /** HID Class Specific Request to get the current HID report protocol mode. */
63 #define REQ_GetProtocol 0x03
64
65 /** HID Class Specific Request to set the current HID report protocol mode. */
66 #define REQ_SetProtocol 0x0B
67
68 /** Descriptor header type value, to indicate a HID class HID descriptor. */
69 #define DTYPE_HID 0x21
70
71 /** Descriptor header type value, to indicate a HID class HID report descriptor. */
72 #define DTYPE_Report 0x22
73
74 /** Constant for the protocol value of a HID interface descriptor, indicating that the interface does not support
75 * any HID class boot protocol (see HID Class Specification).
76 */
77 #define HID_NON_BOOT_PROTOCOL 0x00
78
79 /** Constant for the protocol value of a HID interface descriptor, indicating that the interface supports the
80 * HID class Mouse boot protocol (see HID Class Specification).
81 */
82 #define HID_BOOT_MOUSE_PROTOCOL 0x02
83
84 /** Constant for the protocol value of a HID interface descriptor, indicating that the interface supports the
85 * HID class Keyboard boot protocol (see HID Class Specification).
86 */
87 #define HID_BOOT_KEYBOARD_PROTOCOL 0x01
88
89 /* Type Defines: */
90 /** Type define for the HID class specific HID descriptor, to describe the HID device's specifications. Refer to the HID
91 * specification for details on the structure elements.
92 */
93 typedef struct
94 {
95 USB_Descriptor_Header_t Header;
96
97 uint16_t HIDSpec;
98 uint8_t CountryCode;
99
100 uint8_t TotalReportDescriptors;
101
102 uint8_t HIDReportType;
103 uint16_t HIDReportLength;
104 } USB_HID_Descriptor_t;
105
106 /** Type define for a standard Boot Protocol Mouse report */
107 typedef struct
108 {
109 uint8_t Button; /**< Button mask for currently pressed buttons in the mouse */
110 int8_t X; /**< Current delta X movement of the mouse */
111 int8_t Y; /**< Current delta Y movement on the mouse */
112 } USB_MouseReport_Data_t;
113
114 /** Type define for a standard Boot Protocol Keyboard report */
115 typedef struct
116 {
117 uint8_t Modifier; /**< Keyboard modifier byte, indicating pressed modifier keys (such as Shift, Control, etc.) */
118 uint8_t Reserved; /**< Reserved for OEM use, always set to 0 */
119 uint8_t KeyCode[6]; /**< Key codes of the currently pressed keys */
120 } USB_KeyboardReport_Data_t;
121
122 /** Type define for the data type used to store HID report descriptor elements. */
123 typedef uint8_t USB_Descriptor_HIDReport_Datatype_t;
124
125 #endif
126
127 /** @} */