Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>pull/1024/head
parent
5d69eca65d
commit
e101121eec
@ -0,0 +1,68 @@
|
||||
/* -*- mode: c++ -*-
|
||||
* Copyright (C) 2020 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-SpaceCadet.h>
|
||||
|
||||
#include "./common.h"
|
||||
|
||||
// *INDENT-OFF*
|
||||
KEYMAPS(
|
||||
[0] = KEYMAP_STACKED
|
||||
(
|
||||
Key_LeftShift, Key_RightShift, ___, ___, ___, ___, ___,
|
||||
Key_A, Key_B, ___, ___, ___, ___, ___,
|
||||
___, ___, ___, ___, ___, ___,
|
||||
___, ___, ___, ___, ___, ___, ___,
|
||||
___, ___, ___, ___,
|
||||
___,
|
||||
|
||||
___, ___, ___, ___, ___, ___, ___,
|
||||
___, ___, ___, ___, ___, ___, ___,
|
||||
___, ___, ___, ___, ___, ___,
|
||||
___, ___, ___, ___, ___, ___, ___,
|
||||
___, ___, ___, ___,
|
||||
___
|
||||
),
|
||||
)
|
||||
// *INDENT-ON*
|
||||
|
||||
KALEIDOSCOPE_INIT_PLUGINS(SpaceCadet);
|
||||
|
||||
void setup() {
|
||||
Kaleidoscope.setup();
|
||||
|
||||
//Set the SpaceCadet map
|
||||
//Setting is {KeyThatWasPressed, AlternativeKeyToSend, TimeoutInMS}
|
||||
//Note: must end with the SPACECADET_MAP_END delimiter
|
||||
static kaleidoscope::plugin::SpaceCadet::KeyBinding spacecadetmap[] = {
|
||||
{Key_LeftShift, Key_X, 10},
|
||||
{Key_RightShift, Key_Y, 0},
|
||||
{Key_LeftGui, Key_LeftCurlyBracket, 10},
|
||||
{Key_RightAlt, Key_RightCurlyBracket, 10},
|
||||
{Key_LeftAlt, Key_RightCurlyBracket, 10},
|
||||
{Key_LeftControl, Key_LeftBracket, 10},
|
||||
{Key_RightControl, Key_RightBracket, 10},
|
||||
SPACECADET_MAP_END
|
||||
};
|
||||
//Set the map.
|
||||
SpaceCadet.map = spacecadetmap;
|
||||
SpaceCadet.time_out = 20;
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Kaleidoscope.loop();
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
// -*- mode: c++ -*-
|
||||
|
||||
/* Kaleidoscope - Firmware for computer input devices
|
||||
* Copyright (C) 2020 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/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace kaleidoscope {
|
||||
namespace testing {
|
||||
|
||||
} // namespace testing
|
||||
} // namespace kaleidoscope
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"cpu": {
|
||||
"fqbn": "keyboardio:virtual:model01",
|
||||
"port": ""
|
||||
}
|
||||
}
|
@ -0,0 +1,125 @@
|
||||
VERSION 1
|
||||
|
||||
KEYSWITCH LSHIFT 0 0
|
||||
KEYSWITCH RSHIFT 0 1
|
||||
KEYSWITCH A 1 0
|
||||
KEYSWITCH B 1 1
|
||||
|
||||
# ==============================================================================
|
||||
NAME SpaceCadet tap
|
||||
|
||||
RUN 5 ms
|
||||
|
||||
PRESS LSHIFT
|
||||
RUN 5 ms
|
||||
RELEASE LSHIFT
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report Key_X # Report should contain `X` (0x1B)
|
||||
EXPECT keyboard-report empty # Report should be empty
|
||||
RUN 5 ms
|
||||
|
||||
# ==============================================================================
|
||||
NAME SpaceCadet hold
|
||||
|
||||
RUN 5 ms
|
||||
|
||||
PRESS LSHIFT
|
||||
RUN 1 cycle
|
||||
|
||||
RUN 10 ms
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report Key_LeftShift # Report should contain `shift` (0xE1)
|
||||
|
||||
RUN 5 ms
|
||||
RELEASE LSHIFT
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report empty # Report should be empty
|
||||
|
||||
# ==============================================================================
|
||||
NAME SpaceCadet hold with global timeout
|
||||
|
||||
RUN 5 ms
|
||||
|
||||
PRESS RSHIFT
|
||||
RUN 1 cycle
|
||||
|
||||
RUN 20 ms
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report Key_RightShift # Report should contain `shift` (0xE5)
|
||||
|
||||
RUN 5 ms
|
||||
RELEASE RSHIFT
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report empty # Report should be empty
|
||||
|
||||
# ==============================================================================
|
||||
NAME SpaceCadet interrupt
|
||||
|
||||
RUN 5 ms
|
||||
PRESS LSHIFT
|
||||
RUN 1 cycle
|
||||
|
||||
RUN 3 ms
|
||||
PRESS A
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report Key_LeftShift # Report should contain `shift` (0xE1)
|
||||
EXPECT keyboard-report Key_LeftShift Key_A # Report should add `A` (0x04, 0xE1)
|
||||
|
||||
RUN 3 ms
|
||||
RELEASE LSHIFT
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report Key_A # Report should contain only `A` (0x04)
|
||||
|
||||
RUN 3 ms
|
||||
RELEASE A
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report empty # Report should be empty
|
||||
|
||||
# ==============================================================================
|
||||
NAME SpaceCadet interrupt SpaceCadet with tap
|
||||
|
||||
RUN 5 ms
|
||||
PRESS LSHIFT
|
||||
RUN 1 cycle
|
||||
|
||||
RUN 3 ms
|
||||
PRESS RSHIFT
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report Key_LeftShift # Report should contain `shift` (0xE1)
|
||||
|
||||
RUN 3 ms
|
||||
RELEASE RSHIFT
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report Key_LeftShift Key_Y # Report should add `Y` (0x1C)
|
||||
EXPECT keyboard-report Key_LeftShift # Report should contain `shift` (0xE1)
|
||||
|
||||
RUN 3 ms
|
||||
RELEASE LSHIFT
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report empty # Report should be empty
|
||||
|
||||
# ==============================================================================
|
||||
NAME SpaceCadet interrupt SpaceCadet with hold
|
||||
|
||||
RUN 5 ms
|
||||
PRESS LSHIFT
|
||||
RUN 1 cycle
|
||||
|
||||
RUN 3 ms
|
||||
PRESS RSHIFT
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report Key_LeftShift # Report should contain `shift` (0xE1)
|
||||
|
||||
RUN 20 ms
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report Key_LeftShift Key_RightShift # Report should contain both `shift` keycodes (0xE1, 0xE5)
|
||||
|
||||
RUN 5 ms
|
||||
RELEASE LSHIFT
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report Key_RightShift # Report should contain `shift` (0xE5)
|
||||
|
||||
RUN 3 ms
|
||||
RELEASE RSHIFT
|
||||
RUN 1 cycle
|
||||
EXPECT keyboard-report empty # Report should be empty
|
Loading…
Reference in new issue