From 2b51944a4bf6123ca5fb59bd967b8f4a1fa944e1 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Tue, 16 Feb 2010 12:25:31 +0000 Subject: [PATCH] Make sure the button report set masks use OR in all circumstances, to prevent user confusion. While the first set of the buttons report item can be a direct assignment, it is not immediately clear to new developers why this is the case. --- Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c | 2 +- Demos/Device/ClassDriver/Mouse/Mouse.c | 2 +- .../Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c | 2 +- Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c index af6e839496..1c01730b02 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c +++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c @@ -217,7 +217,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn MouseReport->X = 1; if (JoyStatus_LCL & JOY_PRESS) - MouseReport->Button = (1 << 0); + MouseReport->Button |= (1 << 0); *ReportSize = sizeof(USB_MouseReport_Data_t); return true; diff --git a/Demos/Device/ClassDriver/Mouse/Mouse.c b/Demos/Device/ClassDriver/Mouse/Mouse.c index 22f0895ea0..48348c774a 100644 --- a/Demos/Device/ClassDriver/Mouse/Mouse.c +++ b/Demos/Device/ClassDriver/Mouse/Mouse.c @@ -155,7 +155,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn MouseReport->X = 1; if (JoyStatus_LCL & JOY_PRESS) - MouseReport->Button = (1 << 0); + MouseReport->Button |= (1 << 0); if (ButtonStatus_LCL & BUTTONS_BUTTON1) MouseReport->Button |= (1 << 1); diff --git a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c index 5edda2f9d4..e7c899b79d 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c +++ b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c @@ -217,7 +217,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn MouseReport->X = 1; if (JoyStatus_LCL & JOY_PRESS) - MouseReport->Button = (1 << 0); + MouseReport->Button |= (1 << 0); if (ButtonStatus_LCL & BUTTONS_BUTTON1) MouseReport->Button |= (1 << 1); diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c b/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c index b07c2be31c..0ae28255c8 100644 --- a/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c +++ b/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c @@ -123,7 +123,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn MouseReport->X = -1; if (JoyStatus_LCL & JOY_PRESS) - MouseReport->Button = (1 << 0); + MouseReport->Button |= (1 << 0); if (ButtonStatus_LCL & BUTTONS_BUTTON1) MouseReport->Button |= (1 << 1);