aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-11-04 05:18:43 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-11-04 05:18:43 +0000
commitba8ffa4cb70a45f4e487a874276759d81ae8ae2e (patch)
tree8e79babeeb60718effd321758943f4c2292e6177 /Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c
parent87b2572ae50d20f04dfa6bfbd9e0b8b20ee650e9 (diff)
downloadlufa-ba8ffa4cb70a45f4e487a874276759d81ae8ae2e.tar.gz
lufa-ba8ffa4cb70a45f4e487a874276759d81ae8ae2e.tar.bz2
lufa-ba8ffa4cb70a45f4e487a874276759d81ae8ae2e.zip
Add support for Mouse Scrollwheel to the MouseHostWithParser demos.
Diffstat (limited to 'Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c')
-rw-r--r--Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c
index 736ab522a..d84e2d3ce 100644
--- a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c
+++ b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c
@@ -271,6 +271,21 @@ void ProcessMouseReport(uint8_t* MouseReport)
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)) &&
(ReportItem->ItemType == REPORT_ITEM_TYPE_In))