Enable Mass Storage bootloader builds in the BootloaderTest build test.
[pub/USBasp.git] / Projects / HIDReportViewer / HIDReportViewer.c
index f3126c0..2250ddf 100644 (file)
@@ -1,13 +1,13 @@
 /*
              LUFA Library
-     Copyright (C) Dean Camera, 2011.
+     Copyright (C) Dean Camera, 2013.
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
-  Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com)
+  Copyright 2013  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
@@ -18,7 +18,7 @@
   advertising or publicity pertaining to distribution of the
   software without specific, written prior permission.
 
-  The author disclaim all warranties with regard to this
+  The author disclaims all warranties with regard to this
   software, including all implied warranties of merchantability
   and fitness.  In no event shall the author be liable for any
   special, indirect or consequential damages or any damages
@@ -33,7 +33,7 @@
  *  Main source file for the HIDReportViewer project. This file contains the main tasks of
  *  the project and is responsible for the initial application hardware configuration.
  */
+
 #include "HIDReportViewer.h"
 
 /** Processed HID report descriptor items structure, containing information on each HID report element */
@@ -47,14 +47,17 @@ USB_ClassInfo_HID_Host_t Device_HID_Interface =
        {
                .Config =
                        {
-                               .DataINPipeNumber       = 1,
-                               .DataINPipeDoubleBank   = false,
-
-                               .DataOUTPipeNumber      = 2,
-                               .DataOUTPipeDoubleBank  = false,
-
+                               .DataINPipe             =
+                                       {
+                                               .Address        = (PIPE_DIR_IN  | 1),
+                                               .Banks          = 1,
+                                       },
+                               .DataOUTPipe            =
+                                       {
+                                               .Address        = (PIPE_DIR_OUT | 2),
+                                               .Banks          = 1,
+                                       },
                                .HIDInterfaceProtocol   = HID_CSCP_NonBootProtocol,
-
                                .HIDParserData          = &HIDReportInfo
                        },
        };
@@ -70,12 +73,12 @@ int main(void)
        puts_P(PSTR(ESC_FG_CYAN "HID Device Report Viewer Running.\r\n" ESC_FG_WHITE));
 
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
-       sei();
+       GlobalInterruptEnable();
 
        for (;;)
        {
                RetrieveDeviceData();
-               
+
                HID_Host_USBTask(&Device_HID_Interface);
                USB_USBTask();
        }
@@ -86,14 +89,14 @@ int main(void)
  */
 void RetrieveDeviceData(void)
 {
-       if (USB_CurrentMode != USB_MODE_Host)
+       if (USB_HostState != HOST_STATE_Configured)
          return;
-       
+
        LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
-       
+
        OutputReportSizes();
        OutputParsedReportItems();
-       
+
        LEDs_SetAllLEDs(LEDMASK_USB_READY);
        USB_Host_SetDeviceConfiguration(0);
 }
@@ -168,7 +171,7 @@ void OutputParsedReportItems(void)
                                 RItem->Attributes.Logical.Maximum,
                                 RItem->Attributes.Physical.Minimum,
                                 RItem->Attributes.Physical.Maximum);
-               
+
                OutputCollectionPath(RItem->CollectionPath);
        }
 }
@@ -188,10 +191,10 @@ void OutputCollectionPath(const HID_CollectionPath_t* const CollectionPath)
                                          "      - Type:  0x%02" PRIX8 "\r\n"
                                          "      - Usage: 0x%02" PRIX8 "\r\n"),
                                          CurrentNode->Type, CurrentNode->Usage);
-               
+
                CurrentNode = CurrentNode->Parent;
        }
-       
+
        printf_P(PSTR("      |\r\n"
                                  "      END\r\n"));
 }