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.
This commit is contained in:
Dean Camera 2011-01-26 21:33:07 +00:00
parent 6c7ed7ecd6
commit a852ea8e43
22 changed files with 3086 additions and 23 deletions

View file

@ -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.

View file

@ -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: */

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -301,7 +301,7 @@
* 0x2066
* </td>
* <td>
* <i>Currently Unallocated</i>
* Multiple Report Keyboard/Mouse HID Demo
* </td>
* </tr>
*