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 Joystick.c. 
  42                 #include <avr/power.h> 
  45                 #include "Descriptors.h" 
  47                 #include <LUFA/Version.h>                    // Library Version Information 
  48                 #include <LUFA/Drivers/USB/USB.h>            // USB Functionality 
  49                 #include <LUFA/Drivers/Board/Joystick.h>     // Joystick driver 
  50                 #include <LUFA/Drivers/Board/LEDs.h>         // LEDs driver 
  51                 #include <LUFA/Drivers/Board/HWB.h>          // Hardware Button driver 
  52                 #include <LUFA/Scheduler/Scheduler.h>        // Simple scheduler for task management 
  54         /* Task Definitions: */ 
  55                 TASK(USB_Joystick_Report
); 
  58                 /** HID Class specific request to get the next HID report from the device. */ 
  59                 #define REQ_GetReport   0x01 
  62                 /** Type define for the joystick HID report structure, for creating and sending HID reports to the host PC. 
  63                  *  This mirrors the layout described to the host in the HID report descriptor, in Descriptors.c. 
  67                         int8_t  X
; /**< Current absolute joystick X position, as a signed 8-bit integer */ 
  68                         int8_t  Y
; /**< Current absolute joystick Y position, as a signed 8-bit integer */ 
  69                         uint8_t Button
; /**< Bit mask of the currently pressed joystick buttons */ 
  70                 } USB_JoystickReport_Data_t
; 
  73                 /** Enum for the possible status codes for passing to the UpdateStatus() function. */ 
  74                 enum Joystick_StatusCodes_t
 
  76                         Status_USBNotReady    
= 0, /**< USB is not ready (disconnected from a USB host) */ 
  77                         Status_USBEnumerating 
= 1, /**< USB interface is enumerating */ 
  78                         Status_USBReady       
= 2, /**< USB interface is connected and ready */ 
  82                 /** Indicates that this module will catch the USB_Connect event when thrown by the library. */ 
  83                 HANDLES_EVENT(USB_Connect
); 
  85                 /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */ 
  86                 HANDLES_EVENT(USB_Disconnect
); 
  88                 /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */ 
  89                 HANDLES_EVENT(USB_ConfigurationChanged
); 
  91                 /** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */ 
  92                 HANDLES_EVENT(USB_UnhandledControlPacket
); 
  94         /* Function Prototypes: */ 
  95                 bool GetNextReport(USB_JoystickReport_Data_t
* ReportData
); 
  96                 void UpdateStatus(uint8_t CurrentStatus
);