Ps2KeyboardHost  1.0.1
Allows you to read from one or more PS2-style keyboards on an Arduino.
ps2_UsbTranslator.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2017 Steve Benz <s8878992@hotmail.com>
3 
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8 
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13 
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
17 USA
18 */
19 #pragma once
20 
21 #include "ps2_KeyboardLeds.h"
22 #include "ps2_KeyboardOutput.h"
23 
24 namespace ps2 {
25 
27  enum class UsbKeyboardLeds {
28  none = 0x0,
29  numLock = 0x1,
30  capsLock = 0x2,
31  scrollLock = 0x4,
32  all = 0x07,
33  };
34 
36  struct UsbKeyAction {
37  uint8_t hidCode;
38  enum {
41  None
42  } gesture;
43  };
44 
50  template <typename Diagnostics = NullDiagnostics>
52  {
53  public:
54  UsbTranslator();
55  UsbTranslator(Diagnostics &diagnostics);
56 
59  void reset();
60 
68  UsbKeyAction translatePs2Keycode(ps2::KeyboardOutput ps2Scan);
69  KeyboardLeds translateLeds(UsbKeyboardLeds usbLeds);
70 
71  private:
72  bool isSpecial;
73  bool isUnmake;
74  int pauseKeySequenceIndex;
75  Diagnostics *diagnostics;
76  };
77 }
78 
79 #include "ps2_UsbTranslator.hpp"
A translated PS2 keystroke - it indicates either a keydown, a key up, or that there should be no imme...
Definition: ps2_UsbTranslator.h:36
Definition: ps2_AnsiTranslator.h:24
Definition: ps2_UsbTranslator.h:40
UsbKeyboardLeds
The bitfield that describes USB LED&#39;s.
Definition: ps2_UsbTranslator.h:27
Translates from PS2&#39;s default scancode set to USB/HID.
Definition: ps2_UsbTranslator.h:51
KeyboardOutput
Byte-codes sent back from the Ps2 keyboard to the host.
Definition: ps2_KeyboardOutput.h:31
KeyboardLeds
The LED&#39;s available on a standard PS2 keyboard.
Definition: ps2_KeyboardLeds.h:23
Definition: ps2_UsbTranslator.h:39
uint8_t hidCode
Definition: ps2_UsbTranslator.h:37