/*\r
LUFA Library\r
- Copyright (C) Dean Camera, 2009.\r
+ Copyright (C) Dean Camera, 2010.\r
\r
dean [at] fourwalledcubicle [dot] com\r
www.fourwalledcubicle.com\r
*/\r
\r
/*\r
- Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
\r
Permission to use, copy, modify, distribute, and sell this \r
software and its documentation for any purpose is hereby granted\r
this software.\r
*/\r
\r
+#define __INCLUDE_FROM_USB_DRIVER\r
#include "../HighLevel/USBMode.h"\r
\r
#if defined(USB_CAN_BE_DEVICE)\r
\r
-#define INCLUDE_FROM_DEVCHAPTER9_C\r
+#define __INCLUDE_FROM_DEVCHAPTER9_C\r
#include "DevChapter9.h"\r
\r
uint8_t USB_ConfigurationNumber;\r
#endif\r
#if !defined(CONTROL_ONLY_DEVICE)\r
case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_ENDPOINT):\r
- Endpoint_SelectEndpoint(USB_ControlRequest.wIndex & 0xFF);\r
+ Endpoint_SelectEndpoint((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK);\r
\r
CurrentStatus = Endpoint_IsStalled();\r
\r
}\r
\r
static void USB_Device_ClearSetFeature(void)\r
-{ \r
+{\r
switch (USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT)\r
{\r
#if !defined(NO_DEVICE_REMOTE_WAKEUP) \r
\r
Endpoint_SelectEndpoint(EndpointIndex);\r
\r
- if (Endpoint_IsEnabled())\r
- { \r
- if (USB_ControlRequest.bRequest == REQ_SetFeature)\r
- {\r
- Endpoint_StallTransaction();\r
- }\r
- else\r
- {\r
- Endpoint_ClearStall();\r
- Endpoint_ResetFIFO(EndpointIndex);\r
- Endpoint_ResetDataToggle();\r
- } \r
+ if (!(Endpoint_IsEnabled()))\r
+ return;\r
+\r
+ if (USB_ControlRequest.bRequest == REQ_SetFeature)\r
+ {\r
+ Endpoint_StallTransaction();\r
+ }\r
+ else\r
+ {\r
+ Endpoint_ClearStall();\r
+ Endpoint_ResetFIFO(EndpointIndex);\r
+ Endpoint_ResetDataToggle();\r
}\r
}\r
\r