Combined Keyboard, KeyboardViaInt and KeyboardFullInt demos into a single unified...
[pub/USBasp.git] / Demos / Keyboard / Keyboard.h
index 6988e57..8b3147c 100644 (file)
@@ -9,7 +9,7 @@
 /*\r
   Copyright 2009  Denver Gingerich (denver [at] ossguy [dot] com)\r
       Based on code by Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
 /*\r
   Copyright 2009  Denver Gingerich (denver [at] ossguy [dot] com)\r
       Based on code by Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
-         \r
+\r
   Permission to use, copy, modify, and distribute this software\r
   and its documentation for any purpose and without fee is hereby\r
   granted, provided that the above copyright notice appear in all\r
   Permission to use, copy, modify, and distribute this software\r
   and its documentation for any purpose and without fee is hereby\r
   granted, provided that the above copyright notice appear in all\r
@@ -33,7 +33,7 @@
  *\r
  *  Header file for Keyboard.c.\r
  */\r
  *\r
  *  Header file for Keyboard.c.\r
  */\r
\r
+\r
 #ifndef _KEYBOARD_H_\r
 #define _KEYBOARD_H_\r
 \r
 #ifndef _KEYBOARD_H_\r
 #define _KEYBOARD_H_\r
 \r
                #include "Descriptors.h"\r
 \r
                #include <LUFA/Version.h>                    // Library Version Information\r
                #include "Descriptors.h"\r
 \r
                #include <LUFA/Version.h>                    // Library Version Information\r
+               #include <LUFA/Scheduler/Scheduler.h>        // Simple scheduler for task management\r
                #include <LUFA/Common/ButtLoadTag.h>         // PROGMEM tags readable by the ButtLoad project\r
                #include <LUFA/Drivers/USB/USB.h>            // USB Functionality\r
                #include <LUFA/Drivers/Board/Joystick.h>     // Joystick driver\r
                #include <LUFA/Drivers/Board/LEDs.h>         // LEDs driver\r
                #include <LUFA/Common/ButtLoadTag.h>         // PROGMEM tags readable by the ButtLoad project\r
                #include <LUFA/Drivers/USB/USB.h>            // USB Functionality\r
                #include <LUFA/Drivers/Board/Joystick.h>     // Joystick driver\r
                #include <LUFA/Drivers/Board/LEDs.h>         // LEDs driver\r
-               #include <LUFA/Scheduler/Scheduler.h>        // Simple scheduler for task management\r
-               \r
-       /* Task Definitions: */\r
-               TASK(USB_Keyboard_Report);\r
 \r
        /* Macros: */\r
                /** HID Class specific request to get the next HID report from the device. */\r
 \r
        /* Macros: */\r
                /** HID Class specific request to get the next HID report from the device. */\r
@@ -76,6 +73,9 @@
                /** HID Class specific request to set the current HID protocol in use, either report or boot. */\r
                #define REQ_SetProtocol    0x0B\r
                \r
                /** HID Class specific request to set the current HID protocol in use, either report or boot. */\r
                #define REQ_SetProtocol    0x0B\r
                \r
+       /* Task Definitions: */\r
+               TASK(USB_Keyboard_Report);\r
+\r
        /* Type Defines: */\r
                /** Type define for the keyboard HID report structure, for creating and sending HID reports to the host PC.\r
                 *  This mirrors the layout described to the host in the HID report descriptor, in Descriptors.c.\r
        /* Type Defines: */\r
                /** Type define for the keyboard HID report structure, for creating and sending HID reports to the host PC.\r
                 *  This mirrors the layout described to the host in the HID report descriptor, in Descriptors.c.\r
                /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */\r
                HANDLES_EVENT(USB_Disconnect);\r
 \r
                /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */\r
                HANDLES_EVENT(USB_Disconnect);\r
 \r
+               /** Indicates that this module will catch the USB_Reset event when thrown by the library. */\r
+               HANDLES_EVENT(USB_Reset);\r
+\r
                /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */\r
                HANDLES_EVENT(USB_ConfigurationChanged);\r
 \r
                /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */\r
                HANDLES_EVENT(USB_ConfigurationChanged);\r
 \r
                HANDLES_EVENT(USB_UnhandledControlPacket);\r
                \r
        /* Function Prototypes: */\r
                HANDLES_EVENT(USB_UnhandledControlPacket);\r
                \r
        /* Function Prototypes: */\r
-               bool GetNextReport(USB_KeyboardReport_Data_t* ReportData);\r
+               bool CreateKeyboardReport(USB_KeyboardReport_Data_t* ReportData);\r
                void ProcessLEDReport(uint8_t LEDReport);\r
                void ProcessLEDReport(uint8_t LEDReport);\r
+               static inline void SendNextReport(void);\r
+               static inline void ReceiveNextReport(void);\r
                void UpdateStatus(uint8_t CurrentStatus);\r
                \r
 #endif\r
                void UpdateStatus(uint8_t CurrentStatus);\r
                \r
 #endif\r