|
|
@ -22,26 +22,26 @@
|
|
|
|
using namespace KaleidoscopePlugins::Ranges;
|
|
|
|
using namespace KaleidoscopePlugins::Ranges;
|
|
|
|
|
|
|
|
|
|
|
|
namespace KaleidoscopePlugins {
|
|
|
|
namespace KaleidoscopePlugins {
|
|
|
|
// --- state ---
|
|
|
|
// --- state ---
|
|
|
|
Key Cycle::lastNonCycleKey;
|
|
|
|
Key Cycle::lastNonCycleKey;
|
|
|
|
uint8_t Cycle::cycleCount;
|
|
|
|
uint8_t Cycle::cycleCount;
|
|
|
|
|
|
|
|
|
|
|
|
// --- helpers ---
|
|
|
|
// --- helpers ---
|
|
|
|
|
|
|
|
|
|
|
|
#define isCycle(k) (k.raw == CYCLE)
|
|
|
|
#define isCycle(k) (k.raw == CYCLE)
|
|
|
|
|
|
|
|
|
|
|
|
// --- api ---
|
|
|
|
// --- api ---
|
|
|
|
|
|
|
|
|
|
|
|
Cycle::Cycle (void) {
|
|
|
|
Cycle::Cycle (void) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
Cycle::begin (void) {
|
|
|
|
Cycle::begin (void) {
|
|
|
|
event_handler_hook_use (this->eventHandlerHook);
|
|
|
|
event_handler_hook_use (this->eventHandlerHook);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
Cycle::replace (Key key) {
|
|
|
|
Cycle::replace (Key key) {
|
|
|
|
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);
|
|
|
@ -51,21 +51,21 @@ namespace KaleidoscopePlugins {
|
|
|
|
Keyboard.sendReport ();
|
|
|
|
Keyboard.sendReport ();
|
|
|
|
handle_keyswitch_event (key, UNKNOWN_KEYSWITCH_LOCATION, WAS_PRESSED | INJECTED);
|
|
|
|
handle_keyswitch_event (key, UNKNOWN_KEYSWITCH_LOCATION, WAS_PRESSED | INJECTED);
|
|
|
|
Keyboard.sendReport ();
|
|
|
|
Keyboard.sendReport ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
Cycle::replace (uint8_t cycleSize, const Key cycleSteps[]) {
|
|
|
|
Cycle::replace (uint8_t cycleSize, const Key cycleSteps[]) {
|
|
|
|
uint8_t idx = cycleCount % cycleSize;
|
|
|
|
uint8_t idx = cycleCount % cycleSize;
|
|
|
|
Key key;
|
|
|
|
Key key;
|
|
|
|
|
|
|
|
|
|
|
|
key.raw = pgm_read_word (cycleSteps + idx);
|
|
|
|
key.raw = pgm_read_word (cycleSteps + idx);
|
|
|
|
replace (key);
|
|
|
|
replace (key);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// --- hooks ---
|
|
|
|
// --- hooks ---
|
|
|
|
|
|
|
|
|
|
|
|
Key
|
|
|
|
Key
|
|
|
|
Cycle::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) {
|
|
|
|
Cycle::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) {
|
|
|
|
if (keyState & INJECTED)
|
|
|
|
if (keyState & INJECTED)
|
|
|
|
return mappedKey;
|
|
|
|
return mappedKey;
|
|
|
|
|
|
|
|
|
|
|
@ -89,7 +89,7 @@ namespace KaleidoscopePlugins {
|
|
|
|
cycleCount++;
|
|
|
|
cycleCount++;
|
|
|
|
cycleAction (lastNonCycleKey, cycleCount);
|
|
|
|
cycleAction (lastNonCycleKey, cycleCount);
|
|
|
|
return Key_NoKey;
|
|
|
|
return Key_NoKey;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
__attribute__((weak))
|
|
|
|
__attribute__((weak))
|
|
|
|