Browse Source

merged ArdUsbKeyboard; added example

master
Robin Thoni 4 years ago
parent
commit
eb56923667

+ 397
- 0
UsbKeyboard.hxx View File

@@ -0,0 +1,397 @@
1
+//
2
+// Created by robin on 1/8/16.
3
+//
4
+
5
+UsbKeyboardDevice UsbKeyboard = UsbKeyboardDevice("us");
6
+
7
+
8
+/* We use a simplifed keyboard report descriptor which does not support the
9
+ * boot protocol. We don't allow setting status LEDs and but we do allow
10
+ * simultaneous key presses.
11
+ * The report descriptor has been created with usb.org's "HID Descriptor Tool"
12
+ * which can be downloaded from http://www.usb.org/developers/hidpage/.
13
+ * Redundant entries (such as LOGICAL_MINIMUM and USAGE_PAGE) have been omitted
14
+ * for the second INPUT item.
15
+ */
16
+PROGMEM const char usbHidReportDescriptor[35] = { /* USB report descriptor */
17
+        0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)
18
+        0x09, 0x06,                    // USAGE (Keyboard)
19
+        0xa1, 0x01,                    // COLLECTION (Application)
20
+        0x05, 0x07,                    //   USAGE_PAGE (Keyboard)
21
+        0x19, 0xe0,                    //   USAGE_MINIMUM (Keyboard LeftControl)
22
+        0x29, 0xe7,                    //   USAGE_MAXIMUM (Keyboard Right GUI)
23
+        0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
24
+        0x25, 0x01,                    //   LOGICAL_MAXIMUM (1)
25
+        0x75, 0x01,                    //   REPORT_SIZE (1)
26
+        0x95, 0x08,                    //   REPORT_COUNT (8)
27
+        0x81, 0x02,                    //   INPUT (Data,Var,Abs)
28
+        0x95, BUFFER_SIZE-1,           //   REPORT_COUNT (simultaneous keystrokes)
29
+        0x75, 0x08,                    //   REPORT_SIZE (8)
30
+        0x25, 0x65,                    //   LOGICAL_MAXIMUM (101)
31
+        0x19, 0x00,                    //   USAGE_MINIMUM (Reserved (no event indicated))
32
+        0x29, 0x65,                    //   USAGE_MAXIMUM (Keyboard Application)
33
+        0x81, 0x00,                    //   INPUT (Data,Ary,Abs)
34
+        0xc0                           // END_COLLECTION
35
+};
36
+
37
+UsbKeyboardDevice::UsbKeyboardDevice(const char* layout)
38
+    : _layout(0)
39
+{
40
+    PORTD = 0; // TODO: Only for USB pins?
41
+    DDRD |= ~USBMASK;
42
+
43
+    cli();
44
+    usbDeviceDisconnect();
45
+    usbDeviceConnect();
46
+
47
+
48
+    usbInit();
49
+
50
+    sei();
51
+
52
+    // TODO: Remove the next two lines once we fix
53
+    //       missing first keystroke bug properly.
54
+    memset(reportBuffer, 0, sizeof(reportBuffer));
55
+    usbSetInterrupt(reportBuffer, sizeof(reportBuffer));
56
+    setLayout("us");
57
+}
58
+
59
+bool UsbKeyboardDevice::isUsbReady()
60
+{
61
+    UsbKeyboard.update();
62
+    return usbInterruptIsReady();
63
+}
64
+
65
+void UsbKeyboardDevice::setLayout(const char* layout)
66
+{
67
+    delete _layout;
68
+    _layout = new char[strlen(layout)];
69
+    strcpy(_layout, layout);
70
+}
71
+
72
+int UsbKeyboardDevice::charModAltGr(char c, int* modifier)
73
+{
74
+    *modifier = MOD_ALT_RIGHT;
75
+    return c;
76
+}
77
+
78
+int UsbKeyboardDevice::charModShift(char c, int* modifier)
79
+{
80
+    *modifier = MOD_SHIFT_LEFT;
81
+    return c;
82
+}
83
+
84
+#ifdef ARD_USBKBD_AZERTY
85
+int UsbKeyboardDevice::charToKeyAzerty(int c, int* modifier)
86
+{
87
+    *modifier = 0;
88
+
89
+    if (c == '0')
90
+        return charModShift(KEY_0, modifier);
91
+    if (c >= '1' && c <= '9')
92
+        return charModShift(KEY_1 + c - '1', modifier);
93
+
94
+    if (c == '\n')
95
+        return KEY_ENTER;
96
+    if (c == ' ')
97
+        return KEY_SPACE;
98
+
99
+
100
+    if (c >= 'a' && c <= 'z')
101
+    {
102
+        if (c == 'a')
103
+            c = 'q';
104
+        else if (c == 'm')
105
+            return KEY_SEMICOLON;
106
+        else if (c == 'q')
107
+            c = 'a';
108
+        else if (c == 'w')
109
+            c = 'z';
110
+        else if (c == 'z')
111
+            c = 'w';
112
+        return KEY_A + c - 'a';
113
+    }
114
+    if (c >= 'A' && c <= 'Z')
115
+    {
116
+        if (c == 'A')
117
+            c = 'Q';
118
+        else if (c == 'M')
119
+            return charModShift(KEY_SEMICOLON, modifier);
120
+        else if (c == 'Q')
121
+            c = 'A';
122
+        else if (c == 'W')
123
+            c = 'Z';
124
+        else if (c == 'Z')
125
+            c = 'W';
126
+        return charModShift(KEY_A + c - 'A', modifier);
127
+    }
128
+
129
+    if (c == '~')
130
+        return charModAltGr(KEY_2, modifier);
131
+    if (c == '#')
132
+        return charModAltGr(KEY_3, modifier);
133
+    if (c == '{')
134
+        return charModAltGr(KEY_4, modifier);
135
+    if (c == '[')
136
+        return charModAltGr(KEY_5, modifier);
137
+    if (c == '|')
138
+        return charModAltGr(KEY_6, modifier);
139
+    if (c == '`')
140
+        return charModAltGr(KEY_7, modifier);
141
+    if (c == '\\')
142
+        return charModAltGr(KEY_8, modifier);
143
+    if (c == '^')
144
+        return charModAltGr(KEY_9, modifier);
145
+    if (c == '@')
146
+        return charModAltGr(KEY_0, modifier);
147
+    if (c == ']')
148
+        return charModAltGr(KEY_HYPHEN, modifier);
149
+    if (c == '}')
150
+        return charModAltGr(KEY_EQUAL, modifier);
151
+    if (c == -75)//µ
152
+        return charModShift(KEY_BSLASH, modifier);
153
+    if (c == '*')
154
+        return KEY_BSLASH;
155
+
156
+    if (c == '&')
157
+        return KEY_1;
158
+    if (c == -23)//é
159
+        return KEY_2;
160
+    if (c == '\"')
161
+        return KEY_3;
162
+    if (c == '\'')
163
+        return KEY_4;
164
+    if (c == '(')
165
+        return KEY_5;
166
+    if (c == '-')
167
+        return KEY_6;
168
+    if (c == -24)//è
169
+        return KEY_7;
170
+    if (c == '_')
171
+        return KEY_8;
172
+    if (c == -25)//ç
173
+        return KEY_9;
174
+    if (c == -32)//à
175
+        return KEY_0;
176
+    if (c == ')')
177
+        return KEY_HYPHEN;
178
+    if (c == '=')
179
+        return KEY_EQUAL;
180
+    if (c == '+')
181
+        return charModShift(KEY_EQUAL, modifier);
182
+
183
+    if (c == ',')
184
+        return KEY_M;
185
+    if (c == ';')
186
+        return KEY_COMMA;
187
+    if (c == ':')
188
+        return KEY_DOT;
189
+    if (c == '!')
190
+        return KEY_SLASH;
191
+    if (c == -7)//ù
192
+        return KEY_QUOTE;
193
+    if (c == '<')
194
+        return KEYP_NUS_BSLASH;
195
+
196
+    if (c == '?')
197
+        return charModShift(KEY_M, modifier);
198
+    if (c == '.')
199
+        return charModShift(KEY_COMMA, modifier);
200
+    if (c == '/')
201
+        return charModShift(KEY_DOT, modifier);
202
+    if (c == -89)//§
203
+        return charModShift(KEY_SLASH, modifier);
204
+    if (c == '%')
205
+        return charModShift(KEY_QUOTE, modifier);
206
+    if (c == '>')
207
+        return charModShift(KEYP_NUS_BSLASH, modifier);
208
+
209
+    return 0;
210
+}
211
+#endif
212
+
213
+#ifdef ARD_USBKBD_AZERTY
214
+int UsbKeyboardDevice::charToKeyQwerty(int c, int* modifier)
215
+{
216
+    *modifier = 0;
217
+    if (c == '0')
218
+        return KEY_0;
219
+    if (c >= '1' && c <= '9')
220
+        return KEY_1 + c - '1';
221
+    if (c >= 'a' && c <= 'z')
222
+        return KEY_A + c - 'a';
223
+    if (c >= 'A' && c <= 'Z')
224
+        return charModShift(KEY_A + c - 'A', modifier);
225
+
226
+    if (c == '\n')
227
+        return KEY_ENTER;
228
+    if (c == ' ')
229
+        return KEY_SPACE;
230
+
231
+
232
+    if (c == '.')
233
+        return KEY_DOT;
234
+    if (c == ',')
235
+        return KEY_COMMA;
236
+    if (c == '/')
237
+        return KEY_SLASH;
238
+    if (c == ';')
239
+        return KEY_SEMICOLON;
240
+    if (c == '`')
241
+        return KEY_TILDE;
242
+    if (c == '-')
243
+        return KEY_HYPHEN;
244
+    if (c == '=')
245
+        return KEY_EQUAL;
246
+    if (c == '\'')
247
+        return KEY_QUOTE;
248
+    if (c == '~')
249
+        return charModShift(KEY_TILDE, modifier);
250
+    if (c == '<')
251
+        return charModShift(KEY_COMMA, modifier);
252
+    if (c == '>')
253
+        return charModShift(KEY_DOT, modifier);
254
+    if (c == '?')
255
+        return charModShift(KEY_SLASH, modifier);
256
+    if (c == ':')
257
+        return charModShift(KEY_SEMICOLON, modifier);
258
+
259
+    if (c == '!')
260
+        return charModShift(KEY_1, modifier);
261
+    if (c == '@')
262
+        return charModShift(KEY_2, modifier);
263
+    if (c == '#')
264
+        return charModShift(KEY_3, modifier);
265
+    if (c == '$')
266
+        return charModShift(KEY_4, modifier);
267
+    if (c == '%')
268
+        return charModShift(KEY_5, modifier);
269
+    if (c == '^')
270
+        return charModShift(KEY_6, modifier);
271
+    if (c == '&')
272
+        return charModShift(KEY_7, modifier);
273
+    if (c == '*')
274
+        return charModShift(KEY_8, modifier);
275
+    if (c == '(')
276
+        return charModShift(KEY_9, modifier);
277
+    if (c == ')')
278
+        return charModShift(KEY_0, modifier);
279
+    if (c == '_')
280
+        return charModShift(KEY_HYPHEN, modifier);
281
+    if (c == '+')
282
+        return charModShift(KEY_EQUAL, modifier);
283
+    if (c == '"')
284
+        return charModShift(KEY_QUOTE, modifier);
285
+
286
+    if (c == '{')
287
+        return charModShift(KEY_LBRACKET, modifier);
288
+    if (c == '}')
289
+        return charModShift(KEY_RBRACKET, modifier);
290
+    if (c == '|')
291
+        return charModShift(KEY_BSLASH, modifier);
292
+
293
+    if (c == '[')
294
+        return KEY_LBRACKET;
295
+    if (c == ']')
296
+        return KEY_RBRACKET;
297
+    if (c == '\\')
298
+        return KEY_BSLASH;
299
+    return 0;
300
+}
301
+#endif
302
+
303
+void UsbKeyboardDevice::sendKeyStrokes(const char* str)
304
+{
305
+    int (*charToKey)(int,int*) = 0;
306
+#ifdef ARD_USBKBD_AZERTY
307
+    if (!strcmp(_layout, "fr"))
308
+    {
309
+        charToKey = charToKeyAzerty;
310
+    }
311
+#endif
312
+#ifdef ARD_USBKBD_QWERTY
313
+    if (!strcmp(_layout, "us"))
314
+    {
315
+        charToKey = charToKeyQwerty;
316
+    }
317
+#endif
318
+    if (!charToKey)
319
+    {
320
+        return;
321
+    }
322
+
323
+    while (*str)
324
+    {
325
+        int modifier = 0;
326
+        int k = charToKey(*str, &modifier);
327
+        /*if (!k)
328
+        {
329
+          k = KEY_SPACE;
330
+          char buf[12];
331
+          itoa((unsigned)*str, buf, 10);
332
+          sendKeyStrokes(buf);
333
+        }*/
334
+        if (k)
335
+        {
336
+            UsbKeyboard.sendKeyStroke(k, modifier);
337
+        }
338
+        ++str;
339
+    }
340
+}
341
+
342
+void UsbKeyboardDevice::sendKeyStroke(byte keyStroke, byte modifiers)
343
+{
344
+
345
+    while (!usbInterruptIsReady()) {
346
+        // Note: We wait until we can send keystroke
347
+        //       so we know the previous keystroke was
348
+        //       sent.
349
+    }
350
+
351
+    memset(reportBuffer, 0, sizeof(reportBuffer));
352
+
353
+    reportBuffer[0] = modifiers;
354
+    reportBuffer[1] = keyStroke;
355
+
356
+    usbSetInterrupt(reportBuffer, sizeof(reportBuffer));
357
+
358
+    while (!usbInterruptIsReady()) {
359
+        // Note: We wait until we can send keystroke
360
+        //       so we know the previous keystroke was
361
+        //       sent.
362
+    }
363
+
364
+    // This stops endlessly repeating keystrokes:
365
+    memset(reportBuffer, 0, sizeof(reportBuffer));
366
+    usbSetInterrupt(reportBuffer, sizeof(reportBuffer));
367
+
368
+}
369
+
370
+
371
+uchar usbFunctionSetup(uchar data[8])
372
+{
373
+    usbRequest_t    *rq = (usbRequest_t *)((void *)data);
374
+
375
+    usbMsgPtr = UsbKeyboard.reportBuffer; //
376
+    if((rq->bmRequestType & USBRQ_TYPE_MASK) == USBRQ_TYPE_CLASS){
377
+        /* class request type */
378
+
379
+        if(rq->bRequest == USBRQ_HID_GET_REPORT){
380
+            /* wValue: ReportType (highbyte), ReportID (lowbyte) */
381
+
382
+            /* we only have one report type, so don't look at wValue */
383
+            // TODO: Ensure it's okay not to return anything here?
384
+            return 0;
385
+
386
+        }else if(rq->bRequest == USBRQ_HID_GET_IDLE){
387
+            //            usbMsgPtr = &idleRate;
388
+            //            return 1;
389
+            return 0;
390
+        }else if(rq->bRequest == USBRQ_HID_SET_IDLE){
391
+            idleRate = rq->wValue.bytes[1];
392
+        }
393
+    }else{
394
+        /* no vendor specific requests implemented */
395
+    }
396
+    return 0;
397
+}

