diff --git a/teensy/teensy-filemanager.cpp b/teensy/teensy-filemanager.cpp index c305bde..44b4f48 100644 --- a/teensy/teensy-filemanager.cpp +++ b/teensy/teensy-filemanager.cpp @@ -6,8 +6,8 @@ /* FIXME globals */ static SdFat sd; -static File cacheFile; -static File outerDir; +static FsFile cacheFile; +static FsFile outerDir; @@ -111,7 +111,7 @@ int16_t TeensyFileManager::readDir(const char *where, const char *suffix, char * outputFN[0] = '\0'; - File e; + FsFile e; while (e.openNext(&outerDir, O_RDONLY)) { // Skip MAC fork files @@ -211,7 +211,7 @@ bool TeensyFileManager::setSeekPosition(int8_t fd, uint32_t pos) // FIXME: this should be private void TeensyFileManager::seekToEnd(int8_t fd) { - File f; + FsFile f; f.open(cachedNames[fd], O_RDONLY); if (!f) { return; diff --git a/teensy/teensy-prefs.cpp b/teensy/teensy-prefs.cpp index 80ef165..9c11899 100644 --- a/teensy/teensy-prefs.cpp +++ b/teensy/teensy-prefs.cpp @@ -1,5 +1,6 @@ #include "teensy-prefs.h" +#include #include TeensyPrefs::TeensyPrefs() diff --git a/teensy/teensy-usb.cpp b/teensy/teensy-usb.cpp index 18ab199..08ab225 100644 --- a/teensy/teensy-usb.cpp +++ b/teensy/teensy-usb.cpp @@ -24,14 +24,14 @@ void TeensyUSB::init() void TeensyUSB::attachKeypress(keyboardCallback cb) { - keyboard1.attachPress(cb); - keyboard2.attachPress(cb); + keyboard1.attachRawPress(cb); + keyboard2.attachRawPress(cb); } void TeensyUSB::attachKeyrelease(keyboardCallback cb) { - keyboard1.attachRelease(cb); - keyboard2.attachRelease(cb); + keyboard1.attachRawRelease(cb); + keyboard2.attachRawRelease(cb); } void TeensyUSB::maintain() diff --git a/teensy/teensy-usb.h b/teensy/teensy-usb.h index ed49286..c307e90 100644 --- a/teensy/teensy-usb.h +++ b/teensy/teensy-usb.h @@ -4,7 +4,7 @@ #include #include -typedef void (*keyboardCallback)(int unicode); +typedef void (*keyboardCallback)(uint8_t keycode); class TeensyUSB { public: diff --git a/teensy/teensy.ino b/teensy/teensy.ino index 9212fda..16fcac7 100644 --- a/teensy/teensy.ino +++ b/teensy/teensy.ino @@ -62,14 +62,20 @@ volatile uint16_t currentBatterySum = 0; // how often should we read the battery level? #define BATTERYPERIOD (60 * 100000) -void onKeypress(int unicode) +void onKeypress(uint8_t keycode) { + uint8_t mods = usb.getModifiers(); + uint8_t oem = usb.getOemKey(); + char buf[256]; + sprintf(buf, "%d [%c] [0x%X] [0x%X]", keycode, (char)keycode, mods, oem); + Serial.println(buf); + /* 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 +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) @@ -82,7 +88,7 @@ keypad: 210..218 as arrows &c, or digit ascii values w/ numlock on // vmkeyboard->keyDepressed(keypad.key[i].kchar); } -void onKeyrelease(int unicode) +void onKeyrelease(uint8_t keycode) { // vmkeyboard->keyReleased(keypad.key[i].kchar); }