USB_DeviceState = (DeviceAddress) ? DEVICE_STATE_Addressed : DEVICE_STATE_Default;
USB_Device_SetDeviceAddress(DeviceAddress);
-
- return;
}
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();
}
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;
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();
+ }
}
}