|
|
@ -22,8 +22,8 @@ namespace Akela {
|
|
|
|
GhostInTheFirmware::GhostKey *GhostInTheFirmware::ghostKeys;
|
|
|
|
GhostInTheFirmware::GhostKey *GhostInTheFirmware::ghostKeys;
|
|
|
|
bool GhostInTheFirmware::isActive;
|
|
|
|
bool GhostInTheFirmware::isActive;
|
|
|
|
uint16_t GhostInTheFirmware::currentPos;
|
|
|
|
uint16_t GhostInTheFirmware::currentPos;
|
|
|
|
uint8_t GhostInTheFirmware::timer;
|
|
|
|
uint32_t GhostInTheFirmware::startTime;
|
|
|
|
uint8_t GhostInTheFirmware::timeOut;
|
|
|
|
uint16_t GhostInTheFirmware::timeOut;
|
|
|
|
|
|
|
|
|
|
|
|
GhostInTheFirmware::GhostInTheFirmware (void) {
|
|
|
|
GhostInTheFirmware::GhostInTheFirmware (void) {
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -49,32 +49,31 @@ namespace Akela {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
if (timeOut == 0) {
|
|
|
|
if (timeOut == 0) {
|
|
|
|
timeOut = pgm_read_byte (&(ghostKeys[currentPos].delay));
|
|
|
|
timeOut = pgm_read_word (&(ghostKeys[currentPos].delay));
|
|
|
|
|
|
|
|
|
|
|
|
if (timeOut == 0) {
|
|
|
|
if (timeOut == 0) {
|
|
|
|
currentPos = 0;
|
|
|
|
currentPos = 0;
|
|
|
|
isActive = false;
|
|
|
|
isActive = false;
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (timer == timeOut / 3 && timer != 0) {
|
|
|
|
} else if ((millis () - startTime) == timeOut / 3) {
|
|
|
|
byte row = pgm_read_byte (&(ghostKeys[currentPos].row));
|
|
|
|
byte row = pgm_read_byte (&(ghostKeys[currentPos].row));
|
|
|
|
byte col = pgm_read_byte (&(ghostKeys[currentPos].col));
|
|
|
|
byte col = pgm_read_byte (&(ghostKeys[currentPos].col));
|
|
|
|
|
|
|
|
|
|
|
|
handle_key_event (Key_NoKey, row, col, WAS_PRESSED);
|
|
|
|
handle_key_event (Key_NoKey, row, col, WAS_PRESSED);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (timer < timeOut / 3) {
|
|
|
|
if ((millis () - startTime) < timeOut / 3) {
|
|
|
|
byte row = pgm_read_byte (&(ghostKeys[currentPos].row));
|
|
|
|
byte row = pgm_read_byte (&(ghostKeys[currentPos].row));
|
|
|
|
byte col = pgm_read_byte (&(ghostKeys[currentPos].col));
|
|
|
|
byte col = pgm_read_byte (&(ghostKeys[currentPos].col));
|
|
|
|
|
|
|
|
|
|
|
|
handle_key_event (Key_NoKey, row, col, IS_PRESSED);
|
|
|
|
handle_key_event (Key_NoKey, row, col, IS_PRESSED);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
timer++;
|
|
|
|
if ((millis () - startTime) > timeOut) {
|
|
|
|
|
|
|
|
|
|
|
|
if (timer > timeOut) {
|
|
|
|
|
|
|
|
currentPos++;
|
|
|
|
currentPos++;
|
|
|
|
timer = timeOut = 0;
|
|
|
|
timeOut = 0;
|
|
|
|
|
|
|
|
startTime = millis ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|