Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>pull/986/head
parent
56cafeb9fd
commit
40cc6a290e
@ -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,66 @@
|
|||||||
|
/* -*- 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-MagicCombo.h>
|
||||||
|
|
||||||
|
#include "./common.h"
|
||||||
|
|
||||||
|
#undef min
|
||||||
|
#undef max
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
// *INDENT-OFF*
|
||||||
|
KEYMAPS(
|
||||||
|
[0] = KEYMAP_STACKED
|
||||||
|
(
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___,
|
||||||
|
___,
|
||||||
|
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___,
|
||||||
|
___
|
||||||
|
),
|
||||||
|
)
|
||||||
|
// *INDENT-ON*
|
||||||
|
|
||||||
|
void tapKeyA(uint8_t magic_combo_index) {
|
||||||
|
std::cerr << "tapKeyA" << std::endl;
|
||||||
|
handleKeyswitchEvent(Key_A, KeyAddr{1, 0}, IS_PRESSED | INJECTED);
|
||||||
|
Kaleidoscope.hid().keyboard().sendReport();
|
||||||
|
handleKeyswitchEvent(Key_NoKey, KeyAddr{1, 0}, WAS_PRESSED | INJECTED);
|
||||||
|
Kaleidoscope.hid().keyboard().sendReport();
|
||||||
|
}
|
||||||
|
|
||||||
|
USE_MAGIC_COMBOS({.action = tapKeyA, .keys = {R0C0, R0C1, R0C2}});
|
||||||
|
|
||||||
|
KALEIDOSCOPE_INIT_PLUGINS(MagicCombo);
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Kaleidoscope.setup();
|
||||||
|
MagicCombo.min_interval = 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
Kaleidoscope.loop();
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
VERSION 1
|
||||||
|
|
||||||
|
KEYSWITCH MC0 0 0
|
||||||
|
KEYSWITCH MC1 0 1
|
||||||
|
KEYSWITCH MC2 0 2
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
NAME MagicCombo key A
|
||||||
|
|
||||||
|
RUN 5 ms
|
||||||
|
PRESS MC2
|
||||||
|
PRESS MC1
|
||||||
|
RUN 5 ms
|
||||||
|
PRESS MC0
|
||||||
|
RUN 10 ms
|
||||||
|
# With MagicCombo.min_interval set to 20(ms), we need to wait that long before
|
||||||
|
# it will trigger, plus one.
|
||||||
|
RUN 1 ms
|
||||||
|
EXPECT keyboard-report Key_A # The report should contain only `A`
|
||||||
|
EXPECT keyboard-report empty # Report should be empty
|
||||||
|
RUN 5 ms
|
||||||
|
RELEASE MC0
|
||||||
|
RUN 1 cycle
|
||||||
|
RELEASE MC2
|
||||||
|
RUN 1 cycle
|
||||||
|
RELEASE MC1
|
||||||
|
RUN 1 cycle
|
||||||
|
|
||||||
|
# Run a bit longer to make sure no extra reports were generated.
|
||||||
|
RUN 5 ms
|
Loading…
Reference in new issue