ArduinoLibs
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
USBKeysExtra.h
1 /*
2  * Copyright (C) 2016 Southern Storm Software, Pty Ltd.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20  * DEALINGS IN THE SOFTWARE.
21  */
22 
23 #ifndef USBKEYSEXTRA_h
24 #define USBKEYSEXTRA_h
25 
26 // Extra key codes that are not included in the standard USBAPI.h header.
27 // Reference: http://www.usb.org/developers/hidpage/Hut1_12v2.pdf
28 // Note: USBAPI.h shifts the Hut codes by adding 136 (0x88) so that
29 // they don't intersect with ASCII. We do that here as well so
30 // that these codes can be used with Keyboard.press(). We use #ifndef
31 // here in case the core Arduino libraries add these in the future.
32 
33 #ifndef KEY_PRINT_SCREEN
34 #define KEY_PRINT_SCREEN (0x46 + 0x88)
35 #endif
36 #ifndef KEY_SCROLL_LOCK
37 #define KEY_SCROLL_LOCK (0x47 + 0x88)
38 #endif
39 #ifndef KEY_PAUSE
40 #define KEY_PAUSE (0x48 + 0x88)
41 #endif
42 #ifndef KEY_NUM_LOCK
43 #define KEY_NUM_LOCK (0x53 + 0x88)
44 #endif
45 #ifndef KEY_NUMPAD_5
46 #define KEY_NUMPAD_5 (0x5D + 0x88)
47 #endif
48 #ifndef KEY_F13
49 #define KEY_F13 (0x68 + 0x88)
50 #endif
51 #ifndef KEY_F14
52 #define KEY_F14 (0x69 + 0x88)
53 #endif
54 #ifndef KEY_F15
55 #define KEY_F15 (0x6A + 0x88)
56 #endif
57 #ifndef KEY_F16
58 #define KEY_F16 (0x6B + 0x88)
59 #endif
60 #ifndef KEY_F17
61 #define KEY_F17 (0x6C + 0x88)
62 #endif
63 #ifndef KEY_F18
64 #define KEY_F18 (0x6D + 0x88)
65 #endif
66 #ifndef KEY_F19
67 #define KEY_F19 (0x6E + 0x88)
68 #endif
69 #ifndef KEY_F20
70 #define KEY_F20 (0x6F + 0x88)
71 #endif
72 #ifndef KEY_F21
73 #define KEY_F21 (0x70 + 0x88)
74 #endif
75 #ifndef KEY_F22
76 #define KEY_F22 (0x71 + 0x88)
77 #endif
78 #ifndef KEY_F23
79 #define KEY_F23 (0x72 + 0x88)
80 #endif
81 #ifndef KEY_F24
82 #define KEY_F24 (0x73 + 0x88)
83 #endif
84 
85 // USB does not have a code for "Back Tab" as it is usually Shift-TAB.
86 // For convenience, we map it to the ASCII vertical tab character (0x0B).
87 #define KEY_BACK_TAB 0x0B
88 
89 #ifndef KEY_RETURN
90 
91 // If the Arduino variant does not support USB, then USBAPI.h will not
92 // define the key codes that we need. So we define them here instead.
93 
94 #define KEY_RETURN (0x28 + 0x88)
95 #define KEY_ESC (0x29 + 0x88)
96 #define KEY_BACKSPACE (0x2A + 0x88)
97 #define KEY_TAB (0x2B + 0x88)
98 #define KEY_CAPS_LOCK (0x39 + 0x88)
99 #define KEY_F1 (0x3A + 0x88)
100 #define KEY_F2 (0x3B + 0x88)
101 #define KEY_F3 (0x3C + 0x88)
102 #define KEY_F4 (0x3D + 0x88)
103 #define KEY_F5 (0x3E + 0x88)
104 #define KEY_F6 (0x3F + 0x88)
105 #define KEY_F7 (0x40 + 0x88)
106 #define KEY_F8 (0x41 + 0x88)
107 #define KEY_F9 (0x42 + 0x88)
108 #define KEY_F10 (0x43 + 0x88)
109 #define KEY_F11 (0x44 + 0x88)
110 #define KEY_F12 (0x45 + 0x88)
111 #define KEY_INSERT (0x49 + 0x88)
112 #define KEY_HOME (0x4A + 0x88)
113 #define KEY_PAGE_UP (0x4B + 0x88)
114 #define KEY_DELETE (0x4C + 0x88)
115 #define KEY_END (0x4D + 0x88)
116 #define KEY_PAGE_DOWN (0x4E + 0x88)
117 #define KEY_RIGHT_ARROW (0x4F + 0x88)
118 #define KEY_LEFT_ARROW (0x50 + 0x88)
119 #define KEY_DOWN_ARROW (0x51 + 0x88)
120 #define KEY_UP_ARROW (0x52 + 0x88)
121 
122 #endif
123 
124 #endif