Rev 4482 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4482 | Rev 4581 | ||
---|---|---|---|
1 | /* |
1 | /* |
2 | * Copyright (c) 2009 Jiri Svoboda |
2 | * Copyright (c) 2009 Jiri Svoboda |
3 | * All rights reserved. |
3 | * All rights reserved. |
4 | * |
4 | * |
5 | * Redistribution and use in source and binary forms, with or without |
5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions |
6 | * modification, are permitted provided that the following conditions |
7 | * are met: |
7 | * are met: |
8 | * |
8 | * |
9 | * - Redistributions of source code must retain the above copyright |
9 | * - Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. |
10 | * notice, this list of conditions and the following disclaimer. |
11 | * - Redistributions in binary form must reproduce the above copyright |
11 | * - Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the |
12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. |
13 | * documentation and/or other materials provided with the distribution. |
14 | * - The name of the author may not be used to endorse or promote products |
14 | * - The name of the author may not be used to endorse or promote products |
15 | * derived from this software without specific prior written permission. |
15 | * derived from this software without specific prior written permission. |
16 | * |
16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
27 | */ |
28 | 28 | ||
29 | /** @addtogroup libc |
29 | /** @addtogroup libc |
30 | * @{ |
30 | * @{ |
31 | */ |
31 | */ |
32 | /** @file |
32 | /** @file |
33 | */ |
33 | */ |
34 | 34 | ||
35 | #ifndef LIBC_IO_KEYCODE_H_ |
35 | #ifndef LIBC_IO_KEYCODE_H_ |
36 | #define LIBC_IO_KEYCODE_H_ |
36 | #define LIBC_IO_KEYCODE_H_ |
37 | 37 | ||
38 | /** Keycode definitions. |
38 | /** Keycode definitions. |
39 | * |
39 | * |
40 | * A keycode identifies a key by its position on the keyboard, rather |
40 | * A keycode identifies a key by its position on the keyboard, rather |
41 | * than by its label. For human readability, key positions are noted |
41 | * than by its label. For human readability, key positions are noted |
42 | * with the key label on a keyboard with US layout. This label has |
42 | * with the key label on a keyboard with US layout. This label has |
43 | * nothing to do with the character, that the key produces |
43 | * nothing to do with the character, that the key produces |
44 | * -- this is determined by the keymap. |
44 | * -- this is determined by the keymap. |
45 | * |
45 | * |
46 | * The keyboard model reflects a standard PC keyboard layout. |
46 | * The keyboard model reflects a standard PC keyboard layout. |
47 | * Non-standard keyboards need to be mapped to this model in some |
47 | * Non-standard keyboards need to be mapped to this model in some |
48 | * logical way. Scancodes are mapped to keycodes with a scanmap. |
48 | * logical way. Scancodes are mapped to keycodes with a scanmap. |
49 | * |
49 | * |
50 | * For easier mapping to the model and to emphasize the nature of keycodes, |
50 | * For easier mapping to the model and to emphasize the nature of keycodes, |
51 | * they really are organized here by position, rather than by label. |
51 | * they really are organized here by position, rather than by label. |
52 | */ |
52 | */ |
53 | enum keycode { |
53 | enum keycode { |
54 | 54 | ||
55 | /* Main block row 1 */ |
55 | /* Main block row 1 */ |
56 | 56 | ||
57 | KC_BACKTICK = 1, |
57 | KC_BACKTICK = 1, |
58 | 58 | ||
59 | KC_1, |
59 | KC_1, |
60 | KC_2, |
60 | KC_2, |
61 | KC_3, |
61 | KC_3, |
62 | KC_4, |
62 | KC_4, |
63 | KC_5, |
63 | KC_5, |
64 | KC_6, |
64 | KC_6, |
65 | KC_7, |
65 | KC_7, |
66 | KC_8, |
66 | KC_8, |
67 | KC_9, |
67 | KC_9, |
68 | KC_0, |
68 | KC_0, |
69 | 69 | ||
70 | KC_MINUS, |
70 | KC_MINUS, |
71 | KC_EQUALS, |
71 | KC_EQUALS, |
72 | KC_BACKSPACE, |
72 | KC_BACKSPACE, |
73 | 73 | ||
74 | /* Main block row 2 */ |
74 | /* Main block row 2 */ |
75 | 75 | ||
76 | KC_TAB, |
76 | KC_TAB, |
77 | 77 | ||
78 | KC_Q, |
78 | KC_Q, |
79 | KC_W, |
79 | KC_W, |
80 | KC_E, |
80 | KC_E, |
81 | KC_R, |
81 | KC_R, |
82 | KC_T, |
82 | KC_T, |
83 | KC_Y, |
83 | KC_Y, |
84 | KC_U, |
84 | KC_U, |
85 | KC_I, |
85 | KC_I, |
86 | KC_O, |
86 | KC_O, |
87 | KC_P, |
87 | KC_P, |
88 | 88 | ||
89 | KC_LBRACKET, |
89 | KC_LBRACKET, |
90 | KC_RBRACKET, |
90 | KC_RBRACKET, |
91 | 91 | ||
92 | /* Main block row 3 */ |
92 | /* Main block row 3 */ |
93 | 93 | ||
94 | KC_CAPS_LOCK, |
94 | KC_CAPS_LOCK, |
95 | 95 | ||
96 | KC_A, |
96 | KC_A, |
97 | KC_S, |
97 | KC_S, |
98 | KC_D, |
98 | KC_D, |
99 | KC_F, |
99 | KC_F, |
100 | KC_G, |
100 | KC_G, |
101 | KC_H, |
101 | KC_H, |
102 | KC_J, |
102 | KC_J, |
103 | KC_K, |
103 | KC_K, |
104 | KC_L, |
104 | KC_L, |
105 | 105 | ||
106 | KC_SEMICOLON, |
106 | KC_SEMICOLON, |
107 | KC_QUOTE, |
107 | KC_QUOTE, |
108 | KC_BACKSLASH, |
108 | KC_BACKSLASH, |
109 | 109 | ||
110 | KC_ENTER, |
110 | KC_ENTER, |
111 | 111 | ||
112 | /* Main block row 4 */ |
112 | /* Main block row 4 */ |
113 | 113 | ||
114 | KC_LSHIFT, |
114 | KC_LSHIFT, |
115 | 115 | ||
116 | KC_Z, |
116 | KC_Z, |
117 | KC_X, |
117 | KC_X, |
118 | KC_C, |
118 | KC_C, |
119 | KC_V, |
119 | KC_V, |
120 | KC_B, |
120 | KC_B, |
121 | KC_N, |
121 | KC_N, |
122 | KC_M, |
122 | KC_M, |
123 | 123 | ||
124 | KC_COMMA, |
124 | KC_COMMA, |
125 | KC_PERIOD, |
125 | KC_PERIOD, |
126 | KC_SLASH, |
126 | KC_SLASH, |
127 | 127 | ||
128 | KC_RSHIFT, |
128 | KC_RSHIFT, |
129 | 129 | ||
130 | /* Main block row 5 */ |
130 | /* Main block row 5 */ |
131 | 131 | ||
132 | KC_LCTRL, |
132 | KC_LCTRL, |
133 | KC_LALT, |
133 | KC_LALT, |
134 | KC_SPACE, |
134 | KC_SPACE, |
135 | KC_RALT, |
135 | KC_RALT, |
136 | KC_RCTRL, |
136 | KC_RCTRL, |
137 | 137 | ||
138 | /* Function keys block */ |
138 | /* Function keys block */ |
139 | 139 | ||
140 | KC_ESCAPE, |
140 | KC_ESCAPE, |
141 | 141 | ||
142 | KC_F1, |
142 | KC_F1, |
143 | KC_F2, |
143 | KC_F2, |
144 | KC_F3, |
144 | KC_F3, |
145 | KC_F4, |
145 | KC_F4, |
146 | KC_F5, |
146 | KC_F5, |
147 | KC_F6, |
147 | KC_F6, |
148 | KC_F7, |
148 | KC_F7, |
149 | KC_F8, |
149 | KC_F8, |
150 | KC_F9, |
150 | KC_F9, |
151 | KC_F10, |
151 | KC_F10, |
152 | KC_F11, |
152 | KC_F11, |
153 | KC_F12, |
153 | KC_F12, |
154 | 154 | ||
155 | KC_PRTSCR, |
155 | KC_PRTSCR, |
156 | KC_SCROLL_LOCK, |
156 | KC_SCROLL_LOCK, |
157 | KC_PAUSE, |
157 | KC_PAUSE, |
158 | 158 | ||
159 | /* Cursor keys block */ |
159 | /* Cursor keys block */ |
160 | 160 | ||
161 | KC_INSERT, |
161 | KC_INSERT, |
162 | KC_HOME, |
162 | KC_HOME, |
163 | KC_PAGE_UP, |
163 | KC_PAGE_UP, |
164 | 164 | ||
165 | KC_DELETE, |
165 | KC_DELETE, |
166 | KC_END, |
166 | KC_END, |
167 | KC_PAGE_DOWN, |
167 | KC_PAGE_DOWN, |
168 | 168 | ||
169 | KC_UP, |
169 | KC_UP, |
170 | KC_LEFT, |
170 | KC_LEFT, |
171 | KC_DOWN, |
171 | KC_DOWN, |
172 | KC_RIGHT, |
172 | KC_RIGHT, |
173 | 173 | ||
174 | /* Numeric block */ |
174 | /* Numeric block */ |
175 | 175 | ||
176 | KC_NUM_LOCK, |
176 | KC_NUM_LOCK, |
177 | KC_NSLASH, |
177 | KC_NSLASH, |
178 | KC_NTIMES, |
178 | KC_NTIMES, |
179 | KC_NMINUS, |
179 | KC_NMINUS, |
180 | 180 | ||
181 | KC_NPLUS, |
181 | KC_NPLUS, |
182 | KC_NENTER, |
182 | KC_NENTER, |
183 | 183 | ||
184 | KC_N7, |
184 | KC_N7, |
185 | KC_N8, |
185 | KC_N8, |
186 | KC_N9, |
186 | KC_N9, |
187 | 187 | ||
188 | KC_N4, |
188 | KC_N4, |
189 | KC_N5, |
189 | KC_N5, |
190 | KC_N6, |
190 | KC_N6, |
191 | 191 | ||
192 | KC_N1, |
192 | KC_N1, |
193 | KC_N2, |
193 | KC_N2, |
194 | KC_N3, |
194 | KC_N3, |
195 | 195 | ||
196 | KC_N0, |
196 | KC_N0, |
197 | KC_NPERIOD |
197 | KC_NPERIOD |
198 | 198 | ||
199 | } keycode_t; |
199 | } keycode_t; |
200 | 200 | ||
201 | enum keymod { |
201 | enum keymod { |
202 | KM_LSHIFT = 0x001, |
202 | KM_LSHIFT = 0x001, |
203 | KM_RSHIFT = 0x002, |
203 | KM_RSHIFT = 0x002, |
204 | KM_LCTRL = 0x004, |
204 | KM_LCTRL = 0x004, |
205 | KM_RCTRL = 0x008, |
205 | KM_RCTRL = 0x008, |
206 | KM_LALT = 0x010, |
206 | KM_LALT = 0x010, |
207 | KM_RALT = 0x020, |
207 | KM_RALT = 0x020, |
208 | KM_CAPS_LOCK = 0x040, |
208 | KM_CAPS_LOCK = 0x040, |
209 | KM_NUM_LOCK = 0x080, |
209 | KM_NUM_LOCK = 0x080, |
210 | KM_SCROLL_LOCK = 0x100, |
210 | KM_SCROLL_LOCK = 0x100, |
211 | 211 | ||
212 | KM_SHIFT = KM_LSHIFT | KM_RSHIFT, |
212 | KM_SHIFT = KM_LSHIFT | KM_RSHIFT, |
213 | KM_CTRL = KM_LCTRL | KM_RCTRL, |
213 | KM_CTRL = KM_LCTRL | KM_RCTRL, |
214 | KM_ALT = KM_LALT | KM_RALT |
214 | KM_ALT = KM_LALT | KM_RALT |
215 | } keymod_t; |
215 | } keymod_t; |
216 | 216 | ||
217 | #endif |
217 | #endif |
218 | 218 | ||
219 | /** @} |
219 | /** @} |
220 | */ |
220 | */ |
221 | 221 |