|
|
@ -21,8 +21,8 @@
|
|
|
|
namespace Akela {
|
|
|
|
namespace Akela {
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t SpaceCadetShift::parenNeeded;
|
|
|
|
uint8_t SpaceCadetShift::parenNeeded;
|
|
|
|
uint8_t SpaceCadetShift::timer;
|
|
|
|
uint32_t SpaceCadetShift::startTime;
|
|
|
|
uint8_t SpaceCadetShift::timeOut = 40;
|
|
|
|
uint16_t SpaceCadetShift::timeOut = 1000;
|
|
|
|
Key SpaceCadetShift::leftParen, SpaceCadetShift::rightParen;
|
|
|
|
Key SpaceCadetShift::leftParen, SpaceCadetShift::rightParen;
|
|
|
|
|
|
|
|
|
|
|
|
SpaceCadetShift::SpaceCadetShift () {
|
|
|
|
SpaceCadetShift::SpaceCadetShift () {
|
|
|
@ -67,15 +67,13 @@ namespace Akela {
|
|
|
|
if (key_toggled_on (keyState)) {
|
|
|
|
if (key_toggled_on (keyState)) {
|
|
|
|
if (mappedKey.raw == Key_LShift.raw) { // if it is LShift, remember it
|
|
|
|
if (mappedKey.raw == Key_LShift.raw) { // if it is LShift, remember it
|
|
|
|
bitWrite (parenNeeded, 0, 1);
|
|
|
|
bitWrite (parenNeeded, 0, 1);
|
|
|
|
if (timer < timeOut)
|
|
|
|
startTime = millis ();
|
|
|
|
timer++;
|
|
|
|
|
|
|
|
} else if (mappedKey.raw == Key_RShift.raw) { // if it is RShift, remember it
|
|
|
|
} else if (mappedKey.raw == Key_RShift.raw) { // if it is RShift, remember it
|
|
|
|
bitWrite (parenNeeded, 1, 1);
|
|
|
|
bitWrite (parenNeeded, 1, 1);
|
|
|
|
if (timer < timeOut)
|
|
|
|
startTime = millis ();
|
|
|
|
timer++;
|
|
|
|
|
|
|
|
} else { // if it is something else, we do not need a paren at the end.
|
|
|
|
} else { // if it is something else, we do not need a paren at the end.
|
|
|
|
parenNeeded = 0;
|
|
|
|
parenNeeded = 0;
|
|
|
|
timer = 0;
|
|
|
|
startTime = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// this is all we need to do on keypress, let the next handler do its thing too.
|
|
|
|
// this is all we need to do on keypress, let the next handler do its thing too.
|
|
|
@ -87,15 +85,10 @@ namespace Akela {
|
|
|
|
if (!parenNeeded)
|
|
|
|
if (!parenNeeded)
|
|
|
|
return mappedKey;
|
|
|
|
return mappedKey;
|
|
|
|
|
|
|
|
|
|
|
|
// if we did not time out yet, up the timer
|
|
|
|
|
|
|
|
if (timer < timeOut)
|
|
|
|
|
|
|
|
timer++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if we timed out, that means we need to keep pressing shift, but won't
|
|
|
|
// if we timed out, that means we need to keep pressing shift, but won't
|
|
|
|
// need the parens in the end.
|
|
|
|
// need the parens in the end.
|
|
|
|
if (timer >= timeOut) {
|
|
|
|
if ((millis () - startTime) >= timeOut) {
|
|
|
|
parenNeeded = 0;
|
|
|
|
parenNeeded = 0;
|
|
|
|
timer = 0;
|
|
|
|
|
|
|
|
return mappedKey;
|
|
|
|
return mappedKey;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -118,7 +111,6 @@ namespace Akela {
|
|
|
|
Keyboard.sendReport ();
|
|
|
|
Keyboard.sendReport ();
|
|
|
|
|
|
|
|
|
|
|
|
parenNeeded = 0;
|
|
|
|
parenNeeded = 0;
|
|
|
|
timer = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return mappedKey;
|
|
|
|
return mappedKey;
|
|
|
|