All USB class drivers are now automatically included when LUFA/Drivers/USB.h is included, and no longer need to be seperately included.

All LowLevel demos changed to use the constants and types defined in the USB class drivers.
This commit is contained in:
Dean Camera 2010-10-24 22:53:57 +00:00
parent 8f3bee7d86
commit b37d77eab3
208 changed files with 589 additions and 2910 deletions

View file

@ -52,7 +52,7 @@ uint8_t ProcessConfigurationDescriptor(void)
uint16_t CurrConfigBytesRem;
USB_Descriptor_Interface_t* HIDInterface = NULL;
USB_Descriptor_HID_t* HIDDescriptor = NULL;
USB_HID_Descriptor_HID_t* HIDDescriptor = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
/* Retrieve the entire configuration descriptor into the allocated buffer */
@ -95,7 +95,7 @@ uint8_t ProcessConfigurationDescriptor(void)
}
/* Save the HID descriptor for later use */
HIDDescriptor = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_HID_t);
HIDDescriptor = DESCRIPTOR_PCAST(CurrConfigLocation, USB_HID_Descriptor_HID_t);
/* Skip the remainder of the loop as we have not found an endpoint yet */
continue;
@ -178,7 +178,7 @@ uint8_t DComp_NextJoystickInterfaceDataEndpoint(void* CurrentDescriptor)
*/
uint8_t DComp_NextHID(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_HID)
if (DESCRIPTOR_TYPE(CurrentDescriptor) == HID_DTYPE_HID)
return DESCRIPTOR_SEARCH_Found;
else
return DESCRIPTOR_SEARCH_NotFound;

View file

@ -48,12 +48,6 @@
/** Interface Protocol value for a Boot Protocol Mouse compliant device. */
#define JOYSTICK_PROTOCOL 0x02
/** Descriptor header type constant for a HID descriptor. */
#define DTYPE_HID 0x21
/** Descriptor header type constant for a HID report descriptor. */
#define DTYPE_Report 0x22
/** Pipe number for the joystick report data pipe. */
#define JOYSTICK_DATA_IN_PIPE 1

View file

@ -51,7 +51,7 @@ uint8_t GetHIDReportData(void)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_INTERFACE),
.bRequest = REQ_GetDescriptor,
.wValue = (DTYPE_Report << 8),
.wValue = (HID_DTYPE_Report << 8),
.wIndex = 0,
.wLength = HIDReportSize,
};

View file

@ -38,25 +38,24 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Host/HIDParser.h>
#include "JoystickHostWithParser.h"
/* Macros: */
/** HID Report Descriptor Usage for a Joystick. */
#define USAGE_JOYSTICK 0x04
/** HID Report Descriptor Usage Page value for a toggle button. */
#define USAGE_PAGE_BUTTON 0x09
/** HID Report Descriptor Usage Page value for a Generic Desktop Control. */
#define USAGE_PAGE_GENERIC_DCTRL 0x01
/** HID Report Descriptor Usage for a Joystick. */
#define USAGE_JOYSTICK 0x04
/** HID Report Descriptor Usage value for a X axis movement. */
#define USAGE_X 0x30
/** HID Report Descriptor Usage value for a Y axis movement. */
#define USAGE_Y 0x31
#define USAGE_Y 0x31
/* Enums: */
/** Enum for the possible return codes of the \ref GetHIDReportData() function. */
@ -67,21 +66,6 @@
ParseControlError = 2, /**< Control error occurred while trying to read the device HID descriptor */
};
/* Type Defines: */
/** Type define for a HID descriptor. */
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint16_t HIDSpec; /**< Implemented HID class specification, in BCD encoded format */
uint8_t CountryCode; /**< Country code value for localized hardware */
uint8_t TotalHIDDescriptors; /**< Total number of HID report descriptors in the current interface */
uint8_t HIDReportType; /**< HID report type of the first HID report descriptor */
uint16_t HIDReportLength; /**< Total size in bytes of the first HID report descriptor */
} USB_Descriptor_HID_t;
/* External Variables: */
extern uint16_t HIDReportSize;
extern HID_ReportInfo_t HIDReportInfo;

View file

@ -65,7 +65,7 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
/* Function Prototypes: */
void Joystick_HID_Task(void);
void SetupHardware(void);