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
33 * Header file for Mouse.c.
42 #include <avr/interrupt.h>
43 #include <avr/power.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
54 #include <LUFA/Drivers/Board/HWB.h> // Hardware Button driver
55 #include <LUFA/Scheduler/Scheduler.h> // Simple scheduler for task management
57 /* Task Definitions: */
58 TASK(USB_Mouse_Report
);
61 /** HID Class specific request to get the next HID report from the device. */
62 #define REQ_GetReport 0x01
64 /** HID Class specific request to get the idle timeout period of the device. */
65 #define REQ_GetIdle 0x02
67 /** HID Class specific request to send the next HID report to the device. */
68 #define REQ_SetReport 0x09
70 /** HID Class specific request to set the idle timeout period of the device. */
71 #define REQ_SetIdle 0x0A
73 /** HID Class specific request to get the current HID protocol in use, either report or boot. */
74 #define REQ_GetProtocol 0x03
76 /** HID Class specific request to set the current HID protocol in use, either report or boot. */
77 #define REQ_SetProtocol 0x0B
80 /** Type define for the mouse HID report structure, for creating and sending HID reports to the host PC.
81 * This mirrors the layout described to the host in the HID report descriptor, in Descriptors.c.
85 uint8_t Button
; /**< Bit mask of the currently pressed mouse buttons */
86 int8_t X
; /**< Current mouse delta X movement, as a signed 8-bit integer */
87 int8_t Y
; /**< Current mouse delta Y movement, as a signed 8-bit integer */
88 } USB_MouseReport_Data_t
;
91 /** Enum for the possible status codes for passing to the UpdateStatus() function. */
92 enum Mouse_StatusCodes_t
94 Status_USBNotReady
= 0, /**< USB is not ready (disconnected from a USB host) */
95 Status_USBEnumerating
= 1, /**< USB interface is enumerating */
96 Status_USBReady
= 2, /**< USB interface is connected and ready */
100 /** Indicates that this module will catch the USB_Connect event when thrown by the library. */
101 HANDLES_EVENT(USB_Connect
);
103 /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */
104 HANDLES_EVENT(USB_Disconnect
);
106 /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */
107 HANDLES_EVENT(USB_ConfigurationChanged
);
109 /** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */
110 HANDLES_EVENT(USB_UnhandledControlPacket
);
112 /* Function Prototypes: */
113 bool GetNextReport(USB_MouseReport_Data_t
* ReportData
);
114 void UpdateStatus(uint8_t CurrentStatus
);