Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>pull/1033/head
parent
1296e3ee66
commit
e2f710abee
@ -0,0 +1,69 @@
|
|||||||
|
/* -*- mode: c++ -*-
|
||||||
|
* Copyright (C) 2021 Keyboard.io, Inc.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under
|
||||||
|
* the terms of the GNU General Public License as published by the Free Software
|
||||||
|
* Foundation, version 3.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
* details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <Kaleidoscope.h>
|
||||||
|
|
||||||
|
#include <Kaleidoscope-Syster.h>
|
||||||
|
|
||||||
|
// *INDENT-OFF*
|
||||||
|
KEYMAPS(
|
||||||
|
[0] = KEYMAP_STACKED
|
||||||
|
(
|
||||||
|
SYSTER, ___, ___, ___, ___, ___, ___,
|
||||||
|
Key_A, Key_B, Key_C, ___, ___, ___, ___,
|
||||||
|
Key_0, Key_1, ___, ___, ___, ___,
|
||||||
|
Key_Spacebar, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___,
|
||||||
|
___,
|
||||||
|
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___,
|
||||||
|
___
|
||||||
|
),
|
||||||
|
)
|
||||||
|
// *INDENT-ON*
|
||||||
|
|
||||||
|
void systerAction(kaleidoscope::plugin::Syster::action_t action, const char *symbol) {
|
||||||
|
switch (action) {
|
||||||
|
case kaleidoscope::plugin::Syster::StartAction:
|
||||||
|
break;
|
||||||
|
case kaleidoscope::plugin::Syster::EndAction:
|
||||||
|
break;
|
||||||
|
case kaleidoscope::plugin::Syster::SymbolAction:
|
||||||
|
if (strcmp(symbol, "abc") == 0) {
|
||||||
|
Kaleidoscope.handleKeyEvent(KeyEvent(KeyAddr::none(), INJECTED | IS_PRESSED, Key_X));
|
||||||
|
Kaleidoscope.handleKeyEvent(KeyEvent(KeyAddr::none(), INJECTED | WAS_PRESSED, Key_X));
|
||||||
|
}
|
||||||
|
if (strcmp(symbol, "a0") == 0) {
|
||||||
|
Kaleidoscope.handleKeyEvent(KeyEvent(KeyAddr::none(), INJECTED | IS_PRESSED, Key_Y));
|
||||||
|
Kaleidoscope.handleKeyEvent(KeyEvent(KeyAddr::none(), INJECTED | WAS_PRESSED, Key_Y));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
KALEIDOSCOPE_INIT_PLUGINS(Syster);
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Kaleidoscope.setup();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
Kaleidoscope.loop();
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"cpu": {
|
||||||
|
"fqbn": "keyboardio:virtual:model01",
|
||||||
|
"port": ""
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,115 @@
|
|||||||
|
VERSION 1
|
||||||
|
|
||||||
|
KEYSWITCH SYSTER 0 0
|
||||||
|
KEYSWITCH A 1 0
|
||||||
|
KEYSWITCH B 1 1
|
||||||
|
KEYSWITCH C 1 2
|
||||||
|
KEYSWITCH ZERO 2 0
|
||||||
|
KEYSWITCH ONE 2 1
|
||||||
|
KEYSWITCH SPACE 3 0
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
NAME Syster sequence without zero
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
PRESS SYSTER
|
||||||
|
RUN 1 cycle
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
RELEASE SYSTER
|
||||||
|
RUN 1 cycle
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
PRESS A
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report Key_A # The report should contain only `A`
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
RELEASE A
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report empty # The report should be empty
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
PRESS B
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report Key_B # The report should contain only `B`
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
RELEASE B
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report empty # The report should be empty
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
PRESS C
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report Key_C # The report should contain only `C`
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
RELEASE C
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report empty # The report should be empty
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
PRESS SPACE
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report Key_Backspace # The report should contain `backspace`
|
||||||
|
EXPECT keyboard-report empty # The report should be empty
|
||||||
|
EXPECT keyboard-report Key_Backspace # The report should contain `backspace`
|
||||||
|
EXPECT keyboard-report empty # The report should be empty
|
||||||
|
EXPECT keyboard-report Key_Backspace # The report should contain `backspace`
|
||||||
|
EXPECT keyboard-report empty # The report should be empty
|
||||||
|
EXPECT keyboard-report Key_X # The report should contain `X`
|
||||||
|
EXPECT keyboard-report empty # The report should be empty
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
RELEASE SPACE
|
||||||
|
RUN 1 cycle
|
||||||
|
|
||||||
|
RUN 10 ms
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
NAME Syster sequence with zero
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
PRESS SYSTER
|
||||||
|
RUN 1 cycle
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
RELEASE SYSTER
|
||||||
|
RUN 1 cycle
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
PRESS A
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report Key_A # The report should contain only `A`
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
RELEASE A
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report empty # The report should be empty
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
PRESS ZERO
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report Key_0 # The report should contain only `0`
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
RELEASE ZERO
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report empty # The report should be empty
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
PRESS SPACE
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report Key_Backspace # The report should contain `backspace`
|
||||||
|
EXPECT keyboard-report empty # The report should be empty
|
||||||
|
EXPECT keyboard-report Key_Backspace # The report should contain `backspace`
|
||||||
|
EXPECT keyboard-report empty # The report should be empty
|
||||||
|
EXPECT keyboard-report Key_Y # The report should contain `Y`
|
||||||
|
EXPECT keyboard-report empty # The report should be empty
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
RELEASE SPACE
|
||||||
|
RUN 1 cycle
|
||||||
|
|
||||||
|
RUN 10 ms
|
Loading…
Reference in new issue