25 if (prevState.mouseInfo.bmLeftButton == 0 && pmi->
bmLeftButton == 1)
28 if (prevState.mouseInfo.bmLeftButton == 1 && pmi->
bmLeftButton == 0)
31 if (prevState.mouseInfo.bmRightButton == 0 && pmi->
bmRightButton == 1)
34 if (prevState.mouseInfo.bmRightButton == 1 && pmi->
bmRightButton == 0)
37 if (prevState.mouseInfo.bmMiddleButton == 0 && pmi->
bmMiddleButton == 1)
40 if (prevState.mouseInfo.bmMiddleButton == 1 && pmi->
bmMiddleButton == 0)
43 if (prevState.mouseInfo.dX != pmi->
dX || prevState.mouseInfo.dY != pmi->
dY)
47 for (uint8_t i = 0; i<
sizeof (
MOUSEINFO); i++)
48 prevState.bInfo[i] = buf[i];
68 if(prevState.mouseInfo.bmLeftButton != pmi->
bmLeftButton ) {
108 if(pmi->
dX || pmi->
dY) {
122 prevState.bInfo[0] = buf[0];
135 if (prevState.bInfo[0x00] != buf[0x00]) {
136 OnControlKeysChanged(prevState.bInfo[0x00], buf[0x00]);
139 for (uint8_t i = 2; i < 8; i++) {
143 for (uint8_t j = 2; j < 8; j++) {
144 if (buf[i] == prevState.bInfo[j] && buf[i] != 1)
146 if (buf[j] == prevState.bInfo[i] && prevState.bInfo[i] != 1)
150 HandleLockingKeys(hid, buf[i]);
151 OnKeyDown(*buf, buf[i]);
154 OnKeyUp(prevState.bInfo[0], prevState.bInfo[i]);
156 for (uint8_t i = 0; i < 8; i++)
157 prevState.bInfo[i] = buf[i];
160 const uint8_t KeyboardReportParser::numKeys[10] PROGMEM = {
'!',
'@',
'#',
'$',
'%',
'^',
'&',
'*',
'(',
')'};
161 const uint8_t KeyboardReportParser::symKeysUp[12] PROGMEM = {
'_',
'+',
'{',
'}',
'|',
'~',
':',
'"',
'~',
'<',
'>',
'?'};
162 const uint8_t KeyboardReportParser::symKeysLo[12] PROGMEM = {
'-',
'=',
'[',
']',
'\\',
' ',
';',
'\'',
'`',
',',
'.',
'/'};
163 const uint8_t KeyboardReportParser::padKeys[5] PROGMEM = {
'/',
'*',
'-',
'+', 0x13};
166 uint8_t shift = (mod & 0x22);
171 if ((kbdLockingKeys.kbdLeds.bmCapsLock == 0 && shift) ||
172 (kbdLockingKeys.kbdLeds.bmCapsLock == 1 && shift == 0))
173 return (key - 4 +
'A');
177 return (key - 4 +
'a');
186 if(kbdLockingKeys.kbdLeds.bmNumLock == 1)
187 return (key - 0x59 +
'1');
#define UHS_HID_BOOT_KEY_PERIOD
virtual void OnRightButtonDown(MOUSEINFO *mi)
virtual void OnMiddleButtonUp(MOUSEINFO *mi)
#define UHS_HID_BOOT_KEY_ZERO2
#define pgm_read_byte(addr)
#define UHS_HID_BOOT_KEY_ZERO
void Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
virtual void OnLeftButtonUp(MOUSEINFO *mi)
#define UHS_HID_BOOT_KEY_SPACE
virtual void OnMouseMove(MOUSEINFO *mi)
virtual void OnRightButtonUp(MOUSEINFO *mi)
#define VALUE_WITHIN(v, l, h)
virtual void OnMiddleButtonDown(MOUSEINFO *mi)
#define UHS_HID_BOOT_KEY_ENTER
virtual void OnLeftButtonDown(MOUSEINFO *mi)
void Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
uint8_t OemToAscii(uint8_t mod, uint8_t key)