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.

pull/1469/head
Dean Camera 15 years ago
parent 015956baba
commit 2b51944a4b

@ -217,7 +217,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
MouseReport->X = 1; MouseReport->X = 1;
if (JoyStatus_LCL & JOY_PRESS) if (JoyStatus_LCL & JOY_PRESS)
MouseReport->Button = (1 << 0); MouseReport->Button |= (1 << 0);
*ReportSize = sizeof(USB_MouseReport_Data_t); *ReportSize = sizeof(USB_MouseReport_Data_t);
return true; return true;

@ -155,7 +155,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
MouseReport->X = 1; MouseReport->X = 1;
if (JoyStatus_LCL & JOY_PRESS) if (JoyStatus_LCL & JOY_PRESS)
MouseReport->Button = (1 << 0); MouseReport->Button |= (1 << 0);
if (ButtonStatus_LCL & BUTTONS_BUTTON1) if (ButtonStatus_LCL & BUTTONS_BUTTON1)
MouseReport->Button |= (1 << 1); MouseReport->Button |= (1 << 1);

@ -217,7 +217,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
MouseReport->X = 1; MouseReport->X = 1;
if (JoyStatus_LCL & JOY_PRESS) if (JoyStatus_LCL & JOY_PRESS)
MouseReport->Button = (1 << 0); MouseReport->Button |= (1 << 0);
if (ButtonStatus_LCL & BUTTONS_BUTTON1) if (ButtonStatus_LCL & BUTTONS_BUTTON1)
MouseReport->Button |= (1 << 1); MouseReport->Button |= (1 << 1);

@ -123,7 +123,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
MouseReport->X = -1; MouseReport->X = -1;
if (JoyStatus_LCL & JOY_PRESS) if (JoyStatus_LCL & JOY_PRESS)
MouseReport->Button = (1 << 0); MouseReport->Button |= (1 << 0);
if (ButtonStatus_LCL & BUTTONS_BUTTON1) if (ButtonStatus_LCL & BUTTONS_BUTTON1)
MouseReport->Button |= (1 << 1); MouseReport->Button |= (1 << 1);

Loading…
Cancel
Save