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
32 * @defgroup Group_USBClassHIDDevice HID Class Device Mode Driver
34 * \section Module Description
35 * Device Mode USB Class driver framework interface, for the HID USB Class driver.
40 #ifndef _HID_CLASS_DEVICE_H_
41 #define _HID_CLASS_DEVICE_H_
44 #include "../../USB.h"
45 #include "../Common/HID.h"
49 /* Enable C linkage for C++ Compilers: */
50 #if defined(__cplusplus)
54 /* Public Interface - May be used in end-application: */
55 /* Function Prototypes: */
56 /** Configures the endpoints of a given HID interface, ready for use. This should be linked to the library
57 * \ref EVENT_USB_ConfigurationChanged() event so that the endpoints are configured when the configuration
58 * containing the given HID interface is selected.
60 * \param HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state.
62 * \return Boolean true if the endpoints were sucessfully configured, false otherwise
64 bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_t
* HIDInterfaceInfo
);
66 /** Processes incomming control requests from the host, that are directed to the given HID class interface. This should be
67 * linked to the library \ref EVENT_USB_UnhandledControlPacket() event.
69 * \param HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state.
71 void HID_Device_ProcessControlPacket(USB_ClassInfo_HID_t
* HIDInterfaceInfo
);
73 /** General management task for a given HID class interface, required for the correct operation of the interface. This should
74 * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().
76 * \param HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state.
78 void HID_Device_USBTask(USB_ClassInfo_HID_t
* HIDInterfaceInfo
);
80 /** HID class driver callback for the user creation of a HID input report. This callback may fire in response to either
81 * HID class control requests from the host, or by the normal HID endpoint polling procedure. Inside this callback the
82 * user is responsible for the creation of the next HID input report to be sent to the host.
84 * \param HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state.
85 * \param ReportID If preset to a non-zero value, this is the report ID being requested by the host. If zero, this should
86 * be set to the report ID of the generated HID input report. If multiple reports are not sent via the
87 * given HID interface, this parameter should be ignored.
88 * \param ReportData Pointer to a buffer where the generated HID report should be stored.
90 * \return Number of bytes in the generated input report, or zero if no report is to be sent
92 uint16_t CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_t
* HIDInterfaceInfo
, uint8_t* ReportID
, void* ReportData
);
94 /** HID class driver callback for the user processing of a received HID input report. This callback may fire in response to
95 * either HID class control requests from the host, or by the normal HID endpoint polling procedure. Inside this callback
96 * the user is responsible for the processing of the received HID output report from the host.
98 * \param HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state.
99 * \param ReportID Report ID of the received output report. If multiple reports are not received via the given HID
100 * interface, this parameter should be ignored.
101 * \param ReportData Pointer to a buffer where the received HID report is stored.
102 * \param ReportSize Size in bytes of the received report from the host.
104 void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_t
* HIDInterfaceInfo
, uint8_t ReportID
, void* ReportData
,
105 uint16_t ReportSize
);
107 /* Disable C linkage for C++ Compilers: */
108 #if defined(__cplusplus)