From 2d49c09b384375298a4995b79c4b29e8d9390cd6 Mon Sep 17 00:00:00 2001
From: Dean Camera <dean@fourwalledcubicle.com>
Date: Thu, 28 Oct 2010 22:51:03 +0000
Subject: [PATCH] Move Set Feature and Clear Feature control request feature
 selector values into their own enum.

---
 .../Drivers/USB/HighLevel/DeviceStandardReq.c |  4 +-
 LUFA/Drivers/USB/HighLevel/StdRequestType.h   | 37 ++++++++++---------
 2 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.c b/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.c
index 1c8bd5b6a..93b4440bc 100644
--- a/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.c
+++ b/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.c
@@ -346,7 +346,7 @@ static void USB_Device_ClearSetFeature(void)
 	{
 		#if !defined(NO_DEVICE_REMOTE_WAKEUP)
 		case REQREC_DEVICE:
-			if ((uint8_t)USB_ControlRequest.wValue == FEATURE_REMOTE_WAKEUP)
+			if ((uint8_t)USB_ControlRequest.wValue == FEATURE_SEL_DeviceRemoteWakeup)
 			  USB_RemoteWakeupEnabled = (USB_ControlRequest.bRequest == REQ_SetFeature);
 			else
 			  return;
@@ -355,7 +355,7 @@ static void USB_Device_ClearSetFeature(void)
 		#endif
 		#if !defined(CONTROL_ONLY_DEVICE)
 		case REQREC_ENDPOINT:
-			if ((uint8_t)USB_ControlRequest.wValue == FEATURE_ENDPOINT_HALT)
+			if ((uint8_t)USB_ControlRequest.wValue == FEATURE_SEL_EndpointHalt)
 			{
 				uint8_t EndpointIndex = ((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK);
 
diff --git a/LUFA/Drivers/USB/HighLevel/StdRequestType.h b/LUFA/Drivers/USB/HighLevel/StdRequestType.h
index 02afc9654..2d8c7cfab 100644
--- a/LUFA/Drivers/USB/HighLevel/StdRequestType.h
+++ b/LUFA/Drivers/USB/HighLevel/StdRequestType.h
@@ -147,23 +147,6 @@
 			#define REQREC_OTHER               (3 << 0)
 			//@}
 
-			/** \name Feature Request Types */
-			//@{
-			/** Feature indicator for Clear Feature or Set Feature commands. When used in a Clear Feature
-			 *  request this indicates that an endpoint (whose address is given elsewhere in the request
-			 *  should have its stall condition cleared. If used in a similar manner inside a Set Feature
-			 *  request, this stalls an endpoint.
-			 */
-			#define FEATURE_ENDPOINT_HALT      0x00
-
-			/** Feature indicator for Clear Feature or Set Feature commands. When used in a Clear Feature
-			 *  request this indicates that the remote wakeup enabled device should not issue remote
-			 *  wakeup requests until further notice. If used in a similar manner inside a Set Feature
-			 *  request, this re-enabled the remote wakeup feature on the device.
-			 */
-			#define FEATURE_REMOTE_WAKEUP      0x01
-			//@}
-
 		/* Type Defines: */
 			/** \brief Standard USB Control Request
 			 *
@@ -230,6 +213,26 @@
 				                              *   via the \ref EVENT_USB_Device_UnhandledControlRequest() event when received in
 				                              *   device mode. */
 			};
+			
+			/** Feature Selector values for Set Feature and Clear Feature standard control requests directed to the device, interface
+			 *  and endpoint recipients.
+			 */
+			enum USB_Feature_Selectors_t
+			{
+				FEATURE_SEL_EndpointHalt       = 0x00, /**< Feature selector for Clear Feature or Set Feature commands. When
+				                                        *   used in a Set Feature or Clear Feature request this indicates that an
+				                                        *   endpoint (whose address is given elsewhere in the request should have
+				                                        *   its stall condition changed.
+				                                        */
+				FEATURE_SEL_DeviceRemoteWakeup = 0x01, /**< Feature selector for Device level Remote Wakeup enable set or clear.
+			                                            *   This feature can be controlled by the host on devices which indicate
+			                                            *   remote wakeup support in their descriptors to selectively disable or
+			                                            *   enable remote wakeup.
+			                                            */
+				FEATURE_SEL_TestMode           = 0x02, /**< Feature selector for Test Mode features, used to test the USB controller
+			                                            *   to check for incorrect operation.
+			                                            */
+			};
 
 	/* Private Interface - For use in library only: */
 		#if !defined(__DOXYGEN__)
-- 
GitLab