+ 1
- 0
examples/UsbKeyboardDemo2/.gitignore View File

@@ -0,0 +1 @@
1
+/.idea

+ 12
- 0
examples/UsbKeyboardDemo2/CMakeLists.txt View File

@@ -0,0 +1,12 @@
1
+cmake_minimum_required(VERSION 2.8.4)
2
+set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/ArduinoToolchain.cmake)
3
+set(PROJECT_NAME keyboard)
4
+project(${PROJECT_NAME})
5
+
6
+set(${CMAKE_PROJECT_NAME}_BOARD nano328)
7
+set(${CMAKE_PROJECT_NAME}_PORT /dev/ttyUSB0)
8
+
9
+enable_language(ASM)
10
+
11
+set(${CMAKE_PROJECT_NAME}_SKETCH main.ino)
12
+generate_arduino_firmware(${CMAKE_PROJECT_NAME})

+ 89
- 0
examples/UsbKeyboardDemo2/cmake/ArduinoToolchain.cmake View File

@@ -0,0 +1,89 @@
1
+#=============================================================================#
2
+# Author: Tomasz Bogdal (QueezyTheGreat)
3
+# Home:   https://github.com/queezythegreat/arduino-cmake
4
+#
5
+# This Source Code Form is subject to the terms of the Mozilla Public
6
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
7
+# You can obtain one at http://mozilla.org/MPL/2.0/.
8
+#=============================================================================#
9
+set(CMAKE_SYSTEM_NAME Arduino)
10
+
11
+set(CMAKE_C_COMPILER   avr-gcc)
12
+set(CMAKE_CXX_COMPILER avr-g++)
13
+
14
+# Add current directory to CMake Module path automatically
15
+if(EXISTS  ${CMAKE_CURRENT_LIST_DIR}/Platform/Arduino.cmake)
16
+    set(CMAKE_MODULE_PATH  ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR})
17
+endif()
18
+
19
+#=============================================================================#
20
+#                         System Paths                                        #
21
+#=============================================================================#
22
+if(UNIX)
23
+    include(Platform/UnixPaths)
24
+    if(APPLE)
25
+        list(APPEND CMAKE_SYSTEM_PREFIX_PATH ~/Applications
26
+                                             /Applications
27
+                                             /Developer/Applications
28
+                                             /sw        # Fink
29
+                                             /opt/local) # MacPorts
30
+    endif()
31
+elseif(WIN32)
32
+    include(Platform/WindowsPaths)
33
+endif()
34
+
35
+
36
+#=============================================================================#
37
+#                         Detect Arduino SDK                                  #
38
+#=============================================================================#
39
+if(NOT ARDUINO_SDK_PATH)
40
+    set(ARDUINO_PATHS)
41
+
42
+    foreach(DETECT_VERSION_MAJOR 1)
43
+        foreach(DETECT_VERSION_MINOR RANGE 5 0)
44
+            list(APPEND ARDUINO_PATHS arduino-${DETECT_VERSION_MAJOR}.${DETECT_VERSION_MINOR})
45
+            foreach(DETECT_VERSION_PATCH  RANGE 3 0)
46
+                list(APPEND ARDUINO_PATHS arduino-${DETECT_VERSION_MAJOR}.${DETECT_VERSION_MINOR}.${DETECT_VERSION_PATCH})
47
+            endforeach()
48
+        endforeach()
49
+    endforeach()
50
+
51
+    foreach(VERSION RANGE 23 19)
52
+        list(APPEND ARDUINO_PATHS arduino-00${VERSION})
53
+    endforeach()
54
+
55
+    if(UNIX)
56
+        file(GLOB SDK_PATH_HINTS /usr/share/arduino*
57
+            /opt/local/arduino*
58
+            /opt/arduino*
59
+            /usr/local/share/arduino*)
60
+    elseif(WIN32)
61
+        set(SDK_PATH_HINTS "C:\\Program Files\\Arduino"
62
+            "C:\\Program Files (x86)\\Arduino"
63
+            )
64
+    endif()
65
+    list(SORT SDK_PATH_HINTS)
66
+    list(REVERSE SDK_PATH_HINTS)
67
+endif()
68
+
69
+find_path(ARDUINO_SDK_PATH
70
+          NAMES lib/version.txt
71
+          PATH_SUFFIXES share/arduino
72
+                        Arduino.app/Contents/Java/
73
+                        Arduino.app/Contents/Resources/Java/
74
+                        ${ARDUINO_PATHS}
75
+          HINTS ${SDK_PATH_HINTS}
76
+          DOC "Arduino SDK path.")
77
+
78
+if(ARDUINO_SDK_PATH)
79
+    list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${ARDUINO_SDK_PATH}/hardware/tools/avr)
80
+    list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${ARDUINO_SDK_PATH}/hardware/tools/avr/utils)
81
+else()
82
+    message(FATAL_ERROR "Could not find Arduino SDK (set ARDUINO_SDK_PATH)!")
83
+endif()
84
+
85
+set(ARDUINO_CPUMENU)
86
+if(ARDUINO_CPU)
87
+    set(ARDUINO_CPUMENU ".menu.cpu.${ARDUINO_CPU}")
88
+endif(ARDUINO_CPU)
89
+

