27 for (uint8_t i = 0; i < len; i++) {
28 D_PrintHex<uint8_t > (buf[i], 0x80);
32 memcpy(&psbuzzButtons, buf + 2, min((uint8_t)(len - 2),
MFK_CASTUINT8T sizeof(psbuzzButtons)));
34 if (psbuzzButtons.
val != oldButtonState.
val) {
35 buttonClickState.
val = psbuzzButtons.
val & ~oldButtonState.
val;
36 oldButtonState.
val = psbuzzButtons.
val;
53 return psbuzzButtons.
val & (1UL << (b + 5 * controller));
57 uint32_t mask = (1UL << (b + 5 * controller));
58 bool click = buttonClickState.
val & mask;
59 buttonClickState.
val &= ~mask;
65 ledState[controller] = value;
69 buf[1] = ledState[0] ? 0xFF : 0x00;
70 buf[2] = ledState[1] ? 0xFF : 0x00;
71 buf[3] = ledState[2] ? 0xFF : 0x00;
72 buf[4] = ledState[3] ? 0xFF : 0x00;
76 PSBuzz_Command(buf,
sizeof(buf));
79 void PSBuzz::PSBuzz_Command(uint8_t *data, uint16_t nbytes) {
81 pUsb->
ctrlReq(
bAddress,
epInfo[0].epAddr,
bmREQ_HID_OUT,
HID_REQUEST_SET_REPORT, 0x00, 0x02, 0x00, nbytes, nbytes, data, NULL);