Skip to content

Commit a993f1e

Browse files
authored
Merge pull request #25 from Neotron-Compute/use-pc-keyboard
Use pc keyboard
2 parents 78a389b + d66dd95 commit a993f1e

File tree

2 files changed

+2
-248
lines changed

2 files changed

+2
-248
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ readme = "README.md"
1313

1414
[dependencies]
1515
chrono = { version = "0.4", default-features=false }
16+
pc-keyboard = "0.7"

src/hid.rs

Lines changed: 1 addition & 248 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
// Imports
2525
// ============================================================================
2626

27-
// None
27+
pub use pc_keyboard::KeyCode;
2828

2929
// ============================================================================
3030
// Constants
@@ -50,253 +50,6 @@ pub enum HidEvent {
5050
MouseInput(MouseData),
5151
}
5252

53-
/// Represents a single key on a standard keyboard.
54-
///
55-
/// These keys are labelled according to their function on a standard United
56-
/// States layout 104-key keyboard. If you have a different layout keyboard,
57-
/// the symbol printed in the key you pressed may not match the `KeyCode`
58-
/// value it generates. For example, if you press the `Z` key on a German
59-
/// keyboard, you will get `KeyCode::Y` because that same key is the `Y` key
60-
/// on a US keyboard.
61-
#[repr(u8)]
62-
#[derive(Copy, Clone, PartialEq, Eq, Debug, PartialOrd, Ord)]
63-
pub enum KeyCode {
64-
/// The left-hand `Alt` key
65-
AltLeft,
66-
/// The right-hand `Alt` (or `AltGr`) key
67-
AltRight,
68-
/// The Down cursor key
69-
ArrowDown,
70-
/// The Left cursor key
71-
ArrowLeft,
72-
/// The Right cursor key
73-
ArrowRight,
74-
/// The Up cursor key
75-
ArrowUp,
76-
/// The `\\|` key
77-
BackSlash,
78-
/// The `Backspace` (`Bksp` or `<--`) key
79-
Backspace,
80-
/// The `\`~` key.
81-
///
82-
/// Left of the `1` key. On a UK keyboard this is `\`¬|`.
83-
BackTick,
84-
/// The `[{` key
85-
BracketSquareLeft,
86-
/// The `]}` key
87-
BracketSquareRight,
88-
/// The `Caps Lock` key
89-
CapsLock,
90-
/// The `,<` key
91-
Comma,
92-
/// The left-most `Control` (`Ctrl`) key
93-
ControlLeft,
94-
/// The right-most `Control` (`Ctrl`) key
95-
ControlRight,
96-
/// The `Delete` (`Del`) key
97-
Delete,
98-
/// The `End` key
99-
End,
100-
/// The `Enter` (`Return`) key, on the right-hand side of the letters.
101-
Enter,
102-
/// The `Escape` (`Esc`) key
103-
Escape,
104-
/// The `=+` key
105-
Equals,
106-
/// The `F1` key
107-
F1,
108-
/// The `F2` key
109-
F2,
110-
/// The `F3` key
111-
F3,
112-
/// The `F4` key
113-
F4,
114-
/// The `F5` key
115-
F5,
116-
/// The `F6` key
117-
F6,
118-
/// The `F7` key
119-
F7,
120-
/// The `F8` key
121-
F8,
122-
/// The `F9` key
123-
F9,
124-
/// The `F10` key
125-
F10,
126-
/// The `F11` key
127-
F11,
128-
/// The `F12` key
129-
F12,
130-
/// The `.>` key
131-
Fullstop,
132-
/// The `Home` key
133-
Home,
134-
/// The `Insert` key
135-
Insert,
136-
/// The `1!` key
137-
Key1,
138-
/// The `2@` key
139-
Key2,
140-
/// The `3#` key
141-
Key3,
142-
/// The `4$` key
143-
Key4,
144-
/// The `5%` key
145-
Key5,
146-
/// The `6^` key
147-
Key6,
148-
/// The `7&` key
149-
Key7,
150-
/// The `8*` key
151-
Key8,
152-
/// The `9(` key
153-
Key9,
154-
/// The `0)` key
155-
Key0,
156-
/// The `Right-click Menu` key
157-
Menus,
158-
/// The `-_` key
159-
Minus,
160-
/// The `0` key on the Numeric Keypad
161-
Numpad0,
162-
/// The `1` key on the Numeric Keypad
163-
Numpad1,
164-
/// The `2` key on the Numeric Keypad
165-
Numpad2,
166-
/// The `3` key on the Numeric Keypad
167-
Numpad3,
168-
/// The `4` key on the Numeric Keypad
169-
Numpad4,
170-
/// The `5` key on the Numeric Keypad
171-
Numpad5,
172-
/// The `6` key on the Numeric Keypad
173-
Numpad6,
174-
/// The `7` key on the Numeric Keypad
175-
Numpad7,
176-
/// The `8` key on the Numeric Keypad
177-
Numpad8,
178-
/// The `9` key on the Numeric Keypad
179-
Numpad9,
180-
/// The `Enter` key on the Numeric Keypad
181-
NumpadEnter,
182-
/// The `Num Lock` key on the Numeric Keypad
183-
NumpadLock,
184-
/// The `/` key on the Numeric Keypad
185-
NumpadSlash,
186-
/// The `*` key on the Numeric Keypad
187-
NumpadStar,
188-
/// The `-` key on the Numeric Keypad
189-
NumpadMinus,
190-
/// The `.` key on the Numeric Keypad
191-
NumpadPeriod,
192-
/// The `+` key on the Numeric Keypad
193-
NumpadPlus,
194-
/// The `Page Down` key
195-
PageDown,
196-
/// The `Page Up` key
197-
PageUp,
198-
/// The `Pause/Break` key
199-
PauseBreak,
200-
/// The `Print Screen` (`PrtScr`) key
201-
PrintScreen,
202-
/// The `Scroll Lock` key
203-
ScrollLock,
204-
/// The `;:` key
205-
SemiColon,
206-
/// The left-most shift key
207-
ShiftLeft,
208-
/// The right-most shift key
209-
ShiftRight,
210-
/// The `/?` key
211-
Slash,
212-
/// The `Space` key
213-
Spacebar,
214-
/// The `Tab` key
215-
Tab,
216-
/// The `'` key
217-
Quote,
218-
/// The left-most Windows (or GUI) key
219-
WindowsLeft,
220-
/// The right-most Windows (or GUI) key
221-
WindowsRight,
222-
/// The `Aa` key
223-
A,
224-
/// The `Bb` key
225-
B,
226-
/// The `Cc` key
227-
C,
228-
/// The `Dd` key
229-
D,
230-
/// The `Ee` key
231-
E,
232-
/// The `Ff` key
233-
F,
234-
/// The `Gg` key
235-
G,
236-
/// The `Hh` key
237-
H,
238-
/// The `Ii` key
239-
I,
240-
/// The `Jj` key
241-
J,
242-
/// The `Kk` key
243-
K,
244-
/// The `Ll` key
245-
L,
246-
/// The `Mm` key
247-
M,
248-
/// The `Nn` key
249-
N,
250-
/// The `Oo` key
251-
O,
252-
/// The `Pp` key
253-
P,
254-
/// The `Qq` key
255-
Q,
256-
/// The `Rr` key
257-
R,
258-
/// The `Ss` key
259-
S,
260-
/// The `Tt` key
261-
T,
262-
/// The `Uu` key
263-
U,
264-
/// The `Vv` key
265-
V,
266-
/// The `Ww` key
267-
W,
268-
/// The `Xx` key
269-
X,
270-
/// The `Yy` key
271-
Y,
272-
/// The `Zz` key
273-
Z,
274-
/// Found on non-US (e.g. UK) keyboards next to the main *Return* key.
275-
HashTilde,
276-
/// Media transport: previous track
277-
PrevTrack,
278-
/// Media transport: next track
279-
NextTrack,
280-
/// Media transport: mute audio
281-
Mute,
282-
/// Application key: open calculator
283-
Calculator,
284-
/// Media transport: play audio
285-
Play,
286-
/// Media transport: stop audio
287-
Stop,
288-
/// Media transport: turn volume down
289-
VolumeDown,
290-
/// Media transport: turn volume up
291-
VolumeUp,
292-
/// Media transport: open browser to homepage
293-
WWWHome,
294-
/// Keyboard Power On Test passed.
295-
///
296-
/// Expect this once on start-up.
297-
PowerOnTestOk,
298-
}
299-
30053
/// Represents the movement of a mouse over the previous period of time, and
30154
/// the current state of the mouse buttons.
30255
#[repr(C)]

0 commit comments

Comments
 (0)