diff --git a/tests/plugins/Qukeys/TapRepeat/TapRepeat.ino b/tests/plugins/Qukeys/TapRepeat/TapRepeat.ino new file mode 100644 index 00000000..45d6f239 --- /dev/null +++ b/tests/plugins/Qukeys/TapRepeat/TapRepeat.ino @@ -0,0 +1,62 @@ +/* -*- 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 . + */ + +#include +#include + +#include "./common.h" + +// *INDENT-OFF* +KEYMAPS( + [0] = KEYMAP_STACKED + ( + Key_A, Key_LeftAlt, ___, ___, ___, ___, ___, + SFT_T(J), ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, + ___, + + ___, ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, + ___ + ), +) +// *INDENT-ON* + +// Use Qukeys +KALEIDOSCOPE_INIT_PLUGINS(Qukeys); + +void setup() { + QUKEYS( + kaleidoscope::plugin::Qukey(0, KeyAddr(0, 0), Key_LeftGui), + kaleidoscope::plugin::Qukey(0, KeyAddr(0, 1), Key_B) + ) + Qukeys.setHoldTimeout(kaleidoscope::testing::QUKEYS_HOLD_TIMEOUT); + Qukeys.setOverlapThreshold(kaleidoscope::testing::QUKEYS_OVERLAP_THRESHOLD); + Qukeys.setMinimumHoldTime(kaleidoscope::testing::QUKEYS_MINIMUM_HOLD_TIME); + Qukeys.setMinimumPriorInterval(kaleidoscope::testing::QUKEYS_MIN_PRIOR_INTERVAL); + Qukeys.setMaxIntervalForTapRepeat(kaleidoscope::testing::QUKEYS_MAX_TAP_REPEAT_INTERVAL); + + Kaleidoscope.setup(); +} + +void loop() { + Kaleidoscope.loop(); +} diff --git a/tests/plugins/Qukeys/TapRepeat/common.h b/tests/plugins/Qukeys/TapRepeat/common.h new file mode 100644 index 00000000..922d2ca2 --- /dev/null +++ b/tests/plugins/Qukeys/TapRepeat/common.h @@ -0,0 +1,33 @@ +// -*- 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 . + */ + +#pragma once + +#include + +namespace kaleidoscope { +namespace testing { + +constexpr uint16_t QUKEYS_HOLD_TIMEOUT = 200; +constexpr uint8_t QUKEYS_OVERLAP_THRESHOLD = 0; +constexpr uint8_t QUKEYS_MINIMUM_HOLD_TIME = 0; +constexpr uint8_t QUKEYS_MIN_PRIOR_INTERVAL = 0; +constexpr uint8_t QUKEYS_MAX_TAP_REPEAT_INTERVAL = 20; + +} +} diff --git a/tests/plugins/Qukeys/TapRepeat/sketch.json b/tests/plugins/Qukeys/TapRepeat/sketch.json new file mode 100644 index 00000000..43dc4c7e --- /dev/null +++ b/tests/plugins/Qukeys/TapRepeat/sketch.json @@ -0,0 +1,6 @@ +{ + "cpu": { + "fqbn": "keyboardio:virtual:model01", + "port": "" + } +} \ No newline at end of file diff --git a/tests/plugins/Qukeys/TapRepeat/test.ktest b/tests/plugins/Qukeys/TapRepeat/test.ktest new file mode 100644 index 00000000..0cb8af66 --- /dev/null +++ b/tests/plugins/Qukeys/TapRepeat/test.ktest @@ -0,0 +1,134 @@ +VERSION 1 + +KEYSWITCH A 0 0 +KEYSWITCH B 0 1 +KEYSWITCH J 1 0 + +# ============================================================================== +# Qukey tap-repeat test +NAME TapRepeat Generic Qukey + +RUN 10 ms + +PRESS A +RUN 5 ms + +RELEASE A +RUN 1 cycle +EXPECT keyboard-report Key_A # Report should contain only A +RUN 5 ms + +PRESS A +RUN 5 ms + +RELEASE A +RUN 2 cycles +EXPECT keyboard-report empty # Report should be empty +EXPECT keyboard-report Key_A # Report should contain only A + +RUN 16 ms +EXPECT keyboard-report empty # Report should be empty + +RUN 100 ms + +PRESS A +RUN 5 ms + +RELEASE A +RUN 1 cycle +EXPECT keyboard-report Key_A # Report should contain only A +RUN 5 ms + +PRESS A +RUN 50 ms + +RELEASE A +# I'm not sure why this takes 2 cycles instead of just one +RUN 2 cycles +EXPECT keyboard-report empty # Report should be empty + +# ============================================================================== +# DualUse Qukey tap-repeat test +NAME TapRepeat DualUse Qukey + +RUN 10 ms + +PRESS J +RUN 5 ms + +RELEASE J +RUN 1 cycle +EXPECT keyboard-report Key_J # Report should contain only J +RUN 5 ms + +PRESS J +RUN 5 ms + +RELEASE J +RUN 2 cycles +EXPECT keyboard-report empty # Report should be empty +EXPECT keyboard-report Key_J # Report should contain only J + +RUN 16 ms +EXPECT keyboard-report empty # Report should be empty + +RUN 100 ms + +PRESS J +RUN 5 ms + +RELEASE J +RUN 1 cycle +EXPECT keyboard-report Key_J # Report should contain only J +RUN 5 ms + +PRESS J +RUN 50 ms + +RELEASE J +# I'm not sure why this takes 2 cycles instead of just one +RUN 2 cycles +EXPECT keyboard-report empty # Report should be empty + +# ============================================================================== +# SpaceCadet Qukey tap-repeat test +NAME TapRepeat SpaceCadet Qukey + +RUN 10 ms + +PRESS B +RUN 5 ms + +RELEASE B +RUN 1 cycle +EXPECT keyboard-report Key_B # Report should contain only B +RUN 5 ms + +PRESS B +RUN 5 ms + +RELEASE B +RUN 2 cycles +EXPECT keyboard-report empty # Report should be empty +EXPECT keyboard-report Key_B # Report should contain only B + +RUN 16 ms +EXPECT keyboard-report empty # Report should be empty + +RUN 100 ms + +PRESS B +RUN 5 ms + +RELEASE B +RUN 1 cycle +EXPECT keyboard-report Key_B # Report should contain only B +RUN 5 ms + +PRESS B +RUN 50 ms + +RELEASE B +# I'm not sure why this takes 2 cycles instead of just one +RUN 2 cycles +EXPECT keyboard-report empty # Report should be empty