|
|
@ -32,16 +32,16 @@ bool Syster::isActive;
|
|
|
|
|
|
|
|
|
|
|
|
// --- api ---
|
|
|
|
// --- api ---
|
|
|
|
|
|
|
|
|
|
|
|
Syster::Syster (void) {
|
|
|
|
Syster::Syster(void) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
Syster::begin (void) {
|
|
|
|
Syster::begin(void) {
|
|
|
|
event_handler_hook_use (this->eventHandlerHook);
|
|
|
|
event_handler_hook_use(this->eventHandlerHook);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
Syster::reset (void) {
|
|
|
|
Syster::reset(void) {
|
|
|
|
symbolPos = 0;
|
|
|
|
symbolPos = 0;
|
|
|
|
symbol[0] = 0;
|
|
|
|
symbol[0] = 0;
|
|
|
|
isActive = false;
|
|
|
|
isActive = false;
|
|
|
@ -49,14 +49,14 @@ Syster::reset (void) {
|
|
|
|
|
|
|
|
|
|
|
|
// --- hooks ---
|
|
|
|
// --- hooks ---
|
|
|
|
Key
|
|
|
|
Key
|
|
|
|
Syster::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) {
|
|
|
|
Syster::eventHandlerHook(Key mappedKey, byte row, byte col, uint8_t keyState) {
|
|
|
|
if (!isActive) {
|
|
|
|
if (!isActive) {
|
|
|
|
if (!isSyster (mappedKey))
|
|
|
|
if (!isSyster(mappedKey))
|
|
|
|
return mappedKey;
|
|
|
|
return mappedKey;
|
|
|
|
|
|
|
|
|
|
|
|
if (key_toggled_on (keyState)) {
|
|
|
|
if (key_toggled_on(keyState)) {
|
|
|
|
isActive = true;
|
|
|
|
isActive = true;
|
|
|
|
systerAction (StartAction, NULL);
|
|
|
|
systerAction(StartAction, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Key_NoKey;
|
|
|
|
return Key_NoKey;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -64,37 +64,37 @@ Syster::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) {
|
|
|
|
if (keyState & INJECTED)
|
|
|
|
if (keyState & INJECTED)
|
|
|
|
return mappedKey;
|
|
|
|
return mappedKey;
|
|
|
|
|
|
|
|
|
|
|
|
if (isSyster (mappedKey))
|
|
|
|
if (isSyster(mappedKey))
|
|
|
|
return Key_NoKey;
|
|
|
|
return Key_NoKey;
|
|
|
|
|
|
|
|
|
|
|
|
if (mappedKey == Key_Backspace && symbolPos == 0)
|
|
|
|
if (mappedKey == Key_Backspace && symbolPos == 0)
|
|
|
|
return Key_NoKey;
|
|
|
|
return Key_NoKey;
|
|
|
|
|
|
|
|
|
|
|
|
if (key_toggled_off (keyState)) {
|
|
|
|
if (key_toggled_off(keyState)) {
|
|
|
|
if (mappedKey == Key_Spacebar) {
|
|
|
|
if (mappedKey == Key_Spacebar) {
|
|
|
|
for (uint8_t i = 0; i <= symbolPos; i++) {
|
|
|
|
for (uint8_t i = 0; i <= symbolPos; i++) {
|
|
|
|
handle_keyswitch_event (Key_Backspace, UNKNOWN_KEYSWITCH_LOCATION, IS_PRESSED | INJECTED);
|
|
|
|
handle_keyswitch_event(Key_Backspace, UNKNOWN_KEYSWITCH_LOCATION, IS_PRESSED | INJECTED);
|
|
|
|
Keyboard.sendReport ();
|
|
|
|
Keyboard.sendReport();
|
|
|
|
handle_keyswitch_event (Key_Backspace, UNKNOWN_KEYSWITCH_LOCATION, WAS_PRESSED | INJECTED);
|
|
|
|
handle_keyswitch_event(Key_Backspace, UNKNOWN_KEYSWITCH_LOCATION, WAS_PRESSED | INJECTED);
|
|
|
|
Keyboard.sendReport ();
|
|
|
|
Keyboard.sendReport();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
systerAction (EndAction, NULL);
|
|
|
|
systerAction(EndAction, NULL);
|
|
|
|
|
|
|
|
|
|
|
|
symbol[symbolPos] = 0;
|
|
|
|
symbol[symbolPos] = 0;
|
|
|
|
systerAction (SymbolAction, symbol);
|
|
|
|
systerAction(SymbolAction, symbol);
|
|
|
|
reset ();
|
|
|
|
reset();
|
|
|
|
|
|
|
|
|
|
|
|
return Key_NoKey;
|
|
|
|
return Key_NoKey;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (key_toggled_on (keyState)) {
|
|
|
|
if (key_toggled_on(keyState)) {
|
|
|
|
if (mappedKey == Key_Backspace) {
|
|
|
|
if (mappedKey == Key_Backspace) {
|
|
|
|
if (symbolPos > 0)
|
|
|
|
if (symbolPos > 0)
|
|
|
|
symbolPos--;
|
|
|
|
symbolPos--;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
const char c = keyToChar (mappedKey);
|
|
|
|
const char c = keyToChar(mappedKey);
|
|
|
|
if (c)
|
|
|
|
if (c)
|
|
|
|
symbol[symbolPos++] = c;
|
|
|
|
symbol[symbolPos++] = c;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -106,7 +106,7 @@ Syster::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) {
|
|
|
|
|
|
|
|
|
|
|
|
__attribute__((weak))
|
|
|
|
__attribute__((weak))
|
|
|
|
const char
|
|
|
|
const char
|
|
|
|
keyToChar (Key key) {
|
|
|
|
keyToChar(Key key) {
|
|
|
|
if (key.flags != 0)
|
|
|
|
if (key.flags != 0)
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
|
@ -122,7 +122,7 @@ keyToChar (Key key) {
|
|
|
|
|
|
|
|
|
|
|
|
__attribute__((weak))
|
|
|
|
__attribute__((weak))
|
|
|
|
void
|
|
|
|
void
|
|
|
|
systerAction (KaleidoscopePlugins::Syster::action_t action, const char *symbol) {
|
|
|
|
systerAction(KaleidoscopePlugins::Syster::action_t action, const char *symbol) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
KaleidoscopePlugins::Syster Syster;
|
|
|
|
KaleidoscopePlugins::Syster Syster;
|
|
|
|