Fixed SPI driver not explicitly setting /SS and MISO pins as inputs when SPI_Init...
[pub/USBasp.git] / LUFA / Drivers / USB / HighLevel / DeviceStandardReq.c
index 64af140..d13ac74 100644 (file)
@@ -139,8 +139,6 @@ static void USB_Device_SetAddress(void)
        USB_DeviceState = (DeviceAddress) ? DEVICE_STATE_Addressed : DEVICE_STATE_Default;
 
        USB_Device_SetDeviceAddress(DeviceAddress);
-
-       return;
 }
 
 static void USB_Device_SetConfiguration(void)
@@ -193,7 +191,10 @@ static void USB_Device_SetConfiguration(void)
 
        Endpoint_ClearStatusStage();
 
-       USB_DeviceState = (USB_ConfigurationNumber) ? DEVICE_STATE_Configured : DEVICE_STATE_Addressed;
+       if (USB_ConfigurationNumber)
+         USB_DeviceState = DEVICE_STATE_Configured;
+       else
+         USB_DeviceState = (USB_Device_IsAddressSet()) ? DEVICE_STATE_Configured : DEVICE_STATE_Powered;
 
        EVENT_USB_Device_ConfigurationChanged();
 }
@@ -254,8 +255,8 @@ static void USB_Device_GetInternalSerialDescriptor(void)
 
 static void USB_Device_GetDescriptor(void)
 {
-       void*    DescriptorPointer;
-       uint16_t DescriptorSize;
+       const void* DescriptorPointer;
+       uint16_t    DescriptorSize;
        
        #if !defined(USE_FLASH_DESCRIPTORS) && !defined(USE_EEPROM_DESCRIPTORS) && !defined(USE_RAM_DESCRIPTORS)
        uint8_t  DescriptorAddressSpace;
@@ -364,18 +365,18 @@ static void USB_Device_ClearSetFeature(void)
 
                                Endpoint_SelectEndpoint(EndpointIndex);
 
-                               if (!(Endpoint_IsEnabled()))
-                                 return;
-
-                               if (USB_ControlRequest.bRequest == REQ_SetFeature)
-                               {
-                                       Endpoint_StallTransaction();
-                               }
-                               else
-                               {
-                                       Endpoint_ClearStall();
-                                       Endpoint_ResetFIFO(EndpointIndex);
-                                       Endpoint_ResetDataToggle();
+                               if (Endpoint_IsEnabled())
+                               {                               
+                                       if (USB_ControlRequest.bRequest == REQ_SetFeature)
+                                       {
+                                               Endpoint_StallTransaction();
+                                       }
+                                       else
+                                       {
+                                               Endpoint_ClearStall();
+                                               Endpoint_ResetFIFO(EndpointIndex);
+                                               Endpoint_ResetDataToggle();
+                                       }                                       
                                }
                        }