+ 2304
- 0
examples/UsbKeyboardDemo2/cmake/Platform/Arduino.cmake
File diff suppressed because it is too large
View File


+ 36
- 0
examples/UsbKeyboardDemo2/main.ino View File

@@ -0,0 +1,36 @@
1
+#define ARD_UTILS_DELAYMS
2
+#define ARD_UTILS_UTF8
3
+#include "ArdUtils/ArdUtils.h"
4
+
5
+#define ARD_USBKBD_AZERTY
6
+#define ARD_USBKBD_QWERTY
7
+#include "UsbKeyboard.h"
8
+
9
+#define ledPin 13
10
+
11
+void setup()
12
+{
13
+    pinMode (ledPin, OUTPUT);
14
+    digitalWrite (ledPin, HIGH);
15
+}
16
+
17
+void loop()
18
+{
19
+    WAIT_USB;
20
+    ArdUtils::delayMs(42);
21
+
22
+    char* str = "abcdefghijklmnopqrstuvwxyz\nABCDEFGHIJKLMNOPQRSTUVWXYZ\n0123456789\n&\"\'(-_)=\n~#{[|`\\^@]}\n,;:!$\n?.<>/\n+-*/%\nµù§\néèçà\n";
23
+
24
+    ArdUtils::utf8ToAscii(str);
25
+
26
+    UsbKeyboard.setLayout("fr");
27
+    UsbKeyboard.sendKeyStrokes(str);
28
+
29
+    ArdUtils::delayMs(4000);
30
+
31
+    UsbKeyboard.setLayout("us");
32
+    UsbKeyboard.sendKeyStrokes(str);
33
+
34
+
35
+    digitalWrite(ledPin, !digitalRead(ledPin));
36
+}

