|
|
@ -126,20 +126,19 @@ static void USB_Device_SetAddress(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint8_t DeviceAddress = (USB_ControlRequest.wValue & 0x7F);
|
|
|
|
uint8_t DeviceAddress = (USB_ControlRequest.wValue & 0x7F);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
|
|
|
|
|
|
|
|
{
|
|
|
|
Endpoint_ClearSETUP();
|
|
|
|
Endpoint_ClearSETUP();
|
|
|
|
|
|
|
|
|
|
|
|
Endpoint_ClearStatusStage();
|
|
|
|
Endpoint_ClearStatusStage();
|
|
|
|
|
|
|
|
|
|
|
|
while (!(Endpoint_IsINReady()))
|
|
|
|
while (!(Endpoint_IsINReady()));
|
|
|
|
{
|
|
|
|
|
|
|
|
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
USB_DeviceState = (DeviceAddress) ? DEVICE_STATE_Addressed : DEVICE_STATE_Default;
|
|
|
|
USB_DeviceState = (DeviceAddress) ? DEVICE_STATE_Addressed : DEVICE_STATE_Default;
|
|
|
|
|
|
|
|
|
|
|
|
USB_Device_SetDeviceAddress(DeviceAddress);
|
|
|
|
USB_Device_SetDeviceAddress(DeviceAddress);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void USB_Device_SetConfiguration(void)
|
|
|
|
static void USB_Device_SetConfiguration(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -147,6 +146,8 @@ static void USB_Device_SetConfiguration(void)
|
|
|
|
if ((uint8_t)USB_ControlRequest.wValue > FIXED_NUM_CONFIGURATIONS)
|
|
|
|
if ((uint8_t)USB_ControlRequest.wValue > FIXED_NUM_CONFIGURATIONS)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
|
|
|
|
USB_Descriptor_Device_t* DevDescriptorPtr;
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(USE_FLASH_DESCRIPTORS)
|
|
|
|
#if defined(USE_FLASH_DESCRIPTORS)
|
|
|
|
#define MemoryAddressSpace MEMSPACE_FLASH
|
|
|
|
#define MemoryAddressSpace MEMSPACE_FLASH
|
|
|
|
#elif defined(USE_EEPROM_DESCRIPTORS)
|
|
|
|
#elif defined(USE_EEPROM_DESCRIPTORS)
|
|
|
@ -157,8 +158,6 @@ static void USB_Device_SetConfiguration(void)
|
|
|
|
uint8_t MemoryAddressSpace;
|
|
|
|
uint8_t MemoryAddressSpace;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
USB_Descriptor_Device_t* DevDescriptorPtr;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DevDescriptorPtr
|
|
|
|
if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DevDescriptorPtr
|
|
|
|
#if !defined(USE_FLASH_DESCRIPTORS) && !defined(USE_EEPROM_DESCRIPTORS) && !defined(USE_RAM_DESCRIPTORS)
|
|
|
|
#if !defined(USE_FLASH_DESCRIPTORS) && !defined(USE_EEPROM_DESCRIPTORS) && !defined(USE_RAM_DESCRIPTORS)
|
|
|
|
, &MemoryAddressSpace
|
|
|
|
, &MemoryAddressSpace
|
|
|
@ -199,7 +198,7 @@ static void USB_Device_SetConfiguration(void)
|
|
|
|
EVENT_USB_Device_ConfigurationChanged();
|
|
|
|
EVENT_USB_Device_ConfigurationChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void USB_Device_GetConfiguration(void)
|
|
|
|
static void USB_Device_GetConfiguration(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Endpoint_ClearSETUP();
|
|
|
|
Endpoint_ClearSETUP();
|
|
|
|
|
|
|
|
|
|
|
|