Fixed error in GenericHID descriptors preventing it from passing the USB-IF HID tests (thanks to Søren Greiner).
0x09, 0x02, /* Usage (Vendor Defined) */\r
0x75, 0x08, /* Report Size (8) */\r
0x95, GENERIC_REPORT_SIZE, /* Report Count (GENERIC_REPORT_SIZE) */\r
- 0x15, 0x00, /* Logical Minimum (0) */\r
- 0x25, 0xff, /* Logical Maximum (255) */\r
+ 0x15, 0x80, /* Logical Minimum (-128) */\r
+ 0x25, 0x7F, /* Logical Maximum (127) */\r
0x81, 0x02, /* Input (Data, Variable, Absolute) */\r
0x09, 0x03, /* Usage (Vendor Defined) */\r
0x75, 0x08, /* Report Size (8) */\r
* - Fixed USB Pad regulator not being disabled on some AVR models when the USB_OPT_REG_DISABLED option is used\r
* - Fixed Host mode to Device mode UID change not causing a USB Disconnect event when a device was connected\r
* - Fixed Mouse/Keyboard demos not performing the correct arithmetic on the Idle period at the right times (thanks to Brian Dickman)\r
+ * - Fixed GenericHID failing HID class tests due to incorrect Logical Minimum and Logical Maximum values (thanks to Søren Greiner)\r
*\r
*\r
* \section Sec_ChangeLog090605 Version 090605\r
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | KEYBOARD_EPNUM),\r
.Attributes = EP_TYPE_INTERRUPT,\r
.EndpointSize = KEYBOARD_EPSIZE,\r
- .PollingIntervalMS = 0x04\r
+ .PollingIntervalMS = 0x01\r
},\r
};\r
\r
bool ClockPinLevel = ((Magstripe_LCL & TrackInfo[Track].ClockMask) != 0);\r
bool ClockLevelChanged = (((Magstripe_LCL ^ Magstripe_Prev) & TrackInfo[Track].ClockMask) != 0);\r
\r
+ /* Sample on rising clock edges */\r
if (ClockPinLevel && ClockLevelChanged)\r
BitBuffer_StoreNextBit(&TrackDataBuffers[Track], DataPinLevel);\r
}\r
static bool IsKeyReleaseReport;\r
static bool IsNewlineReport;\r
\r
- BitBuffer_t* Buffer = NULL;\r
USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;\r
+ BitBuffer_t* Buffer = NULL;\r
\r
- /* Key reports must be interleaved with 0 Key Code reports to release the keys, or repeated keys will be ignored */\r
+ /* Key reports must be interleaved with key release reports, or repeated keys will be ignored */\r
IsKeyReleaseReport = !IsKeyReleaseReport; \r
\r
if (IsKeyReleaseReport)\r
{\r
- KeyboardReport->KeyCode = 0;\r
+ KeyboardReport->KeyCode = KEY_NONE;\r
}\r
else if (IsNewlineReport)\r
{\r
}\r
else\r
{\r
+ /* Read out tracks in ascending order - when each track buffer is empty, progress to next buffer */\r
if (TrackDataBuffers[0].Elements)\r
Buffer = &TrackDataBuffers[0];\r
else if (TrackDataBuffers[1].Elements)\r
\r
KeyboardReport->KeyCode = BitBuffer_GetNextBit(Buffer) ? KEY_1 : KEY_0;\r
\r
- /* If buffer now empty, next report must be a newline to seperate track data */\r
+ /* If current track buffer now empty, next report must be a newline to seperate track data */\r
if (!(Buffer->Elements))\r
IsNewlineReport = true;\r
}\r
#include <LUFA/Drivers/USB/Class/HID.h>\r
\r
/* Macros: */\r
+ /** HID keyboard keycode to indicate that no is currently pressed. */\r
+ #define KEY_NONE 0\r
+ \r
/** HID keyboard keycode to indicate that the "1" key is currently pressed. */\r
#define KEY_1 30\r
\r
void Read_Joystick_Status(void)\r
{\r
uint8_t JoyStatus_LCL = Joystick_GetStatus();\r
+ uint8_t Buttons_LCL = Buttons_GetStatus();\r
\r
- if (BUTTONS_BUTTON1 && Buttons_GetStatus())\r
+ if (Buttons_LCL & BUTTONS_BUTTON1)\r
Send_Command(CMD_FIRE);\r
else if (JoyStatus_LCL & JOY_UP)\r
Send_Command(CMD_UP);\r
/* Class specific request to send a HID report to the device */\r
USB_ControlRequest = (USB_Request_Header_t)\r
{\r
- .bmRequestType = 0x21,\r
+ .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),\r
.bRequest = 0x09,\r
.wValue = 0x02,\r
.wIndex = 0x01,\r