3 Copyright (C) Dean Camera, 2009.
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
10 Copyright 2009 Denver Gingerich (denver [at] ossguy [dot] com)
11 Based on code by Dean Camera (dean [at] fourwalledcubicle [dot] com)
13 Permission to use, copy, modify, and distribute this software
14 and its documentation for any purpose and without fee is hereby
15 granted, provided that the above copyright notice appear in all
16 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.
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
34 * Header file for KeyboardViaInt.c.
43 #include <avr/interrupt.h>
47 #include "Descriptors.h"
49 #include <LUFA/Version.h> // Library Version Information
50 #include <LUFA/Common/ButtLoadTag.h> // PROGMEM tags readable by the ButtLoad project
51 #include <LUFA/Drivers/USB/USB.h> // USB Functionality
52 #include <LUFA/Drivers/Board/Joystick.h> // Joystick driver
53 #include <LUFA/Drivers/Board/LEDs.h> // LEDs driver
56 /** HID Class specific request to get the next HID report from the device. */
57 #define REQ_GetReport 0x01
59 /** HID Class specific request to get the idle timeout period of the device. */
60 #define REQ_GetIdle 0x02
62 /** HID Class specific request to send the next HID report to the device. */
63 #define REQ_SetReport 0x09
65 /** HID Class specific request to set the idle timeout period of the device. */
66 #define REQ_SetIdle 0x0A
68 /** HID Class specific request to get the current HID protocol in use, either report or boot. */
69 #define REQ_GetProtocol 0x03
71 /** HID Class specific request to set the current HID protocol in use, either report or boot. */
72 #define REQ_SetProtocol 0x0B
75 /** Type define for the keyboard HID report structure, for creating and sending HID reports to the host PC.
76 * This mirrors the layout described to the host in the HID report descriptor, in Descriptors.c.
80 uint8_t Modifier
; /**< Modifier mask byte, containing a mask of modifier keys set (such as shift or CTRL) */
81 uint8_t Reserved
; /**< Reserved, always set as 0x00 */
82 uint8_t KeyCode
[6]; /**< Array of up to six simultaneous key codes of pressed keys */
83 } USB_KeyboardReport_Data_t
;
86 /** Enum for the possible status codes for passing to the UpdateStatus() function. */
87 enum KeyboardViaInt_StatusCodes_t
89 Status_USBNotReady
= 0, /**< USB is not ready (disconnected from a USB host) */
90 Status_USBEnumerating
= 1, /**< USB interface is enumerating */
91 Status_USBReady
= 2, /**< USB interface is connected and ready */
95 /** Indicates that this module will catch the USB_Connect event when thrown by the library. */
96 HANDLES_EVENT(USB_Connect
);
98 /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */
99 HANDLES_EVENT(USB_Disconnect
);
101 /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */
102 HANDLES_EVENT(USB_ConfigurationChanged
);
104 /** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */
105 HANDLES_EVENT(USB_UnhandledControlPacket
);
107 /* Function Prototypes: */
108 bool GetNextReport(USB_KeyboardReport_Data_t
* ReportData
);
109 void ProcessLEDReport(uint8_t LEDReport
);
110 void UpdateStatus(uint8_t CurrentStatus
);