mirror of https://github.com/JorjBauer/aiie.git
update to TeensyDuino 1.54b5 for raw USB keypress support
This commit is contained in:
parent
0f834e0ce2
commit
b1e1b22333
|
@ -6,8 +6,8 @@
|
||||||
|
|
||||||
/* FIXME globals */
|
/* FIXME globals */
|
||||||
static SdFat sd;
|
static SdFat sd;
|
||||||
static File cacheFile;
|
static FsFile cacheFile;
|
||||||
static File outerDir;
|
static FsFile outerDir;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ int16_t TeensyFileManager::readDir(const char *where, const char *suffix, char *
|
||||||
|
|
||||||
outputFN[0] = '\0';
|
outputFN[0] = '\0';
|
||||||
|
|
||||||
File e;
|
FsFile e;
|
||||||
while (e.openNext(&outerDir, O_RDONLY)) {
|
while (e.openNext(&outerDir, O_RDONLY)) {
|
||||||
|
|
||||||
// Skip MAC fork files
|
// Skip MAC fork files
|
||||||
|
@ -211,7 +211,7 @@ bool TeensyFileManager::setSeekPosition(int8_t fd, uint32_t pos)
|
||||||
// FIXME: this should be private
|
// FIXME: this should be private
|
||||||
void TeensyFileManager::seekToEnd(int8_t fd)
|
void TeensyFileManager::seekToEnd(int8_t fd)
|
||||||
{
|
{
|
||||||
File f;
|
FsFile f;
|
||||||
f.open(cachedNames[fd], O_RDONLY);
|
f.open(cachedNames[fd], O_RDONLY);
|
||||||
if (!f) {
|
if (!f) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "teensy-prefs.h"
|
#include "teensy-prefs.h"
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
#include <EEPROM.h>
|
#include <EEPROM.h>
|
||||||
|
|
||||||
TeensyPrefs::TeensyPrefs()
|
TeensyPrefs::TeensyPrefs()
|
||||||
|
|
|
@ -24,14 +24,14 @@ void TeensyUSB::init()
|
||||||
|
|
||||||
void TeensyUSB::attachKeypress(keyboardCallback cb)
|
void TeensyUSB::attachKeypress(keyboardCallback cb)
|
||||||
{
|
{
|
||||||
keyboard1.attachPress(cb);
|
keyboard1.attachRawPress(cb);
|
||||||
keyboard2.attachPress(cb);
|
keyboard2.attachRawPress(cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TeensyUSB::attachKeyrelease(keyboardCallback cb)
|
void TeensyUSB::attachKeyrelease(keyboardCallback cb)
|
||||||
{
|
{
|
||||||
keyboard1.attachRelease(cb);
|
keyboard1.attachRawRelease(cb);
|
||||||
keyboard2.attachRelease(cb);
|
keyboard2.attachRawRelease(cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TeensyUSB::maintain()
|
void TeensyUSB::maintain()
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <USBHost_t36.h>
|
#include <USBHost_t36.h>
|
||||||
|
|
||||||
typedef void (*keyboardCallback)(int unicode);
|
typedef void (*keyboardCallback)(uint8_t keycode);
|
||||||
|
|
||||||
class TeensyUSB {
|
class TeensyUSB {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -62,14 +62,20 @@ volatile uint16_t currentBatterySum = 0;
|
||||||
// how often should we read the battery level?
|
// how often should we read the battery level?
|
||||||
#define BATTERYPERIOD (60 * 100000)
|
#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
|
shift/control/command are automatically applied
|
||||||
caps lock is oemkey 57
|
caps lock is oemkey 57
|
||||||
set the keyboard LED w/ ::capsLock(bool)
|
set the keyboard LED w/ ::capsLock(bool)
|
||||||
modifiers are <<8 bits for the right side:
|
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
|
F1..F12 are 194..205
|
||||||
Arrows: l/r/u/d 216/215/218/217
|
Arrows: l/r/u/d 216/215/218/217
|
||||||
Delete: 127 (control-delete is 31)
|
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);
|
// vmkeyboard->keyDepressed(keypad.key[i].kchar);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onKeyrelease(int unicode)
|
void onKeyrelease(uint8_t keycode)
|
||||||
{
|
{
|
||||||
// vmkeyboard->keyReleased(keypad.key[i].kchar);
|
// vmkeyboard->keyReleased(keypad.key[i].kchar);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue