Serial Wombat Arduino Library
SerialWombatPS2Keyboard.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*
4 Copyright 2023 Broadwell Consulting Inc.
5 
6 "Serial Wombat" is a registered trademark of Broadwell Consulting Inc. in
7 the United States. See SerialWombat.com for usage guidance.
8 
9 Permission is hereby granted, free of charge, to any person obtaining a
10  * copy of this software and associated documentation files (the "Software"),
11  * to deal in the Software without restriction, including without limitation
12  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13  * and/or sell copies of the Software, and to permit persons to whom the
14  * Software is furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17  * all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26 */
27 
28 #include <stdint.h>
29 #include "Stream.h"
30 #include "SerialWombat.h"
35 typedef enum
36 {
38  SCANCODE_1 = 0x16,
39  SCANCODE_2 = 0x1E,
40  SCANCODE_3 = 0x26,
41  SCANCODE_4 = 0x25,
42  SCANCODE_5 = 0x2E,
43  SCANCODE_6 = 0x36,
44  SCANCODE_7 = 0x3D,
45  SCANCODE_8 = 0x3E,
46  SCANCODE_9 = 0x46,
47  SCANCODE_0 = 0x45,
48  SCANCODE_DASH = 0x4E,
51  SCANCODE_TAB = 0x0D,
52  SCANCODE_Q = 0x15,
53  SCANCODE_W = 0x1D,
54  SCANCODE_E = 0x24,
55  SCANCODE_R = 0x2D,
56  SCANCODE_T = 0x2C,
57  SCANCODE_Y = 0x35,
58  SCANCODE_U = 0x3C,
59  SCANCODE_I = 0x43,
60  SCANCODE_O = 0x44,
61  SCANCODE_P = 0x4D,
65  SCANCODE_A = 0x1C,
66  SCANCODE_S = 0x1B,
67  SCANCODE_D = 0x23,
68  SCANCODE_G = 0x34,
69  SCANCODE_H = 0x33,
70  SCANCODE_J = 0x3B,
71  SCANCODE_K = 0x42,
72  SCANCODE_L = 0x4B,
77  SCANCODE_Z = 0x1A,
78  SCANCODE_X = 0x22,
79  SCANCODE_C = 0x21,
80  SCANCODE_V = 0x2A,
81  SCANCODE_B = 0x32,
82  SCANCODE_N = 0x31,
83  SCANCODE_M = 0x3A,
96  SCANCODE_HOME = 0xEC,
97  SCANCODE_END = 0xE9,
104  SCANCODE_KP7 = 0x6C,
105  SCANCODE_KP4 = 0x6B,
106  SCANCODE_KP1 = 0x69,
108  SCANCODE_KP8 = 0x75,
109  SCANCODE_KP5 = 0x73,
110  SCANCODE_KP2 = 0x72,
111  SCANCODE_KP0 = 0x70,
113  SCANCODE_KP9 = 0x7D,
114  SCANCODE_KP6 = 0x74,
115  SCANCODE_KP3 = 0x7A,
120  SCANCODE_ESC = 0x76,
121  SCANCODE_F1 = 0x05,
122  SCANCODE_F2 = 0x06,
123  SCANCODE_F3 = 0x04,
124  SCANCODE_F4 = 0x0C,
125  SCANCODE_F5 = 0x03,
126  SCANCODE_F6 = 0x0B,
127  SCANCODE_F7 = 0x83,
128  SCANCODE_F8 = 0x0A,
129  SCANCODE_F9 = 0x01,
130  SCANCODE_F10 = 0x09,
131  SCANCODE_F11 = 0x78,
132  SCANCODE_F12 = 0x07,
137 
138 
182  public Stream, public SerialWombatPin
183 {
184 public:
199  int16_t begin(uint8_t clockPin, uint8_t dataPin, uint8_t bufferMode = 0, uint8_t queueMode = 0, uint16_t queueAddress = 0xFFFF, uint8_t pullUpDown = 0)
200  {
201  _pin = clockPin;
202  _pinMode = (uint8_t)PIN_MODE_PS2KEYBOARD;
203 
204  uint8_t tx[] = { (uint8_t)SerialWombatCommands::CONFIGURE_PIN_MODE0,
205  _pin,
206  (uint8_t)_pinMode ,
207  dataPin,
208  queueMode,
209  bufferMode,
210  0x55,
211  pullUpDown};
212  int16_t result = _sw.sendPacket(tx);
213  if (result < 0)
214  {
215  return result;
216  }
217 
218  if (queueAddress != 0xFFFF)
219  {
220  uint8_t tx6[] = { (uint8_t)SerialWombatCommands::CONFIGURE_PIN_MODE6,
221  _pin,
222  _pinMode,
223  SW_LE16(queueAddress),
224  0x55,
225  0x55,
226  0x55 };
227 
228  return _sw.sendPacket(tx6);
229  }
230  return (result);
231  }
232 
233 
234 
239  int available()
240  {
241  uint8_t tx[8] = { 201, _pin, _pinMode, 0,0x55,0x55,0x55,0x55 };
242  uint8_t rx[8];
243  _sw.sendPacket(tx, rx);
244  return (rx[4]);
245  }
250  int read()
251  {
252  uint8_t tx[8] = { 202, _pin,_pinMode, 1,0x55,0x55,0x55,0x55 };
253  uint8_t rx[8];
254  if (_sw.sendPacket(tx, rx) < 0)
255  {
256  return -1;
257  }
258 
259  if (rx[3] != 0)
260  {
261  return (rx[4]);
262  }
263  else
264  {
265  return (-1);
266  }
267  }
271  void flush()
272  {
273 
274  }
275 
280  int peek()
281  {
282  uint8_t tx[8] = { 203, _pin,_pinMode,0x55,0x55,0x55,0x55,0x55 };
283  uint8_t rx[8];
284  _sw.sendPacket(tx, rx);
285  if (rx[4] > 0)
286  {
287  return (rx[5]);
288  }
289  else
290  {
291  return (-1);
292  }
293  }
294 
302  size_t write(uint8_t data)
303 {
304 
305  return (1);
306 }
307 
316  size_t write(const uint8_t* buffer, size_t size)
317 {
318  return(size);
319 }
320 
326 {
327  return(0);
328 }
329 
340  size_t readBytes(char* buffer, size_t length)
341  {
342  int index = 0;
343  int bytesAvailable = 0;
344  uint32_t timeoutMillis = millis() + timeout;
345  while (length > 0 && timeoutMillis > millis())
346  {
347  int bytecount = 4;
348  if (length < 4)
349  {
350  bytecount = length;
351  }
352  {
353 
354  uint8_t tx[8] = { 202, _pin,_pinMode, (uint8_t)bytecount,0x55,0x55,0x55,0x55 };
355  uint8_t rx[8];
356  _sw.sendPacket(tx, rx);
357  bytesAvailable = rx[3];
358 
359  if (bytesAvailable == 0)
360  {
361  continue;
362  }
363  else
364  {
365  timeoutMillis = millis() + timeout;
366  }
367  uint8_t bytesReturned = bytecount;
368  if (rx[3] < bytecount)
369  {
370  bytesReturned = rx[3];
371  }
372  for (int i = 0; i < bytesReturned; ++i)
373  {
374  buffer[index] = rx[i + 4];
375  ++index;
376  --bytesAvailable;
377  --length;
378 
379  }
380  }
381 
382  }
383  return (index);
384  }
385 
386  int16_t readCurrentScanCodes(uint8_t* buffer, uint8_t startValue)
387  {
388  uint8_t tx[8] = { 207, _pin,_pinMode, startValue,0x55,0x55,0x55,0x55 };
389  uint8_t rx[8];
390 
391  int16_t result = _sw.sendPacket(tx, rx);
392 
393  if (result < 0)
394  {
395  return result;
396  }
397  int count = 0;
398  for (int i = 3; i < 8; ++i)
399  {
400  if (rx[i] != 0)
401  {
402  ++count;
403  }
404  buffer[i - 3] = rx[i];
405  }
406  return count;
407  }
408 
412  void setTimeout(long timeout_mS)
413  {
414  if (timeout_mS == 0)
415  {
416  timeout = 0x80000000;
417  }
418  else
419  {
420  timeout = timeout_mS;
421  }
422  }
423 
427  uint8_t scanCodeToAscii(uint8_t scanCode, bool shiftActive = false)
428  {
429 
430  if (scanCode >= 0x80)
431  {
432  return 0;
433  }
434  //This array is used to convert PS2 Code set 2 codes to Ascii. The first column is unshfited data, the second if shift is active
435  const uint8_t KBSCSet2[][2] =
436  {
437  { ' ' , ' ' }, /* 0 */
438  { ' ' , ' ' }, /* 1 */
439  { ' ' , ' ' }, /* 2 */
440  { ' ' , ' ' }, /* 3 */
441  { ' ' , ' ' }, /* 4 */
442  { ' ' , ' ' }, /* 5 */
443  { ' ' , ' ' }, /* 6 */
444  { ' ' , ' ' }, /* 7 */
445  { ' ' , ' ' }, /* 8 */
446  { ' ' , ' ' }, /* 9 */
447  { ' ' , ' ' }, /* A */
448  { ' ' , ' ' }, /* B */
449  { ' ' , ' ' }, /* C */
450  { 9 , 9 }, /* D */
451  { '`' , '~' }, /* E */
452  { ' ' , ' ' }, /* F */
453  { ' ' , ' ' }, /* 10 */
454  { ' ' , ' ' }, /* 11 */
455  { 0 , 0 }, /* 12 */
456  { ' ' , ' ' }, /* 13 */
457  { ' ' , ' ' }, /* 14 */
458  { 'q' , 'Q' }, /* 15 */
459  { '1' , '!' }, /* 16 */
460  { ' ' , ' ' }, /* 17 */
461  { ' ' , ' ' }, /* 18 */
462  { ' ' , ' ' }, /* 19 */
463  { 'z' , 'Z' }, /* 1A */
464  { 's' , 'S' }, /* 1B */
465  { 'a' , 'A' }, /* 1C */
466  { 'w' , 'W' }, /* 1D */
467  { '2' , '@' }, /* 1E */
468  { ' ' , ' ' }, /* 1F */
469  { ' ' , ' ' }, /* 20 */
470  { 'c' , 'C' }, /* 21 */
471  { 'x' , 'X' }, /* 22 */
472  { 'd' , 'D' }, /* 23 */
473  { 'e' , 'E' }, /* 24 */
474  { '4' , '$' }, /* 25 */
475  { '3' , '#' }, /* 26 */
476  { ' ' , ' ' }, /* 27 */
477  { ' ' , ' ' }, /* 28 */
478  { ' ' , ' ' }, /* 29 - SPACE */
479  { 'v' , 'V' }, /* 2A */
480  { 'f' , 'F' }, /* 2B */
481  { 't' , 'T' }, /* 2C */
482  { 'r' , 'R' }, /* 2D */
483  { '5' , '%' }, /* 2E */
484  { ' ' , ' ' }, /* 2F */
485  { ' ' , ' ' }, /* 30 */
486  { 'n' , 'N' }, /* 31 */
487  { 'b' , 'B' }, /* 32 */
488  { 'h' , 'H' }, /* 33 */
489  { 'g' , 'G' }, /* 34 */
490  { 'y' , 'Y' }, /* 35 */
491  { '6' , '^' }, /* 36 */
492  { ' ' , ' ' }, /* 37 */
493  { ' ' , ' ' }, /* 38 */
494  { ' ' , ' ' }, /* 39 */
495  { 'm' , 'M' }, /* 3A */
496  { 'j' , 'J' }, /* 3B */
497  { 'u' , 'U' }, /* 3C */
498  { '7' , '&' }, /* 3D */
499  { '8' , '*' }, /* 3E */
500  { ' ' , ' ' }, /* 3F */
501  { ' ' , ' ' }, /* 40 */
502  { ',' , '>' }, /* 41 */
503  { 'k' , 'K' }, /* 42 */
504  { 'i' , 'I' }, /* 43 */
505  { 'o' , 'O' }, /* 44 */
506  { '0' , ')' }, /* 45 */
507  { '9' , '(' }, /* 46 */
508  { ' ' , ' ' }, /* 47 */
509  { ' ' , ' ' }, /* 48 */
510  { '.' , '<' }, /* 49 */
511  { '/' , '?' }, /* 4A */
512  { 'l' , 'L' }, /* 4B */
513  { ';' , ':' }, /* 4C */
514  { 'p' , 'P' }, /* 4D */
515  { '-' , '_' }, /* 4E */
516  { ' ' , ' ' }, /* 4F */
517  { ' ' , ' ' }, /* 50 */
518  { ' ' , ' ' }, /* 51 */
519  { '\'' , '"' }, /* 52 */
520  { ' ' , ' ' }, /* 53 */
521  { '[' , '{' }, /* 54 */
522  { '=' , '+' }, /* 55 */
523  { ' ' , ' ' }, /* 56 */
524  { ' ' , ' ' }, /* 57 */
525  { ' ' , ' ' }, /* 58 */
526  { 0 , 0 }, /* 59 */
527  { 0xD , 0xD }, /* 5A */
528  { ']' , '}' }, /* 5B */
529  { ' ' , ' ' }, /* 5C */
530  { '\\' , '|' }, /* 5D */
531  { ' ' , ' ' }, /* 5E */
532  { ' ' , ' ' }, /* 5F */
533  { ' ' , ' ' }, /* 60 */
534  { ' ' , ' ' }, /* 61 */
535  { ' ' , ' ' }, /* 62 */
536  { ' ' , ' ' }, /* 63 */
537  { ' ' , ' ' }, /* 64 */
538  { ' ' , ' ' }, /* 65 */
539  { 8 , 8 }, /* 66 */
540  { ' ' , ' ' }, /* 67 */
541  { ' ' , ' ' }, /* 68 */
542  { '1' , '1' }, /* 69 */
543  { ' ' , ' ' }, /* 6A */
544  { '4' , '4' }, /* 6B */
545  { '7' , '7' }, /* 6C */
546  { ' ' , ' ' }, /* 6D */
547  { ' ' , ' ' }, /* 6E */
548  { ' ' , ' ' }, /* 6F */
549  { '0' , '0' }, /* 70 */
550  { ' ' , ' ' }, /* 71 */
551  { '2' , '2' }, /* 72 */
552  { '5' , '5' }, /* 73 */
553  { '6' , '6' }, /* 74 */
554  { '8' , '8' }, /* 75 */
555  { 0x1B , 0x1B }, /* 76 */
556  { ' ' , ' ' }, /* 77 */
557  { ' ' , ' ' }, /* 78 */
558  { ' ' , ' ' }, /* 79 */
559  { '3' , '3' }, /* 7A */
560  { ' ' , ' ' }, /* 7B */
561  { ' ' , ' ' }, /* 7C */
562  { '9' , '9' }, /* 7D */
563  { ' ' , ' ' }, /* 7E */
564  { ' ' , ' ' }, /* 7F */
565  };
566 
567  if (shiftActive)
568  {
569  return ( KBSCSet2[scanCode][ 1]);
570  }
571 
572  return ( KBSCSet2[scanCode][0]);
573  }
574 
580  bool isKeyPressed(uint8_t scanCode)
581 {
582  uint8_t buffer[5];
583  int16_t result = readCurrentScanCodes(buffer, scanCode);
584 
585  if (result < 0)
586  {
587  return false;
588  }
589 
590  if (buffer[0] == scanCode)
591  {
592  return true;
593  }
594 
595  return false;
596 
597 }
598 
600 {
601  return isKeyPressed((uint8_t) scanCode);
602 }
603 
604  uint8_t _pin = 255;
605 protected:
606  uint32_t timeout = 1;
607 };
608 
609 
610 
611 
SerialWombatPS2Keyboard::flush
void flush()
Discard all bytes from the SerialWombatPS2Keyboard queue.
Definition: SerialWombatPS2Keyboard.h:271
SCANCODE_KPMINUS
@ SCANCODE_KPMINUS
Definition: SerialWombatPS2Keyboard.h:117
SerialWombatPS2Keyboard::availableForWrite
int availableForWrite()
Number of bytes avaialble to write to SerialWombatPS2Keyboard queue. Returns 0.
Definition: SerialWombatPS2Keyboard.h:325
SCANCODE_KP9
@ SCANCODE_KP9
Definition: SerialWombatPS2Keyboard.h:113
SCANCODE_KPPLUS
@ SCANCODE_KPPLUS
Definition: SerialWombatPS2Keyboard.h:118
SCANCODE_K
@ SCANCODE_K
Definition: SerialWombatPS2Keyboard.h:71
SCANCODE_KPPERIOD
@ SCANCODE_KPPERIOD
Definition: SerialWombatPS2Keyboard.h:116
SCANCODE_DELETE
@ SCANCODE_DELETE
Definition: SerialWombatPS2Keyboard.h:94
SCANCODE_3
@ SCANCODE_3
Definition: SerialWombatPS2Keyboard.h:40
SerialWombatChip
Class for a Serial Wombat chip. Each Serial Wombat chip on a project should have its own instance.
Definition: SerialWombat.h:286
SCANCODE_QUOTE
@ SCANCODE_QUOTE
Definition: SerialWombatPS2Keyboard.h:74
SerialWombatPS2Keyboard::write
size_t write(const uint8_t *buffer, size_t size)
Write bytes to the SerialWombatPS2Keyboard queue (Does nothing)
Definition: SerialWombatPS2Keyboard.h:316
SCANCODE_KPSLASH
@ SCANCODE_KPSLASH
Definition: SerialWombatPS2Keyboard.h:107
SCANCODE_Q
@ SCANCODE_Q
Definition: SerialWombatPS2Keyboard.h:52
SCANCODE_PERIOD
@ SCANCODE_PERIOD
Definition: SerialWombatPS2Keyboard.h:85
SCANCODE_Z
@ SCANCODE_Z
Definition: SerialWombatPS2Keyboard.h:77
SerialWombatPS2Keyboard::SerialWombatPS2Keyboard
SerialWombatPS2Keyboard(SerialWombatChip &serialWombat)
Constructor for the SerialWombatPS2Keyboard class.
Definition: SerialWombatPS2Keyboard.h:189
SerialWombatCommands::CONFIGURE_PIN_MODE0
@ CONFIGURE_PIN_MODE0
(200)
SCANCODE_2
@ SCANCODE_2
Definition: SerialWombatPS2Keyboard.h:39
SCANCODE_EQUALS
@ SCANCODE_EQUALS
Definition: SerialWombatPS2Keyboard.h:49
SCANCODE_RIGHTARROW
@ SCANCODE_RIGHTARROW
Definition: SerialWombatPS2Keyboard.h:102
SCANCODE_F5
@ SCANCODE_F5
Definition: SerialWombatPS2Keyboard.h:125
SCANCODE_F3
@ SCANCODE_F3
Definition: SerialWombatPS2Keyboard.h:123
SerialWombatPS2Keyboard::scanCodeToAscii
uint8_t scanCodeToAscii(uint8_t scanCode, bool shiftActive=false)
convernts a set 2 Scan Code to Ascii
Definition: SerialWombatPS2Keyboard.h:427
SCANCODE_LEFTBRACKET
@ SCANCODE_LEFTBRACKET
Definition: SerialWombatPS2Keyboard.h:62
SCANCODE_F12
@ SCANCODE_F12
Definition: SerialWombatPS2Keyboard.h:132
SerialWombatPin::_sw
SerialWombatChip & _sw
Definition: SerialWombatPin.h:134
SerialWombatPS2Keyboard::setTimeout
void setTimeout(long timeout_mS)
implemented to fulfill Stream requirement.
Definition: SerialWombatPS2Keyboard.h:412
SCANCODE_END
@ SCANCODE_END
Definition: SerialWombatPS2Keyboard.h:97
SCANCODE_LEFTSHIFT
@ SCANCODE_LEFTSHIFT
Definition: SerialWombatPS2Keyboard.h:76
SCANCODE_RIGHTBRACKET
@ SCANCODE_RIGHTBRACKET
Definition: SerialWombatPS2Keyboard.h:63
SCANCODE_4
@ SCANCODE_4
Definition: SerialWombatPS2Keyboard.h:41
SCANCODE_V
@ SCANCODE_V
Definition: SerialWombatPS2Keyboard.h:80
SerialWombatPS2Keyboard::isKeyPressed
bool isKeyPressed(PS2KeyboardScanCode scanCode)
Definition: SerialWombatPS2Keyboard.h:599
PIN_MODE_PS2KEYBOARD
@ PIN_MODE_PS2KEYBOARD
(32)
Definition: SerialWombat.h:271
SCANCODE_KP7
@ SCANCODE_KP7
Definition: SerialWombatPS2Keyboard.h:104
SCANCODE_CAPSLOCK
@ SCANCODE_CAPSLOCK
Definition: SerialWombatPS2Keyboard.h:64
SCANCODE_O
@ SCANCODE_O
Definition: SerialWombatPS2Keyboard.h:60
SCANCODE_F4
@ SCANCODE_F4
Definition: SerialWombatPS2Keyboard.h:124
SCANCODE_INSERT
@ SCANCODE_INSERT
Definition: SerialWombatPS2Keyboard.h:93
SCANCODE_KP6
@ SCANCODE_KP6
Definition: SerialWombatPS2Keyboard.h:114
SCANCODE_SCROLLLOCK
@ SCANCODE_SCROLLLOCK
Definition: SerialWombatPS2Keyboard.h:134
SCANCODE_KP3
@ SCANCODE_KP3
Definition: SerialWombatPS2Keyboard.h:115
SCANCODE_F8
@ SCANCODE_F8
Definition: SerialWombatPS2Keyboard.h:128
SCANCODE_PRINTSCREEN
@ SCANCODE_PRINTSCREEN
Definition: SerialWombatPS2Keyboard.h:133
SCANCODE_HOME
@ SCANCODE_HOME
Definition: SerialWombatPS2Keyboard.h:96
SCANCODE_KP5
@ SCANCODE_KP5
Definition: SerialWombatPS2Keyboard.h:109
SCANCODE_N
@ SCANCODE_N
Definition: SerialWombatPS2Keyboard.h:82
SCANCODE_ENTER
@ SCANCODE_ENTER
Definition: SerialWombatPS2Keyboard.h:75
SCANCODE_6
@ SCANCODE_6
Definition: SerialWombatPS2Keyboard.h:43
SCANCODE_SEMICOLON
@ SCANCODE_SEMICOLON
Definition: SerialWombatPS2Keyboard.h:73
SerialWombat.h
SCANCODE_PAGEUP
@ SCANCODE_PAGEUP
Definition: SerialWombatPS2Keyboard.h:100
SerialWombatPS2Keyboard::_pin
uint8_t _pin
Definition: SerialWombatPS2Keyboard.h:604
SCANCODE_KPENTER
@ SCANCODE_KPENTER
Definition: SerialWombatPS2Keyboard.h:119
SCANCODE_F6
@ SCANCODE_F6
Definition: SerialWombatPS2Keyboard.h:126
SCANCODE_RIGHTALT
@ SCANCODE_RIGHTALT
Definition: SerialWombatPS2Keyboard.h:91
SCANCODE_I
@ SCANCODE_I
Definition: SerialWombatPS2Keyboard.h:59
SCANCODE_X
@ SCANCODE_X
Definition: SerialWombatPS2Keyboard.h:78
SCANCODE_F9
@ SCANCODE_F9
Definition: SerialWombatPS2Keyboard.h:129
SerialWombatPS2Keyboard::readCurrentScanCodes
int16_t readCurrentScanCodes(uint8_t *buffer, uint8_t startValue)
Definition: SerialWombatPS2Keyboard.h:386
SCANCODE_RIGHTSHIFT
@ SCANCODE_RIGHTSHIFT
Definition: SerialWombatPS2Keyboard.h:87
SCANCODE_DOWNARROW
@ SCANCODE_DOWNARROW
Definition: SerialWombatPS2Keyboard.h:99
SCANCODE_F2
@ SCANCODE_F2
Definition: SerialWombatPS2Keyboard.h:122
SCANCODE_D
@ SCANCODE_D
Definition: SerialWombatPS2Keyboard.h:67
SerialWombatPin
Describes a Serial Wombat Pin. Is base class for other pin modes.
Definition: SerialWombatPin.h:38
SCANCODE_DASH
@ SCANCODE_DASH
Definition: SerialWombatPS2Keyboard.h:48
SCANCODE_J
@ SCANCODE_J
Definition: SerialWombatPS2Keyboard.h:70
SCANCODE_B
@ SCANCODE_B
Definition: SerialWombatPS2Keyboard.h:81
SCANCODE_F11
@ SCANCODE_F11
Definition: SerialWombatPS2Keyboard.h:131
SerialWombatPin::_pinMode
uint8_t _pinMode
Definition: SerialWombatPin.h:135
SCANCODE_RIGHTCTRL
@ SCANCODE_RIGHTCTRL
Definition: SerialWombatPS2Keyboard.h:92
SCANCODE_LEFTARROW
@ SCANCODE_LEFTARROW
Definition: SerialWombatPS2Keyboard.h:95
SCANCODE_F1
@ SCANCODE_F1
Definition: SerialWombatPS2Keyboard.h:121
SerialWombatChip::sendPacket
int sendPacket(uint8_t tx[], uint8_t rx[])
Send an 8 byte packet to the Serial Wombat chip and wait for 8 bytes back.
Definition: SerialWombat.cpp:115
SCANCODE_9
@ SCANCODE_9
Definition: SerialWombatPS2Keyboard.h:46
SCANCODE_KP1
@ SCANCODE_KP1
Definition: SerialWombatPS2Keyboard.h:106
SCANCODE_7
@ SCANCODE_7
Definition: SerialWombatPS2Keyboard.h:44
SCANCODE_TAB
@ SCANCODE_TAB
Definition: SerialWombatPS2Keyboard.h:51
SerialWombatPS2Keyboard::write
size_t write(uint8_t data)
Write a byte to the SerialWombatPS2Keyboard queue (Does Nothing)
Definition: SerialWombatPS2Keyboard.h:302
SCANCODE_A
@ SCANCODE_A
Definition: SerialWombatPS2Keyboard.h:65
SCANCODE_F7
@ SCANCODE_F7
Definition: SerialWombatPS2Keyboard.h:127
SCANCODE_W
@ SCANCODE_W
Definition: SerialWombatPS2Keyboard.h:53
SCANCODE_KPASTERISK
@ SCANCODE_KPASTERISK
Definition: SerialWombatPS2Keyboard.h:112
SCANCODE_8
@ SCANCODE_8
Definition: SerialWombatPS2Keyboard.h:45
SCANCODE_ESC
@ SCANCODE_ESC
Definition: SerialWombatPS2Keyboard.h:120
SCANCODE_T
@ SCANCODE_T
Definition: SerialWombatPS2Keyboard.h:56
SCANCODE_KP8
@ SCANCODE_KP8
Definition: SerialWombatPS2Keyboard.h:108
SCANCODE_G
@ SCANCODE_G
Definition: SerialWombatPS2Keyboard.h:68
SerialWombatPS2Keyboard::isKeyPressed
bool isKeyPressed(uint8_t scanCode)
Check to see if a key is currently pressed (pin mode must be configured for bitfield mode)
Definition: SerialWombatPS2Keyboard.h:580
SCANCODE_PAGEDOWN
@ SCANCODE_PAGEDOWN
Definition: SerialWombatPS2Keyboard.h:101
SerialWombatPS2Keyboard
A class for the Serial Wombat SW18AB chips which recieves input from IBM PS2 Keyboards.
Definition: SerialWombatPS2Keyboard.h:181
SCANCODE_LEFTCTRL
@ SCANCODE_LEFTCTRL
Definition: SerialWombatPS2Keyboard.h:88
SCANCODE_KP2
@ SCANCODE_KP2
Definition: SerialWombatPS2Keyboard.h:110
SCANCODE_COMMA
@ SCANCODE_COMMA
Definition: SerialWombatPS2Keyboard.h:84
SCANCODE_R
@ SCANCODE_R
Definition: SerialWombatPS2Keyboard.h:55
SCANCODE_1
@ SCANCODE_1
Definition: SerialWombatPS2Keyboard.h:38
SCANCODE_SPACEBAR
@ SCANCODE_SPACEBAR
Definition: SerialWombatPS2Keyboard.h:90
SCANCODE_BACKSPACE
@ SCANCODE_BACKSPACE
Definition: SerialWombatPS2Keyboard.h:50
SCANCODE_C
@ SCANCODE_C
Definition: SerialWombatPS2Keyboard.h:79
SCANCODE_0
@ SCANCODE_0
Definition: SerialWombatPS2Keyboard.h:47
SW_LE16
#define SW_LE16(_a)
Convert a uint16_t to two bytes in little endian format for array initialization.
Definition: SerialWombat.h:41
SCANCODE_KP0
@ SCANCODE_KP0
Definition: SerialWombatPS2Keyboard.h:111
SCANCODE_5
@ SCANCODE_5
Definition: SerialWombatPS2Keyboard.h:42
SCANCODE_U
@ SCANCODE_U
Definition: SerialWombatPS2Keyboard.h:58
SCANCODE_F10
@ SCANCODE_F10
Definition: SerialWombatPS2Keyboard.h:130
SCANCODE_KP4
@ SCANCODE_KP4
Definition: SerialWombatPS2Keyboard.h:105
SCANCODE_NUMLOCK
@ SCANCODE_NUMLOCK
Definition: SerialWombatPS2Keyboard.h:103
SerialWombatPS2Keyboard::peek
int peek()
Query the SerialWombatPS2Keyboard queue for the next avaialble byte, but don't remove it from the que...
Definition: SerialWombatPS2Keyboard.h:280
SCANCODE_S
@ SCANCODE_S
Definition: SerialWombatPS2Keyboard.h:66
SCANCODE_BACKSLASH
@ SCANCODE_BACKSLASH
Definition: SerialWombatPS2Keyboard.h:135
SCANCODE_LEFTALT
@ SCANCODE_LEFTALT
Definition: SerialWombatPS2Keyboard.h:89
SCANCODE_L
@ SCANCODE_L
Definition: SerialWombatPS2Keyboard.h:72
SCANCODE_M
@ SCANCODE_M
Definition: SerialWombatPS2Keyboard.h:83
SerialWombatCommands::CONFIGURE_PIN_MODE6
@ CONFIGURE_PIN_MODE6
(206)
SCANCODE_OPENSINGLEQUOTE
@ SCANCODE_OPENSINGLEQUOTE
Definition: SerialWombatPS2Keyboard.h:37
PS2KeyboardScanCode
PS2KeyboardScanCode
Definition: SerialWombatPS2Keyboard.h:35
SCANCODE_H
@ SCANCODE_H
Definition: SerialWombatPS2Keyboard.h:69
SerialWombatPS2Keyboard::available
int available()
Queries the SerialWombatPS2Keyboard for number bytes available to read.
Definition: SerialWombatPS2Keyboard.h:239
SerialWombatPS2Keyboard::begin
int16_t begin(uint8_t clockPin, uint8_t dataPin, uint8_t bufferMode=0, uint8_t queueMode=0, uint16_t queueAddress=0xFFFF, uint8_t pullUpDown=0)
Initalize the SerialWombatPS2Keyboard.
Definition: SerialWombatPS2Keyboard.h:199
SerialWombatPS2Keyboard::timeout
uint32_t timeout
Definition: SerialWombatPS2Keyboard.h:606
SCANCODE_E
@ SCANCODE_E
Definition: SerialWombatPS2Keyboard.h:54
SerialWombatPS2Keyboard::read
int read()
Reads a byte from the SerialWombatPS2Keyboard queue.
Definition: SerialWombatPS2Keyboard.h:250
SCANCODE_UPARROW
@ SCANCODE_UPARROW
Definition: SerialWombatPS2Keyboard.h:98
SCANCODE_SLASH
@ SCANCODE_SLASH
Definition: SerialWombatPS2Keyboard.h:86
SCANCODE_Y
@ SCANCODE_Y
Definition: SerialWombatPS2Keyboard.h:57
SCANCODE_P
@ SCANCODE_P
Definition: SerialWombatPS2Keyboard.h:61
SerialWombatPS2Keyboard::readBytes
size_t readBytes(char *buffer, size_t length)
Reads a specified number of bytes from the SerialWombatPS2Keyboard queue queue.
Definition: SerialWombatPS2Keyboard.h:340