2020-07-07 10:25:04 +00:00
|
|
|
#include <Arduino.h>
|
|
|
|
#include <USBHost_t36.h>
|
|
|
|
#include "teensy-usb.h"
|
|
|
|
|
|
|
|
USBHost myusb;
|
|
|
|
USBHub hub1(myusb);
|
|
|
|
USBHub hub2(myusb);
|
|
|
|
USBHub hub3(myusb);
|
|
|
|
KeyboardController keyboard1(myusb);
|
|
|
|
KeyboardController keyboard2(myusb);
|
|
|
|
|
|
|
|
TeensyUSB::TeensyUSB()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
TeensyUSB::~TeensyUSB()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void TeensyUSB::init()
|
|
|
|
{
|
|
|
|
myusb.begin();
|
|
|
|
}
|
|
|
|
|
|
|
|
void TeensyUSB::attachKeypress(keyboardCallback cb)
|
|
|
|
{
|
2020-12-29 02:48:00 +00:00
|
|
|
keyboard1.attachRawPress(cb);
|
|
|
|
keyboard2.attachRawPress(cb);
|
2020-07-07 10:25:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void TeensyUSB::attachKeyrelease(keyboardCallback cb)
|
|
|
|
{
|
2020-12-29 02:48:00 +00:00
|
|
|
keyboard1.attachRawRelease(cb);
|
|
|
|
keyboard2.attachRawRelease(cb);
|
2020-07-07 10:25:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void TeensyUSB::maintain()
|
|
|
|
{
|
|
|
|
myusb.Task();
|
|
|
|
}
|
2020-07-08 13:44:33 +00:00
|
|
|
|
|
|
|
uint8_t TeensyUSB::getModifiers()
|
|
|
|
{
|
|
|
|
// FIXME: specifically keyboard1? guess the callbacks need a kb #
|
|
|
|
return keyboard1.getModifiers();
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t TeensyUSB::getOemKey()
|
|
|
|
{
|
|
|
|
// same FIXME as getModifiers
|
|
|
|
return keyboard1.getOemKey();
|
|
|
|
}
|