22#ifndef __DC_MAPLE_KEYBOARD_H
23#define __DC_MAPLE_KEYBOARD_H
44#define KBD_MOD_LCTRL (1<<0)
45#define KBD_MOD_LSHIFT (1<<1)
46#define KBD_MOD_LALT (1<<2)
47#define KBD_MOD_S1 (1<<3)
48#define KBD_MOD_RCTRL (1<<4)
49#define KBD_MOD_RSHIFT (1<<5)
50#define KBD_MOD_RALT (1<<6)
51#define KBD_MOD_S2 (1<<7)
63#define KBD_LED_NUMLOCK (1<<0)
64#define KBD_LED_CAPSLOCK (1<<1)
65#define KBD_LED_SCRLOCK (1<<2)
79#define KBD_KEY_NONE 0x00
80#define KBD_KEY_ERROR 0x01
81#define KBD_KEY_ERR2 0x02
82#define KBD_KEY_ERR3 0x03
100#define KBD_KEY_R 0x15
101#define KBD_KEY_S 0x16
102#define KBD_KEY_T 0x17
103#define KBD_KEY_U 0x18
104#define KBD_KEY_V 0x19
105#define KBD_KEY_W 0x1a
106#define KBD_KEY_X 0x1b
107#define KBD_KEY_Y 0x1c
108#define KBD_KEY_Z 0x1d
109#define KBD_KEY_1 0x1e
110#define KBD_KEY_2 0x1f
111#define KBD_KEY_3 0x20
112#define KBD_KEY_4 0x21
113#define KBD_KEY_5 0x22
114#define KBD_KEY_6 0x23
115#define KBD_KEY_7 0x24
116#define KBD_KEY_8 0x25
117#define KBD_KEY_9 0x26
118#define KBD_KEY_0 0x27
119#define KBD_KEY_ENTER 0x28
120#define KBD_KEY_ESCAPE 0x29
121#define KBD_KEY_BACKSPACE 0x2a
122#define KBD_KEY_TAB 0x2b
123#define KBD_KEY_SPACE 0x2c
124#define KBD_KEY_MINUS 0x2d
125#define KBD_KEY_PLUS 0x2e
126#define KBD_KEY_LBRACKET 0x2f
127#define KBD_KEY_RBRACKET 0x30
128#define KBD_KEY_BACKSLASH 0x31
129#define KBD_KEY_SEMICOLON 0x33
130#define KBD_KEY_QUOTE 0x34
131#define KBD_KEY_TILDE 0x35
132#define KBD_KEY_COMMA 0x36
133#define KBD_KEY_PERIOD 0x37
134#define KBD_KEY_SLASH 0x38
135#define KBD_KEY_CAPSLOCK 0x39
136#define KBD_KEY_F1 0x3a
137#define KBD_KEY_F2 0x3b
138#define KBD_KEY_F3 0x3c
139#define KBD_KEY_F4 0x3d
140#define KBD_KEY_F5 0x3e
141#define KBD_KEY_F6 0x3f
142#define KBD_KEY_F7 0x40
143#define KBD_KEY_F8 0x41
144#define KBD_KEY_F9 0x42
145#define KBD_KEY_F10 0x43
146#define KBD_KEY_F11 0x44
147#define KBD_KEY_F12 0x45
148#define KBD_KEY_PRINT 0x46
149#define KBD_KEY_SCRLOCK 0x47
150#define KBD_KEY_PAUSE 0x48
151#define KBD_KEY_INSERT 0x49
152#define KBD_KEY_HOME 0x4a
153#define KBD_KEY_PGUP 0x4b
154#define KBD_KEY_DEL 0x4c
155#define KBD_KEY_END 0x4d
156#define KBD_KEY_PGDOWN 0x4e
157#define KBD_KEY_RIGHT 0x4f
158#define KBD_KEY_LEFT 0x50
159#define KBD_KEY_DOWN 0x51
160#define KBD_KEY_UP 0x52
161#define KBD_KEY_PAD_NUMLOCK 0x53
162#define KBD_KEY_PAD_DIVIDE 0x54
163#define KBD_KEY_PAD_MULTIPLY 0x55
164#define KBD_KEY_PAD_MINUS 0x56
165#define KBD_KEY_PAD_PLUS 0x57
166#define KBD_KEY_PAD_ENTER 0x58
167#define KBD_KEY_PAD_1 0x59
168#define KBD_KEY_PAD_2 0x5a
169#define KBD_KEY_PAD_3 0x5b
170#define KBD_KEY_PAD_4 0x5c
171#define KBD_KEY_PAD_5 0x5d
172#define KBD_KEY_PAD_6 0x5e
173#define KBD_KEY_PAD_7 0x5f
174#define KBD_KEY_PAD_8 0x60
175#define KBD_KEY_PAD_9 0x61
176#define KBD_KEY_PAD_0 0x62
177#define KBD_KEY_PAD_PERIOD 0x63
178#define KBD_KEY_S3 0x65
189#define KBD_REGION_JP 1
190#define KBD_REGION_US 2
191#define KBD_REGION_UK 3
192#define KBD_REGION_DE 4
193#define KBD_REGION_FR 5
194#define KBD_REGION_IT 6
195#define KBD_REGION_ES 7
210#define KEY_STATE_NONE 0
211#define KEY_STATE_WAS_PRESSED 1
212#define KEY_STATE_PRESSED 2
219#define MAX_PRESSED_KEYS 6
225#define MAX_KBD_KEYS 256
236#define KBD_QUEUE_SIZE 16
247typedef struct kbd_keymap {
274typedef struct kbd_state {
380void kbd_shutdown(
void);
int kbd_get_key(void)
Pop a key off the global keyboard queue.
#define MAX_PRESSED_KEYS
Maximum number of keys the DC can read simultaneously.
Definition keyboard.h:219
void kbd_set_queue(int active)
Activate or deactivate global key queueing.
#define MAX_KBD_KEYS
Maximum number of keys a DC keyboard can have.
Definition keyboard.h:225
int kbd_queue_pop(maple_device_t *dev, int xlat)
Pop a key off a specific keyboard's queue.
#define KBD_QUEUE_SIZE
Size of a keyboard queue.
Definition keyboard.h:236
unsigned long long uint64
64-bit unsigned integer
Definition types.h:32
unsigned long uint32
32-bit unsigned integer
Definition types.h:33
unsigned char uint8
8-bit unsigned integer
Definition types.h:35
Maple Bus driver interface.
Keyboard raw condition structure.
Definition keyboard.h:260
uint8 modifiers
Bitmask of set modifiers.
Definition keyboard.h:261
uint8 leds
Bitmask of set LEDs.
Definition keyboard.h:262
Keyboard keymap.
Definition keyboard.h:247
Keyboard status structure.
Definition keyboard.h:274
uint8 kbd_repeat_key
Key that is repeating.
Definition keyboard.h:302
volatile int queue_len
Current length of queue.
Definition keyboard.h:300
int queue_tail
Key queue tail.
Definition keyboard.h:298
int shift_keys
Modifier key status.
Definition keyboard.h:289
kbd_cond_t cond
The latest raw condition of the keyboard.
Definition keyboard.h:276
uint64 kbd_repeat_timer
Time that the next repeat will trigger.
Definition keyboard.h:303
int queue_head
Key queue head.
Definition keyboard.h:299
int region
Keyboard type/region.
Definition keyboard.h:292
One maple device.
Definition maple.h:270