+ 118
- 0
keycodes.h View File

@@ -0,0 +1,118 @@
1
+//
2
+// Created by robin on 1/9/16.
3
+//
4
+
5
+#ifndef USBKEYBOARD_KEYCODES_H
6
+#define USBKEYBOARD_KEYCODES_H
7
+
8
+
9
+/* Keyboard usage values, see usb.org's HID-usage-tables document, chapter
10
+ * 10 Keyboard/Keypad Page for more codes.
11
+ */
12
+#define MOD_CONTROL_LEFT    (1<<0)
13
+#define MOD_SHIFT_LEFT      (1<<1)
14
+#define MOD_ALT_LEFT        (1<<2)
15
+#define MOD_GUI_LEFT        (1<<3)
16
+#define MOD_CONTROL_RIGHT   (1<<4)
17
+#define MOD_SHIFT_RIGHT     (1<<5)
18
+#define MOD_ALT_RIGHT       (1<<6)
19
+#define MOD_GUI_RIGHT       (1<<7)
20
+
21
+#define KEY_A       4
22
+#define KEY_B       5
23
+#define KEY_C       6
24
+#define KEY_D       7
25
+#define KEY_E       8
26
+#define KEY_F       9
27
+#define KEY_G       10
28
+#define KEY_H       11
29
+#define KEY_I       12
30
+#define KEY_J       13
31
+#define KEY_K       14
32
+#define KEY_L       15
33
+#define KEY_M       16
34
+#define KEY_N       17
35
+#define KEY_O       18
36
+#define KEY_P       19
37
+#define KEY_Q       20
38
+#define KEY_R       21
39
+#define KEY_S       22
40
+#define KEY_T       23
41
+#define KEY_U       24
42
+#define KEY_V       25
43
+#define KEY_W       26
44
+#define KEY_X       27
45
+#define KEY_Y       28
46
+#define KEY_Z       29
47
+#define KEY_1       30
48
+#define KEY_2       31
49
+#define KEY_3       32
50
+#define KEY_4       33
51
+#define KEY_5       34
52
+#define KEY_6       35
53
+#define KEY_7       36
54
+#define KEY_8       37
55
+#define KEY_9       38
56
+#define KEY_0       39
57
+
58
+#define KEY_ENTER   40
59
+#define KEY_ESCAPE  41
60
+#define KEY_BSPACE  42
61
+#define KEY_TAB     43
62
+#define KEY_SPACE   44
63
+
64
+
65
+#define KEY_HYPHEN    45
66
+#define KEY_EQUAL     46
67
+#define KEY_LBRACKET  47
68
+#define KEY_RBRACKET  48
69
+#define KEY_BSLASH    49
70
+#define KEY_HASHTAG   50
71
+#define KEY_SEMICOLON 51
72
+#define KEY_QUOTE    52
73
+#define KEY_TILDE     53
74
+#define KEY_COMMA     54
75
+#define KEY_DOT       55
76
+#define KEY_SLASH     56
77
+#define KEY_CAPSLOCK  57
78
+
79
+#define KEY_F1      58
80
+#define KEY_F2      59
81
+#define KEY_F3      60
82
+#define KEY_F4      61
83
+#define KEY_F5      62
84
+#define KEY_F6      63
85
+#define KEY_F7      64
86
+#define KEY_F8      65
87
+#define KEY_F9      66
88
+#define KEY_F10     67
89
+#define KEY_F11     68
90
+#define KEY_F12     69
91
+
92
+#define KEY_PRINTSCREEN 70
93
+#define KEY_SCROLLLOCK  71
94
+#define KEY_PAUSE       72
95
+#define KEY_INSERT      73
96
+#define KEY_HOME        74
97
+#define KEY_PAGEUP      75
98
+#define KEY_DELETE      76
99
+#define KEY_END         77
100
+#define KEY_PAGEDOWN    78
101
+
102
+#define KEY_ARROW_RIGHT 79
103
+#define KEY_ARROW_LEFT  80
104
+#define KEY_ARROW_DOWN  81
105
+#define KEY_ARROW_UP    82
106
+
107
+
108
+#define KEY_NUMLOCK     83
109
+#define KEYP_SLASH      84
110
+#define KEYP_STAR       85
111
+#define KEYP_MINUS      86
112
+#define KEYP_PLUS       87
113
+#define KEYP_ENTER      88
114
+
115
+
116
+#define KEYP_NUS_BSLASH 100
117
+
118
+#endif //USBKEYBOARD_KEYCODES_H

Loading…
Cancel
Save