Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>pull/1013/head
parent
5c12c8ee49
commit
96b708f5a1
@ -0,0 +1,80 @@
|
|||||||
|
/* -*- 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>
|
||||||
|
|
||||||
|
// *INDENT-OFF*
|
||||||
|
KEYMAPS(
|
||||||
|
[0] = KEYMAP_STACKED
|
||||||
|
(
|
||||||
|
Key_A, ___, ___, ___, ___, ___, ___,
|
||||||
|
ShiftToLayer(0), ShiftToLayer(1), ShiftToLayer(2), ___, ___, ___, ___,
|
||||||
|
LockLayer(0), LockLayer(1), LockLayer(2), ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___,
|
||||||
|
___,
|
||||||
|
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___,
|
||||||
|
___
|
||||||
|
),
|
||||||
|
[1] = KEYMAP_STACKED
|
||||||
|
(
|
||||||
|
Key_B, Key_X, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___,
|
||||||
|
___,
|
||||||
|
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___,
|
||||||
|
___
|
||||||
|
),
|
||||||
|
[2] = KEYMAP_STACKED
|
||||||
|
(
|
||||||
|
Key_C, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___,
|
||||||
|
___,
|
||||||
|
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___,
|
||||||
|
___
|
||||||
|
),
|
||||||
|
)
|
||||||
|
// *INDENT-ON*
|
||||||
|
|
||||||
|
//KALEIDOSCOPE_INIT_PLUGINS();
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Kaleidoscope.setup();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
Kaleidoscope.loop();
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"cpu": {
|
||||||
|
"fqbn": "keyboardio:virtual:model01",
|
||||||
|
"port": ""
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,165 @@
|
|||||||
|
VERSION 1
|
||||||
|
|
||||||
|
KEYSWITCH A 0 0
|
||||||
|
KEYSWITCH X 0 1
|
||||||
|
|
||||||
|
KEYSWITCH LAYER_SHIFT_0 1 0
|
||||||
|
KEYSWITCH LAYER_SHIFT_1 1 1
|
||||||
|
KEYSWITCH LAYER_SHIFT_2 1 2
|
||||||
|
|
||||||
|
KEYSWITCH LAYER_LOCK_0 2 0
|
||||||
|
KEYSWITCH LAYER_LOCK_1 2 1
|
||||||
|
KEYSWITCH LAYER_LOCK_2 2 2
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
# Previously, if only layer 0 was active, and the user pressed and then released
|
||||||
|
# `ShiftToLayer(0)`, the layer count would go to zero. This test would still
|
||||||
|
# pass, however, because Kaleidoscope falls back on layer 0 values anyway.
|
||||||
|
NAME Base layer stays active
|
||||||
|
|
||||||
|
RUN 5 cycles
|
||||||
|
|
||||||
|
PRESS A
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report Key_A # Report should contain only `A`
|
||||||
|
RUN 5 ms
|
||||||
|
|
||||||
|
RELEASE A
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report empty # Report should be empty
|
||||||
|
RUN 5 ms
|
||||||
|
|
||||||
|
PRESS LAYER_SHIFT_0
|
||||||
|
RUN 5 ms
|
||||||
|
RELEASE LAYER_SHIFT_0
|
||||||
|
RUN 5 ms
|
||||||
|
|
||||||
|
PRESS A
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report Key_A # Report should contain only `A`
|
||||||
|
RUN 5 ms
|
||||||
|
|
||||||
|
RELEASE A
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report empty # Report should be empty
|
||||||
|
RUN 5 ms
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
NAME Lock layer 1
|
||||||
|
|
||||||
|
# Activate Layer 1
|
||||||
|
PRESS LAYER_LOCK_1
|
||||||
|
RUN 5 ms
|
||||||
|
RELEASE LAYER_LOCK_1
|
||||||
|
RUN 5 ms
|
||||||
|
|
||||||
|
PRESS A
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report Key_B # Report should contain only `B`
|
||||||
|
RUN 5 ms
|
||||||
|
|
||||||
|
RELEASE A
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report empty # Report should be empty
|
||||||
|
RUN 5 ms
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
NAME Stack layer 0 on top of layer 1
|
||||||
|
|
||||||
|
# Deactivate Layer 0: Now the layer stack should contain only layer 1.
|
||||||
|
PRESS LAYER_LOCK_0
|
||||||
|
RUN 5 ms
|
||||||
|
RELEASE LAYER_LOCK_0
|
||||||
|
RUN 5 ms
|
||||||
|
|
||||||
|
PRESS A
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report Key_B # Report should contain only `B`
|
||||||
|
RUN 5 ms
|
||||||
|
|
||||||
|
RELEASE A
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report empty # Report should be empty
|
||||||
|
RUN 5 ms
|
||||||
|
|
||||||
|
# Activate Layer 0: There should now be two layers in the stack, with layer 0 on
|
||||||
|
# top of layer 1.
|
||||||
|
PRESS LAYER_LOCK_0
|
||||||
|
RUN 5 ms
|
||||||
|
RELEASE LAYER_LOCK_0
|
||||||
|
RUN 5 ms
|
||||||
|
|
||||||
|
PRESS A
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report Key_A # Report should contain only `A`
|
||||||
|
RUN 5 ms
|
||||||
|
|
||||||
|
RELEASE A
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report empty # Report should be empty
|
||||||
|
RUN 5 ms
|
||||||
|
|
||||||
|
# Deactivate Layer 0: Back to just layer 1 active.
|
||||||
|
PRESS LAYER_LOCK_0
|
||||||
|
RUN 5 ms
|
||||||
|
RELEASE LAYER_LOCK_0
|
||||||
|
RUN 5 ms
|
||||||
|
|
||||||
|
PRESS A
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report Key_B # Report should contain only `B`
|
||||||
|
RUN 5 ms
|
||||||
|
|
||||||
|
RELEASE A
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report empty # Report should be empty
|
||||||
|
RUN 5 ms
|
||||||
|
|
||||||
|
# Hold Layer 0: Now the same test, but with a layer shift instead of a layer
|
||||||
|
# lock. The stack should now have layer 0 on top of layer 1.
|
||||||
|
PRESS LAYER_SHIFT_0
|
||||||
|
RUN 5 ms
|
||||||
|
|
||||||
|
PRESS A
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report Key_A # Report should contain only `A`
|
||||||
|
RUN 5 ms
|
||||||
|
|
||||||
|
RELEASE A
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report empty # Report should be empty
|
||||||
|
RUN 5 ms
|
||||||
|
|
||||||
|
# Release Layer 0 shift: Back to just layer 1 active.
|
||||||
|
RELEASE LAYER_SHIFT_0
|
||||||
|
RUN 5 ms
|
||||||
|
|
||||||
|
PRESS A
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report Key_B # Report should contain only `B`
|
||||||
|
RUN 5 ms
|
||||||
|
|
||||||
|
RELEASE A
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report empty # Report should be empty
|
||||||
|
RUN 5 ms
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
NAME Default to layer 0
|
||||||
|
|
||||||
|
# Unlock layer 1: This was the only active layer; layer 0 should activate
|
||||||
|
# automatically in response.
|
||||||
|
PRESS LAYER_LOCK_1
|
||||||
|
RUN 5 ms
|
||||||
|
RELEASE LAYER_LOCK_1
|
||||||
|
RUN 5 ms
|
||||||
|
|
||||||
|
PRESS A
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report Key_A # Report should contain only `A`
|
||||||
|
RUN 5 ms
|
||||||
|
|
||||||
|
RELEASE A
|
||||||
|
RUN 1 cycle
|
||||||
|
EXPECT keyboard-report empty # Report should be empty
|
||||||
|
RUN 5 ms
|
Loading…
Reference in new issue