From b17e87d1406f8d193ddd2a0700081d24e8bcffcc Mon Sep 17 00:00:00 2001
From: Dean Camera <dean@fourwalledcubicle.com>
Date: Sun, 19 Sep 2010 06:09:25 +0000
Subject: [PATCH] More simplifications to USBController.c, fix errors and
 warnings when compiled for the series 2 USB AVRs.

---
 LUFA/Drivers/USB/LowLevel/USBController.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/LUFA/Drivers/USB/LowLevel/USBController.c b/LUFA/Drivers/USB/LowLevel/USBController.c
index 7177e2b0e..49bd05b64 100644
--- a/LUFA/Drivers/USB/LowLevel/USBController.c
+++ b/LUFA/Drivers/USB/LowLevel/USBController.c
@@ -130,32 +130,36 @@ void USB_ResetInterface(void)
 
 	USB_CLK_Unfreeze();
 
-	#if defined(USB_DEVICE_ONLY) && (defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
-	UHWCON |=  (1 << UIMOD);
-	USB_Init_Device();
-	#elif defined(USB_HOST_ONLY)
-	UHWCON &= ~(1 << UIMOD);
-	USB_Init_Host();
-	#elif defined(USB_CAN_BE_BOTH)
+	#if defined(USB_CAN_BE_BOTH)
 	if (UIDModeSelectEnabled)
 	{
 		UHWCON |= (1 << UIDE);
 		USB_INT_Enable(USB_INT_IDTI);
 	}
+	#endif
 	
 	if (USB_CurrentMode == USB_MODE_DEVICE)
 	{
+		#if defined(USB_CAN_BE_DEVICE)
+		#if (defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
 		UHWCON |=  (1 << UIMOD);
+		#endif
+		
 		USB_Init_Device();
+		#endif
 	}
 	else
 	{
+		#if defined(USB_CAN_BE_HOST)
 		UHWCON &= ~(1 << UIMOD);
 		USB_Init_Host();
+		#endif
 	}
-	#endif
 	
+	#if (defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
 	USB_OTGPAD_On();
+	#endif
+	
 	USB_Attach();
 }
 
-- 
GitLab