Add support for Mouse Scrollwheel to the MouseHostWithParser demos.
This commit is contained in:
parent
87b2572ae5
commit
ba8ffa4cb7
17 changed files with 70 additions and 34 deletions
|
@ -141,6 +141,21 @@ int main(void)
|
|||
if (ReportItem->Value)
|
||||
LEDMask = LEDS_ALL_LEDS;
|
||||
}
|
||||
else if ((ReportItem->Attributes.Usage.Page == USAGE_PAGE_GENERIC_DCTRL) &&
|
||||
(ReportItem->Attributes.Usage.Usage == USAGE_SCROLL_WHEEL) &&
|
||||
(ReportItem->ItemType == REPORT_ITEM_TYPE_In))
|
||||
{
|
||||
/* Get the mouse wheel value if it is contained within the current
|
||||
* report, if not, skip to the next item in the parser list
|
||||
*/
|
||||
if (!(USB_GetHIDReportItemInfo(MouseReport, ReportItem)))
|
||||
continue;
|
||||
|
||||
int16_t WheelDelta = (int16_t)(ReportItem->Value << (16 - ReportItem->Attributes.BitSize));
|
||||
|
||||
if (WheelDelta)
|
||||
LEDMask = (LEDS_LED1 | LEDS_LED2 | ((WheelDelta > 0) ? LEDS_LED3 : LEDS_LED4));
|
||||
}
|
||||
else if ((ReportItem->Attributes.Usage.Page == USAGE_PAGE_GENERIC_DCTRL) &&
|
||||
((ReportItem->Attributes.Usage.Usage == USAGE_X) ||
|
||||
(ReportItem->Attributes.Usage.Usage == USAGE_Y)) &&
|
||||
|
|
|
@ -78,6 +78,9 @@
|
|||
/** HID Report Descriptor Usage value for a Y axis movement */
|
||||
#define USAGE_Y 0x31
|
||||
|
||||
/** HID Report Descriptor Usage value for a Scroll Wheel movement */
|
||||
#define USAGE_SCROLL_WHEEL 0x38
|
||||
|
||||
/* Function Prototypes: */
|
||||
void SetupHardware(void);
|
||||
|
||||
|
|
|
@ -47,10 +47,10 @@
|
|||
* reports, allowing for correct operation across all USB mice. This
|
||||
* demo supports mice with a single HID report.
|
||||
*
|
||||
* Mouse movement and button presses are displayed on the board LEDs.
|
||||
* On connection to a USB mouse, the report items will be processed and
|
||||
* printed as a formatted list through the USART before the mouse is
|
||||
* fully enumerated.
|
||||
* Mouse and scroll wheel movement and button presses are displayed
|
||||
* on the board LEDs. On connection to a USB mouse, the report items
|
||||
* will be processed and printed as a formatted list through the USART
|
||||
* before the mouse is fully enumerated.
|
||||
*
|
||||
* Currently only single interface mice are supported.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue