3 Copyright (C) Dean Camera, 2009.
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
10 Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
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.
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
31 /** \ingroup Group_USBClassHID
35 #ifndef _HID_CLASS_COMMON_H_
36 #define _HID_CLASS_COMMON_H_
39 #include "../../USB.h"
44 /** HID Class Specific Request to get the current HID report from the device. */
45 #define REQ_GetReport 0x01
47 /** HID Class Specific Request to get the current device idle count. */
48 #define REQ_GetIdle 0x02
50 /** HID Class Specific Request to set the current HID report to the device. */
51 #define REQ_SetReport 0x09
53 /** HID Class Specific Request to set the device's idle count. */
54 #define REQ_SetIdle 0x0A
56 /** HID Class Specific Request to get the current HID report protocol mode. */
57 #define REQ_GetProtocol 0x03
59 /** HID Class Specific Request to set the current HID report protocol mode. */
60 #define REQ_SetProtocol 0x0B
62 /** Descriptor header type value, to indicate a HID class HID descriptor. */
63 #define DTYPE_HID 0x21
65 /** Descriptor header type value, to indicate a HID class HID report descriptor. */
66 #define DTYPE_Report 0x22
69 /** Type define for the HID class specific HID descriptor, to describe the HID device's specifications. Refer to the HID
70 * specification for details on the structure elements.
74 USB_Descriptor_Header_t Header
;
79 uint8_t TotalReportDescriptors
;
81 uint8_t HIDReportType
;
82 uint16_t HIDReportLength
;
83 } USB_Descriptor_HID_t
;
85 /** Type define for the data type used to store HID report descriptor elements. */
86 typedef uint8_t USB_Descriptor_HIDReport_Datatype_t
;
88 /** Class state structure. An instance of this structure should be made for each HID interface
89 * within the user application, and passed to each of the HID class driver functions as the
90 * HIDInterfaceInfo parameter. The contents of this structure should be set to their correct
91 * values when used, or ommitted to force the library to use default values.
93 * Note that for the HID class driver, host-to-device reports are received via HID class requests
94 * rather than a dedicated endpoint to simplify the driver and its interface.
98 uint8_t InterfaceNumber
; /**< Interface number of the HID interface within the device */
100 uint8_t ReportINEndpointNumber
; /**< Endpoint number of the HID interface's IN report endpoint */
101 uint16_t ReportINEndpointSize
; /**< Size in bytes of the HID interface's IN report endpoint */
103 uint8_t ReportINBufferSize
; /**< Size of the largest possible report to send to the host, for buffer allocation purposes */
105 bool UsingReportProtocol
; /**< Indicates if the HID interface is set to Boot or Report protocol mode */
106 uint16_t IdleCount
; /**< Report idle period, in ms, set by the host */
107 uint16_t IdleMSRemaining
; /**< Total number of ms remaining before the idle period elapses */
108 } USB_ClassInfo_HID_t
;