]> git.donarmstrong.com Git - tmk_firmware.git/blob - protocol/lufa/descriptor.h
Add conditional compile for MOUSE_ENABLE and EXTRAKEY_ENABLE.
[tmk_firmware.git] / protocol / lufa / descriptor.h
1 /*
2              LUFA Library
3      Copyright (C) Dean Camera, 2012.
4
5   dean [at] fourwalledcubicle [dot] com
6            www.lufa-lib.org
7 */
8
9 /*
10   Copyright 2012  Dean Camera (dean [at] fourwalledcubicle [dot] com)
11   Copyright 2010  Denver Gingerich (denver [at] ossguy [dot] com)
12
13   Permission to use, copy, modify, distribute, and sell this
14   software and its documentation for any purpose is hereby granted
15   without fee, provided that the above copyright notice appear in
16   all 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 #include <LUFA/Drivers/USB/USB.h>
41 #include <avr/pgmspace.h>
42
43
44 typedef struct
45 {
46     USB_Descriptor_Configuration_Header_t Config;
47
48     // Keyboard HID Interface
49     USB_Descriptor_Interface_t            Keyboard_Interface;
50     USB_HID_Descriptor_HID_t              Keyboard_HID;
51     USB_Descriptor_Endpoint_t             Keyboard_INEndpoint;
52
53     // Mouse HID Interface
54 #ifdef MOUSE_ENABLE
55     USB_Descriptor_Interface_t            Mouse_Interface;
56     USB_HID_Descriptor_HID_t              Mouse_HID;
57     USB_Descriptor_Endpoint_t             Mouse_INEndpoint;
58 #endif
59
60     // Console HID Interface
61     USB_Descriptor_Interface_t            Console_Interface;
62     USB_HID_Descriptor_HID_t              Console_HID;
63     USB_Descriptor_Endpoint_t             Console_INEndpoint;
64     USB_Descriptor_Endpoint_t             Console_OUTEndpoint;
65
66     // Extra HID Interface
67 #ifdef EXTRAKEY_ENABLE
68     USB_Descriptor_Interface_t            Extra_Interface;
69     USB_HID_Descriptor_HID_t              Extra_HID;
70     USB_Descriptor_Endpoint_t             Extra_INEndpoint;
71 #endif
72 } USB_Descriptor_Configuration_t;
73
74
75 /* index of interface */
76 #define KEYBOARD_INTERFACE          0
77
78 #ifdef MOUSE_ENABLE
79 #   define MOUSE_INTERFACE          (KEYBOARD_INTERFACE + 1)
80 #else
81 #   define MOUSE_INTERFACE          KEYBOARD_INTERFACE
82 #endif 
83
84 #ifdef EXTRAKEY_ENABLE
85 #   define EXTRA_INTERFACE          (MOUSE_INTERFACE + 1)
86 #else
87 #   define EXTRA_INTERFACE          MOUSE_INTERFACE
88 #endif 
89
90 #define CONSOLE_INTERFACE           (EXTRA_INTERFACE + 1)
91
92
93 /* nubmer of interfaces */
94 #define TOTAL_INTERFACES            (CONSOLE_INTERFACE + 1)
95
96
97 // Endopoint number and size
98 #define KEYBOARD_IN_EPNUM           1
99 #define MOUSE_IN_EPNUM              2
100 #define CONSOLE_IN_EPNUM            3
101 #define CONSOLE_OUT_EPNUM           4
102 #define EXTRA_IN_EPNUM              5
103
104 #define KEYBOARD_EPSIZE             8
105 #define MOUSE_EPSIZE                8
106 #define CONSOLE_EPSIZE              8
107 #define EXTRA_EPSIZE                8
108
109
110 uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
111                                     const uint8_t wIndex,
112                                     const void** const DescriptorAddress)
113                                     ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
114
115 #endif