From 8c254e15a094981fa825d09a15bef89985e3fc06 Mon Sep 17 00:00:00 2001 From: Jorj Bauer Date: Thu, 9 Jul 2020 20:49:25 -0400 Subject: [PATCH] left behind notes for USB keyboard work --- teensy/teensy.ino | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/teensy/teensy.ino b/teensy/teensy.ino index 405ba0d..29013c1 100644 --- a/teensy/teensy.ino +++ b/teensy/teensy.ino @@ -49,31 +49,26 @@ volatile bool g_writePrefsFromMainLoop = false; void onKeypress(int unicode) { - Serial.print("onKeypress:"); - Serial.println(unicode); - uint8_t modifiers = usb.getModifiers(); - Serial.print("Modifiers: "); - Serial.println(modifiers, HEX); - if (unicode == 0) { - unicode = usb.getOemKey(); - Serial.print("oemKey: "); - Serial.println(unicode); - } + /* +shift/control/command are automatically applied +caps lock is oemkey 57 + set the keyboard LED w/ ::capsLock(bool) +modifiers are <<8 bits for the right side: + command: 0x08; option/alt: 0x04; shift: 0x02; control: 0x01 +F1..F12 are 194..205 +Arrows: l/r/u/d 216/215/218/217 +Delete: 127 (control-delete is 31) +home/pgup/down/delete/end: 210,211,214,212,213 +numlock: oem 83 +keypad: 210..218 as arrows &c, or digit ascii values w/ numlock on + enter: 10 + */ + // vmkeyboard->keyDepressed(keypad.key[i].kchar); } void onKeyrelease(int unicode) { - Serial.print("onKeyrelease: "); - Serial.println(unicode); - uint8_t modifiers = usb.getModifiers(); - Serial.print("Modifiers: "); - Serial.println(modifiers, HEX); - if (unicode == 0) { - unicode = usb.getOemKey(); - Serial.print("oemKey: "); - Serial.println(unicode); - } // vmkeyboard->keyReleased(keypad.key[i].kchar); }