Combine PDIProtocol and TPIProtocol into a single XPROGProtocol set of files.
[pub/USBasp.git] / Demos / Device / ClassDriver / MassStorageKeyboard / MassStorageKeyboard.c
index 9b22f11..2c64a8f 100644 (file)
@@ -8,7 +8,7 @@
 \r
 /*\r
   Copyright 2009  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
 \r
 /*\r
   Copyright 2009  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
-  Copyright 2009  Matthias Hullin (matthias [at] hullin [dot] net)\r
+  Copyright 2009  Matthias Hullin (lufa [at] matthias [dot] hullin [dot] net)\r
 \r
   Permission to use, copy, modify, and distribute this software\r
   and its documentation for any purpose and without fee is hereby\r
 \r
   Permission to use, copy, modify, and distribute this software\r
   and its documentation for any purpose and without fee is hereby\r
  */\r
 \r
 #include "MassStorageKeyboard.h"\r
  */\r
 \r
 #include "MassStorageKeyboard.h"\r
-\r
-/** Buffer to hold the previously generated Keyboard HID report, for comparison purposes inside the HID class driver. */\r
-uint8_t PrevKeyboardHIDReportBuffer[sizeof(USB_KeyboardReport_Data_t)];\r
-\r
+       \r
 /** LUFA Mass Storage Class driver interface configuration and state information. This structure is\r
  *  passed to all Mass Storage Class driver functions, so that multiple instances of the same class\r
  *  within a device can be differentiated from one another.\r
 /** LUFA Mass Storage Class driver interface configuration and state information. This structure is\r
  *  passed to all Mass Storage Class driver functions, so that multiple instances of the same class\r
  *  within a device can be differentiated from one another.\r
@@ -48,18 +45,23 @@ USB_ClassInfo_MS_Device_t Disk_MS_Interface =
        {\r
                .Config =\r
                        {\r
        {\r
                .Config =\r
                        {\r
-                               .InterfaceNumber        = 0,\r
+                               .InterfaceNumber           = 0,\r
 \r
 \r
-                               .DataINEndpointNumber   = MASS_STORAGE_IN_EPNUM,\r
-                               .DataINEndpointSize     = MASS_STORAGE_IO_EPSIZE,\r
+                               .DataINEndpointNumber      = MASS_STORAGE_IN_EPNUM,\r
+                               .DataINEndpointSize        = MASS_STORAGE_IO_EPSIZE,\r
+                               .DataINEndpointDoubleBank  = false,\r
 \r
 \r
-                               .DataOUTEndpointNumber  = MASS_STORAGE_OUT_EPNUM,\r
-                               .DataOUTEndpointSize    = MASS_STORAGE_IO_EPSIZE,\r
+                               .DataOUTEndpointNumber     = MASS_STORAGE_OUT_EPNUM,\r
+                               .DataOUTEndpointSize       = MASS_STORAGE_IO_EPSIZE,\r
+                               .DataOUTEndpointDoubleBank = false,\r
 \r
 \r
-                               .TotalLUNs              = TOTAL_LUNS,\r
+                               .TotalLUNs                 = TOTAL_LUNS,\r
                        },\r
        };\r
 \r
                        },\r
        };\r
 \r
+/** Buffer to hold the previously generated Keyboard HID report, for comparison purposes inside the HID class driver. */\r
+uint8_t PrevKeyboardHIDReportBuffer[sizeof(USB_KeyboardReport_Data_t)];\r
+\r
 /** LUFA HID Class driver interface configuration and state information. This structure is\r
  *  passed to all HID Class driver functions, so that multiple instances of the same class\r
  *  within a device can be differentiated from one another.\r
 /** LUFA HID Class driver interface configuration and state information. This structure is\r
  *  passed to all HID Class driver functions, so that multiple instances of the same class\r
  *  within a device can be differentiated from one another.\r
@@ -68,13 +70,14 @@ USB_ClassInfo_HID_Device_t Keyboard_HID_Interface =
        {\r
                .Config =\r
                        {\r
        {\r
                .Config =\r
                        {\r
-                               .InterfaceNumber         = 1,\r
+                               .InterfaceNumber              = 1,\r
 \r
 \r
-                               .ReportINEndpointNumber  = KEYBOARD_EPNUM,\r
-                               .ReportINEndpointSize    = KEYBOARD_EPSIZE,\r
+                               .ReportINEndpointNumber       = KEYBOARD_EPNUM,\r
+                               .ReportINEndpointSize         = KEYBOARD_EPSIZE,\r
+                               .ReportINEndpointDoubleBank   = false,\r
 \r
 \r
-                               .PrevReportINBuffer      = PrevKeyboardHIDReportBuffer,\r
-                               .PrevReportINBufferSize  = sizeof(PrevKeyboardHIDReportBuffer),\r
+                               .PrevReportINBuffer           = PrevKeyboardHIDReportBuffer,\r
+                               .PrevReportINBufferSize       = sizeof(PrevKeyboardHIDReportBuffer),\r
                        },\r
     };\r
 \r
                        },\r
     };\r
 \r
@@ -178,13 +181,14 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK)
  *\r
  *  \param[in] HIDInterfaceInfo  Pointer to the HID class interface configuration structure being referenced\r
  *  \param[in,out] ReportID  Report ID requested by the host if non-zero, otherwise callback should set to the generated report ID\r
  *\r
  *  \param[in] HIDInterfaceInfo  Pointer to the HID class interface configuration structure being referenced\r
  *  \param[in,out] ReportID  Report ID requested by the host if non-zero, otherwise callback should set to the generated report ID\r
+ *  \param[in] ReportType  Type of the report to create, either REPORT_ITEM_TYPE_In or REPORT_ITEM_TYPE_Feature\r
  *  \param[out] ReportData  Pointer to a buffer where the created report should be stored\r
  *  \param[out] ReportSize  Number of bytes written in the report (or zero if no report is to be sent\r
  *\r
  *  \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent\r
  */\r
 bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,\r
  *  \param[out] ReportData  Pointer to a buffer where the created report should be stored\r
  *  \param[out] ReportSize  Number of bytes written in the report (or zero if no report is to be sent\r
  *\r
  *  \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent\r
  */\r
 bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,\r
-                                         void* ReportData, uint16_t* ReportSize)\r
+                                         const uint8_t ReportType, void* ReportData, uint16_t* ReportSize)\r
 {\r
        USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;\r
        \r
 {\r
        USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;\r
        \r