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.

This commit is contained in:
Dean Camera 2010-02-16 12:25:31 +00:00
parent 015956baba
commit 2b51944a4b
4 changed files with 4 additions and 4 deletions

View File

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

View File

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

View File

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

View File

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