]> git.donarmstrong.com Git - tmk_firmware.git/blob - protocol/lufa/descriptor.h
09fb24acc1ef5aa47ae721cc9136cfdd903cbbe4
[tmk_firmware.git] / protocol / lufa / descriptor.h
1 /* 
2  * Copyright 2012 Jun Wako <wakojun@gmail.com>
3  * This file is based on:
4  *     LUFA-120219/Demos/Device/Lowlevel/KeyboardMouse
5  *     LUFA-120219/Demos/Device/Lowlevel/GenericHID
6  */
7
8 /*
9              LUFA Library
10      Copyright (C) Dean Camera, 2012.
11
12   dean [at] fourwalledcubicle [dot] com
13            www.lufa-lib.org
14 */
15
16 /*
17   Copyright 2012  Dean Camera (dean [at] fourwalledcubicle [dot] com)
18   Copyright 2010  Denver Gingerich (denver [at] ossguy [dot] com)
19
20   Permission to use, copy, modify, distribute, and sell this
21   software and its documentation for any purpose is hereby granted
22   without fee, provided that the above copyright notice appear in
23   all copies and that both that the copyright notice and this
24   permission notice and warranty disclaimer appear in supporting
25   documentation, and that the name of the author not be used in
26   advertising or publicity pertaining to distribution of the
27   software without specific, written prior permission.
28
29   The author disclaim all warranties with regard to this
30   software, including all implied warranties of merchantability
31   and fitness.  In no event shall the author be liable for any
32   special, indirect or consequential damages or any damages
33   whatsoever resulting from loss of use, data or profits, whether
34   in an action of contract, negligence or other tortious action,
35   arising out of or in connection with the use or performance of
36   this software.
37 */
38
39 /** \file
40  *
41  *  Header file for Descriptors.c.
42  */
43
44 #ifndef _DESCRIPTORS_H_
45 #define _DESCRIPTORS_H_
46
47 #include <LUFA/Drivers/USB/USB.h>
48 #include <avr/pgmspace.h>
49
50
51 typedef struct
52 {
53     USB_Descriptor_Configuration_Header_t Config;
54
55     // Keyboard HID Interface
56     USB_Descriptor_Interface_t            Keyboard_Interface;
57     USB_HID_Descriptor_HID_t              Keyboard_HID;
58     USB_Descriptor_Endpoint_t             Keyboard_INEndpoint;
59
60     // Mouse HID Interface
61 #ifdef MOUSE_ENABLE
62     USB_Descriptor_Interface_t            Mouse_Interface;
63     USB_HID_Descriptor_HID_t              Mouse_HID;
64     USB_Descriptor_Endpoint_t             Mouse_INEndpoint;
65 #endif
66
67     // Console HID Interface
68     USB_Descriptor_Interface_t            Console_Interface;
69     USB_HID_Descriptor_HID_t              Console_HID;
70     USB_Descriptor_Endpoint_t             Console_INEndpoint;
71     USB_Descriptor_Endpoint_t             Console_OUTEndpoint;
72
73     // Extra HID Interface
74 #ifdef EXTRAKEY_ENABLE
75     USB_Descriptor_Interface_t            Extra_Interface;
76     USB_HID_Descriptor_HID_t              Extra_HID;
77     USB_Descriptor_Endpoint_t             Extra_INEndpoint;
78 #endif
79 } USB_Descriptor_Configuration_t;
80
81
82 /* index of interface */
83 #define KEYBOARD_INTERFACE          0
84
85 #ifdef MOUSE_ENABLE
86 #   define MOUSE_INTERFACE          (KEYBOARD_INTERFACE + 1)
87 #else
88 #   define MOUSE_INTERFACE          KEYBOARD_INTERFACE
89 #endif 
90
91 #ifdef EXTRAKEY_ENABLE
92 #   define EXTRA_INTERFACE          (MOUSE_INTERFACE + 1)
93 #else
94 #   define EXTRA_INTERFACE          MOUSE_INTERFACE
95 #endif 
96
97 #define CONSOLE_INTERFACE           (EXTRA_INTERFACE + 1)
98
99
100 /* nubmer of interfaces */
101 #define TOTAL_INTERFACES            (CONSOLE_INTERFACE + 1)
102
103
104 // Endopoint number and size
105 #define KEYBOARD_IN_EPNUM           1
106 #define MOUSE_IN_EPNUM              2
107 #define CONSOLE_IN_EPNUM            3
108 #define CONSOLE_OUT_EPNUM           4
109 #define EXTRA_IN_EPNUM              5
110
111 #define KEYBOARD_EPSIZE             8
112 #define MOUSE_EPSIZE                8
113 #define CONSOLE_EPSIZE              32
114 #define EXTRA_EPSIZE                8
115
116
117 uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
118                                     const uint8_t wIndex,
119                                     const void** const DescriptorAddress)
120                                     ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
121
122 #endif