-
Notifications
You must be signed in to change notification settings - Fork 4
/
kb.h
41 lines (34 loc) · 943 Bytes
/
kb.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef DEV_KB_H_
#define DEV_KB_H_
// special keys from get_key()
enum {
BKSP=8,
TAB=9,
ENTER=13,
ESC=27,
CAPSLK=0x80,
NUMLK,
SCRLLK,
DEL, INS,
F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12,
PAD0, PAD1, PAD2, PAD3, PAD4, PAD5, PAD6, PAD7, PAD8, PAD9,
UP, DOWN, LEFT, RIGHT, CENTER, PGUP, PGDN, HOME, END
};
// shift flags from get_key()
#define CTRL_FLAG (1 << 8)
#define ALT_FLAG (1 << 9)
#define SHIFT_FLAG (1 << 10)
#define SHIFT_MASK (CTRL_FLAG | ALT_FLAG | SHIFT_FLAG)
// returns -1 if no key has been pressed
// returns 0 if no 'interesting' key has been pressed (
// otherwise returns key:
// ascii if < 127, mnemonic as above enum
// OR'ed with the pressed shift flags (above)
unsigned int get_key();
// scancodes for shift keys from get_scancode()
#define ALT 0x38
#define CTRL 0x1d
#define LSHIFT 0x2a
#define RSHIFT 0x36
u16 scancode_to_ascii(u8 scancode);
#endif