Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>pull/1024/head
parent
f136912015
commit
cc8bd39c43
@ -0,0 +1,57 @@
|
|||||||
|
/* -*- 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-WinKeyToggle.h>
|
||||||
|
#include <Kaleidoscope-Macros.h>
|
||||||
|
|
||||||
|
// *INDENT-OFF*
|
||||||
|
KEYMAPS(
|
||||||
|
[0] = KEYMAP_STACKED
|
||||||
|
(
|
||||||
|
Key_LeftGui, Key_RightGui, Key_LeftShift, ___, ___, ___, ___,
|
||||||
|
Key_A, Key_B, Key_C, Key_D, ___, ___, ___,
|
||||||
|
M(0), ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___,
|
||||||
|
___,
|
||||||
|
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___,
|
||||||
|
___
|
||||||
|
),
|
||||||
|
)
|
||||||
|
// *INDENT-ON*
|
||||||
|
|
||||||
|
const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
|
||||||
|
if (keyToggledOn(event.state) && macro_id == 0) {
|
||||||
|
WinKeyToggle.toggle();
|
||||||
|
}
|
||||||
|
return MACRO_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
KALEIDOSCOPE_INIT_PLUGINS(WinKeyToggle, Macros);
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Kaleidoscope.setup();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
Kaleidoscope.loop();
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"cpu": {
|
||||||
|
"fqbn": "keyboardio:virtual:model01",
|
||||||
|
"port": ""
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,89 @@
|
|||||||
|
VERSION 1
|
||||||
|
|
||||||
|
KEYSWITCH L_GUI 0 0
|
||||||
|
KEYSWITCH R_GUI 0 0
|
||||||
|
KEYSWITCH A 1 0
|
||||||
|
KEYSWITCH B 1 1
|
||||||
|
KEYSWITCH C 1 2
|
||||||
|
KEYSWITCH D 1 3
|
||||||
|
KEYSWITCH TOGGLE 2 0
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
NAME Win key enabled on start
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
PRESS L_GUI
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report Key_LeftGui # report should contain `gui` (0xe3)
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
RELEASE L_GUI
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report empty # report should be empty
|
||||||
|
|
||||||
|
RUN 5 ms
|
||||||
|
EXPECT no keyboard-report # expect no more reports
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
NAME Win key disabled after toggle
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
PRESS TOGGLE
|
||||||
|
RUN 1 cycle
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
RELEASE TOGGLE
|
||||||
|
RUN 1 cycle
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
PRESS L_GUI
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT no keyboard-report
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
RELEASE L_GUI
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT no keyboard-report
|
||||||
|
|
||||||
|
RUN 5 ms
|
||||||
|
EXPECT no keyboard-report # expect no more reports
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
NAME WinKeyToggle other keys not disabled
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
PRESS A
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report Key_A # report should contain `A` (0x04)
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
RELEASE A
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report empty # report should be empty
|
||||||
|
|
||||||
|
RUN 5 ms
|
||||||
|
EXPECT no keyboard-report # expect no more reports
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
NAME WinKeyToggle turns back on
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
PRESS TOGGLE
|
||||||
|
RUN 1 cycle
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
RELEASE TOGGLE
|
||||||
|
RUN 1 cycle
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
PRESS L_GUI
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report Key_LeftGui # report should contain `gui` (0xe3)
|
||||||
|
|
||||||
|
RUN 4 ms
|
||||||
|
RELEASE L_GUI
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report empty # report should be empty
|
||||||
|
|
||||||
|
RUN 5 ms
|
||||||
|
EXPECT no keyboard-report # expect no more reports
|
Loading…
Reference in new issue