diff options
Diffstat (limited to 'TERES-HID')
-rw-r--r-- | TERES-HID/KeyboardMouse.c | 60 |
1 files changed, 10 insertions, 50 deletions
diff --git a/TERES-HID/KeyboardMouse.c b/TERES-HID/KeyboardMouse.c index 4c3fdec..aec2e21 100644 --- a/TERES-HID/KeyboardMouse.c +++ b/TERES-HID/KeyboardMouse.c @@ -463,11 +463,7 @@ CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t * TouchPadLocked = !TouchPadLocked; while ((PIND & (1 << 7)) == 0); } - if (keynow != 0) { - KeyboardReport->KeyCode[keyc] = keynow; - if (keyc < 5) - keyc++; - } + add_key(KeyboardReport,keynow); } x++; // 4 // Delay_MS(5); @@ -475,99 +471,63 @@ CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t * // tp_guarder(); keynow = keys[colmn * 14 + x + fn]; KeyboardReport->Modifier |= keym[colmn * 14 + x]; - if (keynow != 0) { - KeyboardReport->KeyCode[keyc] = keynow; - if (keyc < 5) - keyc++; - } + add_key(KeyboardReport,keynow); } x++; // 5 if ((PINF & (1 << 1)) == 0) { // tp_guarder(); keynow = keys[colmn * 14 + x + fn]; KeyboardReport->Modifier |= keym[colmn * 14 + x]; - if (keynow != 0) { - KeyboardReport->KeyCode[keyc] = keynow; - if (keyc < 5) - keyc++; - } + add_key(KeyboardReport,keynow); } x++; // 6 if ((PINF & (1 << 6)) == 0) { // tp_guarder(); keynow = keys[colmn * 14 + x + fn]; KeyboardReport->Modifier |= keym[colmn * 14 + x]; - if (keynow != 0) { - KeyboardReport->KeyCode[keyc] = keynow; - if (keyc < 5) - keyc++; - } + add_key(KeyboardReport,keynow); } x++; // 7 if ((PINE & (1 << 6)) == 0) { // tp_guarder(); keynow = keys[colmn * 14 + x + fn]; KeyboardReport->Modifier |= keym[colmn * 14 + x]; - if (keynow != 0) { - KeyboardReport->KeyCode[keyc] = keynow; - if (keyc < 5) - keyc++; - } + add_key(KeyboardReport,keynow); } x++; // 8 if ((PINF & (1 << 4)) == 0) { // tp_guarder(); keynow = keys[colmn * 14 + x + fn]; KeyboardReport->Modifier |= keym[colmn * 14 + x]; - if (keynow != 0) { - KeyboardReport->KeyCode[keyc] = keynow; - if (keyc < 5) - keyc++; - } + add_key(KeyboardReport,keynow); } x++; // 9 if ((PIND & (1 << 5)) == 0) { // tp_guarder(); keynow = keys[colmn * 14 + x + fn]; KeyboardReport->Modifier |= keym[colmn * 14 + x]; - if (keynow != 0) { - KeyboardReport->KeyCode[keyc] = keynow; - if (keyc < 5) - keyc++; - } + add_key(KeyboardReport,keynow); } x++; // 10 if ((PINF & (1 << 5)) == 0) { // tp_guarder(); keynow = keys[colmn * 14 + x + fn]; KeyboardReport->Modifier |= keym[colmn * 14 + x]; - if (keynow != 0) { - KeyboardReport->KeyCode[keyc] = keynow; - if (keyc < 5) - keyc++; - } + add_key(KeyboardReport,keynow); } x++; // 11 if ((PINF & (1 << 7)) == 0) { // tp_guarder(); keynow = keys[colmn * 14 + x + fn]; KeyboardReport->Modifier |= keym[colmn * 14 + x]; - if (keynow != 0) { - KeyboardReport->KeyCode[keyc] = keynow; - if (keyc < 5) - keyc++; - } + add_key(KeyboardReport,keynow); } x++; // 12 if ((PINE & (1 << 2)) == 0) { // tp_guarder(); keynow = keys[colmn * 14 + x + fn]; KeyboardReport->Modifier |= keym[colmn * 14 + x]; - if (keynow != 0) { - KeyboardReport->KeyCode[keyc] = keynow; - if (keyc < 5) - keyc++; - } + add_key(KeyboardReport,keynow); } DDRD = 0; PORTD = 0xfc; |