Rev 3923 | Rev 4344 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3923 | Rev 4343 | ||
---|---|---|---|
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 kbd |
29 | /** @addtogroup kbd |
30 | * @brief US QWERTY leyout. |
30 | * @brief US QWERTY leyout. |
31 | * @{ |
31 | * @{ |
32 | */ |
32 | */ |
33 | 33 | ||
34 | #include <kbd.h> |
34 | #include <kbd.h> |
35 | #include <kbd/kbd.h> |
35 | #include <kbd/kbd.h> |
36 | #include <kbd/keycode.h> |
36 | #include <kbd/keycode.h> |
37 | #include <layout.h> |
37 | #include <layout.h> |
38 | 38 | ||
39 | static int map_normal[] = { |
39 | static int map_normal[] = { |
40 | [KC_BACKTICK] = '`', |
40 | [KC_BACKTICK] = '`', |
41 | 41 | ||
42 | [KC_1] = '1', |
42 | [KC_1] = '1', |
43 | [KC_2] = '2', |
43 | [KC_2] = '2', |
44 | [KC_3] = '3', |
44 | [KC_3] = '3', |
45 | [KC_4] = '4', |
45 | [KC_4] = '4', |
46 | [KC_5] = '5', |
46 | [KC_5] = '5', |
47 | [KC_6] = '6', |
47 | [KC_6] = '6', |
48 | [KC_7] = '7', |
48 | [KC_7] = '7', |
49 | [KC_8] = '8', |
49 | [KC_8] = '8', |
50 | [KC_9] = '9', |
50 | [KC_9] = '9', |
51 | [KC_0] = '0', |
51 | [KC_0] = '0', |
52 | 52 | ||
53 | [KC_MINUS] = '-', |
53 | [KC_MINUS] = '-', |
54 | [KC_EQUALS] = '=', |
54 | [KC_EQUALS] = '=', |
55 | [KC_BACKSPACE] = '\b', |
55 | [KC_BACKSPACE] = '\b', |
56 | 56 | ||
57 | [KC_TAB] = '\t', |
57 | [KC_TAB] = '\t', |
58 | 58 | ||
59 | [KC_Q] = 'q', |
59 | [KC_Q] = 'q', |
60 | [KC_W] = 'w', |
60 | [KC_W] = 'w', |
61 | [KC_E] = 'e', |
61 | [KC_E] = 'e', |
62 | [KC_R] = 'r', |
62 | [KC_R] = 'r', |
63 | [KC_T] = 't', |
63 | [KC_T] = 't', |
64 | [KC_Y] = 'y', |
64 | [KC_Y] = 'y', |
65 | [KC_U] = 'u', |
65 | [KC_U] = 'u', |
66 | [KC_I] = 'i', |
66 | [KC_I] = 'i', |
67 | [KC_O] = 'o', |
67 | [KC_O] = 'o', |
68 | [KC_P] = 'p', |
68 | [KC_P] = 'p', |
69 | 69 | ||
70 | [KC_LBRACKET] = '[', |
70 | [KC_LBRACKET] = '[', |
71 | [KC_RBRACKET] = ']', |
71 | [KC_RBRACKET] = ']', |
72 | 72 | ||
73 | [KC_A] = 'a', |
73 | [KC_A] = 'a', |
74 | [KC_S] = 's', |
74 | [KC_S] = 's', |
75 | [KC_D] = 'd', |
75 | [KC_D] = 'd', |
76 | [KC_F] = 'f', |
76 | [KC_F] = 'f', |
77 | [KC_G] = 'g', |
77 | [KC_G] = 'g', |
78 | [KC_H] = 'h', |
78 | [KC_H] = 'h', |
79 | [KC_J] = 'j', |
79 | [KC_J] = 'j', |
80 | [KC_K] = 'k', |
80 | [KC_K] = 'k', |
81 | [KC_L] = 'l', |
81 | [KC_L] = 'l', |
82 | 82 | ||
83 | [KC_SEMICOLON] = ';', |
83 | [KC_SEMICOLON] = ';', |
84 | [KC_QUOTE] = '\'', |
84 | [KC_QUOTE] = '\'', |
85 | [KC_BACKSLASH] = '\\', |
85 | [KC_BACKSLASH] = '\\', |
86 | [KC_ENTER] = '\n', |
86 | [KC_ENTER] = '\n', |
87 | 87 | ||
88 | [KC_Z] = 'z', |
88 | [KC_Z] = 'z', |
89 | [KC_X] = 'x', |
89 | [KC_X] = 'x', |
90 | [KC_C] = 'c', |
90 | [KC_C] = 'c', |
91 | [KC_V] = 'v', |
91 | [KC_V] = 'v', |
92 | [KC_B] = 'b', |
92 | [KC_B] = 'b', |
93 | [KC_N] = 'n', |
93 | [KC_N] = 'n', |
94 | [KC_M] = 'm', |
94 | [KC_M] = 'm', |
95 | 95 | ||
96 | [KC_COMMA] = ',', |
96 | [KC_COMMA] = ',', |
97 | [KC_PERIOD] = '.', |
97 | [KC_PERIOD] = '.', |
98 | [KC_SLASH] = '/', |
98 | [KC_SLASH] = '/', |
99 | 99 | ||
100 | [KC_SPACE] = ' ' |
100 | [KC_SPACE] = ' ' |
101 | }; |
101 | }; |
102 | 102 | ||
103 | char layout_parse_ev(kbd_event_t *ev) |
103 | char layout_parse_ev(kbd_event_t *ev) |
104 | { |
104 | { |
105 | if (ev->key >= sizeof(map_normal) / sizeof(int)) |
105 | if (ev->key >= sizeof(map_normal) / sizeof(int)) |
106 | return 0; |
106 | return 0; |
107 | 107 | ||
108 | return map_normal[ev->key]; |
108 | return map_normal[ev->key]; |
109 | } |
109 | } |
110 | 110 | ||
111 | /** |
111 | /** |
112 | * @} |
112 | * @} |
113 | */ |
113 | */ |
114 | 114 |