aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-11-04 04:17:11 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-11-04 04:17:11 +0000
commitf93f73210892cec94a6ca446776879dee64484ed (patch)
treef01b432254d1a5a6824e7cf0540a2af2a2769057 /LUFA/Drivers
parent0899deaae3355428a4be749bdc618799a7d6af2d (diff)
downloadlufa-f93f73210892cec94a6ca446776879dee64484ed.tar.gz
lufa-f93f73210892cec94a6ca446776879dee64484ed.tar.bz2
lufa-f93f73210892cec94a6ca446776879dee64484ed.zip
Update DevChapter9.c - use the Endpoint_ClearStatusStage() function where possible to reduce code size and (potentially) allow for centralized status stage timeouts.
Fix Joystick device demo HID descriptors - buttons should be placed outside the Pointer collection.
Diffstat (limited to 'LUFA/Drivers')
-rw-r--r--LUFA/Drivers/USB/LowLevel/DevChapter9.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/LUFA/Drivers/USB/LowLevel/DevChapter9.c b/LUFA/Drivers/USB/LowLevel/DevChapter9.c
index 50afb61be..89c4e2998 100644
--- a/LUFA/Drivers/USB/LowLevel/DevChapter9.c
+++ b/LUFA/Drivers/USB/LowLevel/DevChapter9.c
@@ -121,7 +121,7 @@ static void USB_Device_SetAddress(void)
Endpoint_ClearSETUP();
- Endpoint_ClearIN();
+ Endpoint_ClearStatusStage();
while (!(Endpoint_IsINReady()))
{
@@ -190,7 +190,7 @@ static void USB_Device_SetConfiguration(void)
USB_ConfigurationNumber = (uint8_t)USB_ControlRequest.wValue;
- Endpoint_ClearIN();
+ Endpoint_ClearStatusStage();
if (USB_ConfigurationNumber)
USB_DeviceState = DEVICE_STATE_Configured;
@@ -205,16 +205,9 @@ void USB_Device_GetConfiguration(void)
Endpoint_ClearSETUP();
Endpoint_Write_Byte(USB_ConfigurationNumber);
-
Endpoint_ClearIN();
- while (!(Endpoint_IsOUTReceived()))
- {
- if (USB_DeviceState == DEVICE_STATE_Unattached)
- return;
- }
-
- Endpoint_ClearOUT();
+ Endpoint_ClearStatusStage();
}
#if !defined(NO_INTERNAL_SERIAL) && (defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
@@ -251,7 +244,9 @@ static void USB_Device_GetInternalSerialDescriptor(void)
}
Endpoint_ClearSETUP();
+
Endpoint_Write_Control_Stream_LE(&SignatureDescriptor, sizeof(SignatureDescriptor));
+
Endpoint_ClearOUT();
}
#endif
@@ -334,16 +329,9 @@ static void USB_Device_GetStatus(void)
Endpoint_ClearSETUP();
Endpoint_Write_Word_LE(CurrentStatus);
-
Endpoint_ClearIN();
- while (!(Endpoint_IsOUTReceived()))
- {
- if (USB_DeviceState == DEVICE_STATE_Unattached)
- return;
- }
-
- Endpoint_ClearOUT();
+ Endpoint_ClearStatusStage();
}
static void USB_Device_ClearSetFeature(void)
@@ -391,7 +379,7 @@ static void USB_Device_ClearSetFeature(void)
Endpoint_ClearSETUP();
- Endpoint_ClearIN();
+ Endpoint_ClearStatusStage();
}
#endif