Add MAX_ENDPOINT_INDEX compile time option for the XMEGA devices.
[pub/USBasp.git] / Demos / Host / ClassDriver / MouseHost / MouseHost.c
index 5c94ecd..1290e48 100644 (file)
@@ -1,13 +1,13 @@
 /*
              LUFA Library
 /*
              LUFA Library
-     Copyright (C) Dean Camera, 2011.
+     Copyright (C) Dean Camera, 2012.
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
-  Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com)
+  Copyright 2012  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
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
@@ -44,12 +44,16 @@ USB_ClassInfo_HID_Host_t Mouse_HID_Interface =
        {
                .Config =
                        {
        {
                .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_MouseBootProtocol,
                        },
        };
                                .HIDInterfaceProtocol   = HID_CSCP_MouseBootProtocol,
                        },
        };
@@ -102,7 +106,7 @@ void MouseHost_Task(void)
 {
        if (USB_HostState != HOST_STATE_Configured)
          return;
 {
        if (USB_HostState != HOST_STATE_Configured)
          return;
-         
+
        if (HID_Host_IsReportReceived(&Mouse_HID_Interface))
        {
                uint8_t LEDMask = LEDS_NO_LEDS;
        if (HID_Host_IsReportReceived(&Mouse_HID_Interface))
        {
                uint8_t LEDMask = LEDS_NO_LEDS;
@@ -185,6 +189,7 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void)
        {
                puts_P(PSTR("Could not Set Boot Protocol Mode.\r\n"));
                LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
        {
                puts_P(PSTR("Could not Set Boot Protocol Mode.\r\n"));
                LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+               USB_Host_SetDeviceConfiguration(0);
                return;
        }
 
                return;
        }