swissChili | 19ef418 | 2021-02-21 17:45:51 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "kint.h" |
| 4 | |
swissChili | e5adca5 | 2021-06-16 21:00:31 -0700 | [diff] [blame] | 5 | /** |
| 6 | * A scan code -> keyboard char mapping |
| 7 | */ |
swissChili | 19ef418 | 2021-02-21 17:45:51 -0800 | [diff] [blame] | 8 | struct kbd_scan_codes |
| 9 | { |
| 10 | bool ascii; |
| 11 | int symbol; |
swissChili | e5adca5 | 2021-06-16 21:00:31 -0700 | [diff] [blame] | 12 | /** |
| 13 | * Uppercase version of symbol |
| 14 | */ |
swissChili | 19ef418 | 2021-02-21 17:45:51 -0800 | [diff] [blame] | 15 | int up_symbol; |
| 16 | uchar prefix; |
| 17 | bool brk; |
| 18 | }; |
| 19 | |
swissChili | e5adca5 | 2021-06-16 21:00:31 -0700 | [diff] [blame] | 20 | /** |
| 21 | * Non-char keyboard keys, assigned values above 7-bit ascii range (>128) |
| 22 | */ |
swissChili | 19ef418 | 2021-02-21 17:45:51 -0800 | [diff] [blame] | 23 | enum kbd_keys |
| 24 | { |
| 25 | FIRST_KBD_KEY = 129, |
| 26 | KBD_BACKSPACE = 129, |
| 27 | KBD_TAB, |
| 28 | KBD_CAPS_LOCK, |
| 29 | KBD_ENTER, |
| 30 | KBD_LEFT_SHIFT, |
| 31 | KBD_RIGHT_SHIFT, |
| 32 | KBD_LEFT_CTRL, |
| 33 | KBD_LEFT_ALT, |
| 34 | KBD_SPACEBAR, |
| 35 | KBD_RIGHT_ALT, |
| 36 | KBD_RIGHT_CTRL, |
| 37 | KBD_INSERT, |
| 38 | KBD_DELETE, |
| 39 | KBD_LEFT_ARROW, |
| 40 | KBD_HOME, |
| 41 | KBD_END, |
| 42 | KBD_UP_ARROW, |
| 43 | KBD_DOWN_ARROW, |
| 44 | KBD_RIGHT_ARROW, |
| 45 | KBD_NUM_LOCK, |
| 46 | KBD_KEYPAD_0, |
| 47 | KBD_KEYPAD_1, |
| 48 | KBD_KEYPAD_2, |
| 49 | KBD_KEYPAD_3, |
| 50 | KBD_KEYPAD_4, |
| 51 | KBD_KEYPAD_5, |
| 52 | KBD_KEYPAD_6, |
| 53 | KBD_KEYPAD_7, |
| 54 | KBD_KEYPAD_8, |
| 55 | KBD_KEYPAD_9, |
| 56 | KBD_KEYPAD_DOT, |
| 57 | KBD_KEYPAD_PLUS, |
| 58 | KBD_KEYPAD_MINUS, |
| 59 | KBD_KEYPAD_TIMES, |
| 60 | KBD_KEYPAD_DIV, |
| 61 | KBD_KEYPAD_ENTER, |
| 62 | KBD_ESC, |
| 63 | KBD_F1, |
| 64 | KBD_F2, |
| 65 | KBD_F3, |
| 66 | KBD_F4, |
| 67 | KBD_F5, |
| 68 | KBD_F6, |
| 69 | KBD_F7, |
| 70 | KBD_F8, |
| 71 | KBD_F9, |
| 72 | KBD_F10, |
| 73 | KBD_F11, |
| 74 | KBD_F12, |
| 75 | KBD_PRINT_SCREEN, |
| 76 | KBD_SCROLL_LOCK, |
| 77 | KBD_PAUSE_BREAK, |
| 78 | KBD_PAGE_UP, |
| 79 | KBD_PAGE_DOWN, |
| 80 | LAST_KBD_KEY, |
| 81 | }; |
| 82 | |
| 83 | extern const struct kbd_scan_codes scan_code_set_3[0xff]; |
| 84 | extern const struct kbd_scan_codes scan_code_set_1[0xff]; |
| 85 | extern bool pressed_keys[LAST_KBD_KEY]; |
| 86 | extern char special_key_mappings[LAST_KBD_KEY - FIRST_KBD_KEY]; |