diff options
author | Dean Camera <[email protected]> | 2011-01-26 21:33:07 +0000 |
---|---|---|
committer | Dean Camera <[email protected]> | 2011-01-26 21:33:07 +0000 |
commit | a852ea8e43d6df9642df3524a974073d2229fa4c (patch) | |
tree | 7524d3d7c881de32080cb0ed82fc4aa16d6f7755 /LUFA | |
parent | 6c7ed7ecd6d4727e33ddb8c5e4321499a2b76151 (diff) | |
download | qmk_firmware-a852ea8e43d6df9642df3524a974073d2229fa4c.tar.gz qmk_firmware-a852ea8e43d6df9642df3524a974073d2229fa4c.zip |
Added new KeyboardMouseMultiReport Device ClassDriver demo.
Fixed ReportID not being removed from the feature/out report data array in the HID class driver when Report IDs are used.
Added new MAX() and MIN() convenience macros.
Diffstat (limited to 'LUFA')
-rw-r--r-- | LUFA/Common/Common.h | 24 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Common/HID.h | 8 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Device/HID.c | 12 | ||||
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/USBInterrupt.h | 10 | ||||
-rw-r--r-- | LUFA/ManPages/ChangeLog.txt | 3 | ||||
-rw-r--r-- | LUFA/ManPages/FutureChanges.txt | 7 | ||||
-rw-r--r-- | LUFA/ManPages/LUFAPoweredProjects.txt | 1 | ||||
-rw-r--r-- | LUFA/ManPages/LibraryApps.txt | 1 | ||||
-rw-r--r-- | LUFA/ManPages/VIDAndPIDValues.txt | 2 |
9 files changed, 48 insertions, 20 deletions
diff --git a/LUFA/Common/Common.h b/LUFA/Common/Common.h index 837cb04755..c1aa27a5f4 100644 --- a/LUFA/Common/Common.h +++ b/LUFA/Common/Common.h @@ -79,6 +79,30 @@ */ #define MACROE while (0) + /** Convenience macro to determine the larger of two values. + * + * \note This macro should only be used with operands that do not have side effects from being evaluated + * multiple times. + * + * \param[in] x First value to compare + * \param[in] y First value to compare + * + * \return The larger of the two input parameters + */ + #define MAX(x, y) ((x > y) ? x : y) + + /** Convenience macro to determine the smaller of two values. + * + * \note This macro should only be used with operands that do not have side effects from being evaluated + * multiple times. + * + * \param[in] x First value to compare + * \param[in] y First value to compare + * + * \return The smaller of the two input parameters + */ + #define MIN(x, y) ((x < y) ? x : y) + /** Defines a volatile \c NOP statement which cannot be optimized out by the compiler, and thus can always * be set as a breakpoint in the resulting code. Useful for debugging purposes, where the optimiser * removes/reorders code to the point where break points cannot reliably be set. diff --git a/LUFA/Drivers/USB/Class/Common/HID.h b/LUFA/Drivers/USB/Class/Common/HID.h index 2c6ec41367..8cb5f6d469 100644 --- a/LUFA/Drivers/USB/Class/Common/HID.h +++ b/LUFA/Drivers/USB/Class/Common/HID.h @@ -340,7 +340,7 @@ * } Joystick_Report; * \endcode * - * Where \c intA_t is a type large enough to hold one bit per button, and \c intB_t is a type large enough to hold the + * Where \c uintA_t is a type large enough to hold one bit per button, and \c intB_t is a type large enough to hold the * ranges of the signed \c MinAxisVal and \c MaxAxisVal values. * * \param[in] MinAxisVal Minimum X/Y logical axis value @@ -370,7 +370,7 @@ HID_RI_REPORT_SIZE(8, (8 - (Buttons % 8))), \ HID_RI_REPORT_COUNT(8, 0x01), \ HID_RI_INPUT(8, HID_IOF_CONSTANT), \ - HID_RI_END_COLLECTION(0), + HID_RI_END_COLLECTION(0) /** \hideinitializer * A list of HID report item array elements that describe a typical HID USB keyboard. The resulting report descriptor @@ -421,7 +421,7 @@ HID_RI_REPORT_COUNT(8, MaxKeys), \ HID_RI_REPORT_SIZE(8, 0x08), \ HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_ARRAY | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE), \ - HID_RI_END_COLLECTION(0), + HID_RI_END_COLLECTION(0) /** \hideinitializer * A list of HID report item array elements that describe a typical HID USB mouse. The resulting report descriptor @@ -475,7 +475,7 @@ HID_RI_REPORT_SIZE(8, (((((uint16_t)MinAxisVal > 0xFF) && ((uint16_t)MaxAxisVal < 0xFF)) ? 8 : 16))), \ HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | (AbsoluteCoords ? HID_IOF_ABSOLUTE : HID_IOF_RELATIVE) | HID_IOF_NON_VOLATILE), \ HID_RI_END_COLLECTION(0), \ - HID_RI_END_COLLECTION(0), + HID_RI_END_COLLECTION(0) //@} /* Type Defines: */ diff --git a/LUFA/Drivers/USB/Class/Device/HID.c b/LUFA/Drivers/USB/Class/Device/HID.c index e75b022f57..4126738240 100644 --- a/LUFA/Drivers/USB/Class/Device/HID.c +++ b/LUFA/Drivers/USB/Class/Device/HID.c @@ -59,8 +59,11 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, ReportType, ReportData, &ReportSize); if (HIDInterfaceInfo->Config.PrevReportINBuffer != NULL) - memcpy(HIDInterfaceInfo->Config.PrevReportINBuffer, ReportData, HIDInterfaceInfo->Config.PrevReportINBufferSize); - + { + memcpy(HIDInterfaceInfo->Config.PrevReportINBuffer, ReportData, + HIDInterfaceInfo->Config.PrevReportINBufferSize); + } + Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); Endpoint_ClearSETUP(); @@ -80,8 +83,9 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter Endpoint_ClearSETUP(); Endpoint_Read_Control_Stream_LE(ReportData, ReportSize); Endpoint_ClearIN(); - - CALLBACK_HID_Device_ProcessHIDReport(HIDInterfaceInfo, ReportID, ReportType, ReportData, ReportSize); + + CALLBACK_HID_Device_ProcessHIDReport(HIDInterfaceInfo, ReportID, ReportType, + &ReportData[ReportID ? 1 : 0], ReportSize - (ReportID ? 1 : 0)); } break; diff --git a/LUFA/Drivers/USB/LowLevel/USBInterrupt.h b/LUFA/Drivers/USB/LowLevel/USBInterrupt.h index 29ad933881..da516b45f8 100644 --- a/LUFA/Drivers/USB/LowLevel/USBInterrupt.h +++ b/LUFA/Drivers/USB/LowLevel/USBInterrupt.h @@ -60,11 +60,11 @@ /* Private Interface - For use in library only: */ #if !defined(__DOXYGEN__) /* Macros: */ - #define USB_INT_Enable(int) MACROS{ USB_INT_GET_EN_REG(int) |= USB_INT_GET_EN_MASK(int); }MACROE - #define USB_INT_Disable(int) MACROS{ USB_INT_GET_EN_REG(int) &= ~(USB_INT_GET_EN_MASK(int)); }MACROE - #define USB_INT_Clear(int) MACROS{ USB_INT_GET_INT_REG(int) &= ~(USB_INT_GET_INT_MASK(int)); }MACROE - #define USB_INT_IsEnabled(int) ((USB_INT_GET_EN_REG(int) & USB_INT_GET_EN_MASK(int)) ? true : false) - #define USB_INT_HasOccurred(int) ((USB_INT_GET_INT_REG(int) & USB_INT_GET_INT_MASK(int)) ? true : false) + #define USB_INT_Enable(int) do { USB_INT_GET_EN_REG(int) |= USB_INT_GET_EN_MASK(int); } while(0) + #define USB_INT_Disable(int) do { USB_INT_GET_EN_REG(int) &= ~(USB_INT_GET_EN_MASK(int)); } while(0) + #define USB_INT_Clear(int) do { USB_INT_GET_INT_REG(int) &= ~(USB_INT_GET_INT_MASK(int)); } while(0) + #define USB_INT_IsEnabled(int) ((USB_INT_GET_EN_REG(int) & USB_INT_GET_EN_MASK(int)) ? true : false) + #define USB_INT_HasOccurred(int) ((USB_INT_GET_INT_REG(int) & USB_INT_GET_INT_MASK(int)) ? true : false) #define USB_INT_GET_EN_REG(a, b, c, d) a #define USB_INT_GET_EN_MASK(a, b, c, d) b diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt index b4a836c707..a6cd5838aa 100644 --- a/LUFA/ManPages/ChangeLog.txt +++ b/LUFA/ManPages/ChangeLog.txt @@ -20,8 +20,10 @@ * - Added new HID report item macros (with HID_RI_ prefix) to allow for easy creation and editing of HID report descriptors * - Added new HID_DESCRIPTOR_MOUSE, HID_DESCRIPTOR_KEYBOARD and HID_DESCRIPTOR_JOYSTICK macros for easy automatic creation of * basic USB HID device reports + * - Added new MAX() and MIN() convenience macros * - Library Applications: * - Added ability to write protect Mass Storage disk write operations from the host OS + * - Added new KeyboardMouseMultiReport Device ClassDriver demo * * <b>Changed:</b> * - Core: @@ -59,6 +61,7 @@ * - Fixed incorrect byte ordering in the Audio_Device_WriteSample24 function (thanks to WZab) * - Fixed several functions in the Host mode Still Image Class driver returning an error code from the incorrect * error code enum (thanks to Daniel Seibert) + * - Fixed ReportID not being removed from the feature/out report data array in the HID class driver when Report IDs are used * - Library Applications: * - Fixed Benito project discarding incoming data from the USB virtual serial port when the USART is busy * - Fixed broken DFU bootloader, added XPLAIN support for bootloader start when XCK jumpered to ground diff --git a/LUFA/ManPages/FutureChanges.txt b/LUFA/ManPages/FutureChanges.txt index 2cb485aad9..7c03b90f68 100644 --- a/LUFA/ManPages/FutureChanges.txt +++ b/LUFA/ManPages/FutureChanges.txt @@ -15,19 +15,15 @@ * - Code Features * -# Add hub support when in Host mode for multiple devices * -# Investigate virtual hubs when in device mode instead of composite devices - * -# Add ability to get number of bytes not written with pipe/endpoint write routines after an error * -# Change makefiles to allow for absolute LUFA location to be used * -# Re-add interrupt Pipe/Endpoint support * -# Investigate dynamically created device descriptors - * - Known Bugs - * -# No wakeup when plugged into hub, and hub plugged into host - * -# Incomplete TMC class demo errors + * -# Re-add in software PDI/TPI support into the AVRISP-MKII project * - Documentation/Support * -# Add detailed overviews of how each demo works * -# Add board overviews * -# Write LUFA tutorials * - Demos/Projects - * -# Multiple-Report HID device * -# Device/Host USB bridge * -# Alternative (USB-IF endorsed) USB-CDC Ethernet Class * -# Finish Test and Measurement Class demo @@ -36,7 +32,6 @@ * -# Finish StandaloneProgrammer project * -# Arduino Uno compatible USB-MIDI, USB-HID * -# Make Webserver project work in RNDIS device mode - * -# Make rescue clock always active on U4, U6 and U7 targets in AVRISP-MKII Clone project * - Ports * -# AVR32 UC3B series microcontrollers * -# Atmel ARM7 series microcontrollers diff --git a/LUFA/ManPages/LUFAPoweredProjects.txt b/LUFA/ManPages/LUFAPoweredProjects.txt index a2a6740d1a..0bc4f8a543 100644 --- a/LUFA/ManPages/LUFAPoweredProjects.txt +++ b/LUFA/ManPages/LUFAPoweredProjects.txt @@ -72,6 +72,7 @@ * - Touchscreen Input Device: http://capnstech.blogspot.com/2010/07/touchscreen-update.html * - USB Interface for Playstation Portable Devices: http://forums.ps2dev.org/viewtopic.php?t=11001 * - Userial, a USB to Serial converter with SPI, I2C and other protocols: http://www.tty1.net/userial/ + * - Wireless MIDI Guitar system: http://www.ise.pw.edu.pl/~wzab/wireless_guitar_system/ * - XUM1541, a Commodore 64 floppy drive to USB adapter: http://www.root.org/~nate/c64/xum1541/ * * \section Sec_LUFACommercialProjects Projects Using LUFA (Commercial) diff --git a/LUFA/ManPages/LibraryApps.txt b/LUFA/ManPages/LibraryApps.txt index 98ccfc270d..9964bb0499 100644 --- a/LUFA/ManPages/LibraryApps.txt +++ b/LUFA/ManPages/LibraryApps.txt @@ -38,6 +38,7 @@ * - <b>Joystick</b> - USB Joystick demo, using the library USB HID Class driver framework * - <b>Keyboard</b> - USB Keyboard demo, using the library USB HID Class driver framework * - <b>KeyboardMouse</b> - Dual Keyboard/Mouse demo, using the library USB HID Class driver framework + * - <b>KeyboardMouseMultiReport</b> - Multi HID report Keyboard/Mouse demo, using the library USB HID Class driver framework * - <b>MassStorage</b> - Dual Drive Mass Storage demo, using the library USB Mass Storage Class driver framework * - <b>MassStorageKeyboard</b> - Mass Storage and Keyboard demo, using the library USB Mass Storage/HID Class driver frameworks * - <b>MIDI</b> - MIDI In demo, using the library USB MIDI-Audio Class driver framework diff --git a/LUFA/ManPages/VIDAndPIDValues.txt b/LUFA/ManPages/VIDAndPIDValues.txt index 0b88a0c718..aa333a54d8 100644 --- a/LUFA/ManPages/VIDAndPIDValues.txt +++ b/LUFA/ManPages/VIDAndPIDValues.txt @@ -301,7 +301,7 @@ * 0x2066 * </td> * <td> - * <i>Currently Unallocated</i> + * Multiple Report Keyboard/Mouse HID Demo * </td> * </tr> * |