Added standard keyboard HID report scancode defines (thanks to László Monda).
This commit is contained in:
parent
2d49c09b38
commit
b8dfa976ce
12 changed files with 337 additions and 79 deletions
|
@ -152,14 +152,23 @@ int main(void)
|
|||
char PressedKey = 0;
|
||||
|
||||
/* Convert scan-code to printable character if alphanumeric */
|
||||
if ((KeyCode >= 0x04) && (KeyCode <= 0x1D))
|
||||
PressedKey = (KeyCode - 0x04) + 'A';
|
||||
else if ((KeyCode >= 0x1E) && (KeyCode <= 0x27))
|
||||
PressedKey = (KeyCode - 0x1E) + '0';
|
||||
else if (KeyCode == 0x2C)
|
||||
PressedKey = ' ';
|
||||
else if (KeyCode == 0x28)
|
||||
PressedKey = '\n';
|
||||
if ((KeyCode >= HID_KEYBOARD_SC_A) && (KeyCode <= HID_KEYBOARD_SC_Z))
|
||||
{
|
||||
PressedKey = (KeyCode - HID_KEYBOARD_SC_A) + 'A';
|
||||
}
|
||||
else if ((KeyCode >= HID_KEYBOARD_SC_1_AND_EXCLAMATION) &
|
||||
(KeyCode <= HID_KEYBOARD_SC_0_AND_CLOSING_PARENTHESIS))
|
||||
{
|
||||
PressedKey = (KeyCode - HID_KEYBOARD_SC_1_AND_EXCLAMATION) + '0';
|
||||
}
|
||||
else if (KeyCode == HID_KEYBOARD_SC_SPACE)
|
||||
{
|
||||
PressedKey = ' ';
|
||||
}
|
||||
else if (KeyCode == HID_KEYBOARD_SC_ENTER)
|
||||
{
|
||||
PressedKey = '\n';
|
||||
}
|
||||
|
||||
/* Print the pressed key character out through the serial port if valid */
|
||||
if (PressedKey)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue