From 3f2c2fdaa542cf9a0a170d56d2dc1bd16144f6b8 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Tue, 25 Jun 2019 13:57:33 +0200 Subject: Initial commit. Inspired by the reference firmware https://github.com/keyboardio/Model01-Firmware and algernon's fork https://git.madhouse-project.org/algernon/Model01-Sketch --- src/TapDance.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/TapDance.cpp (limited to 'src/TapDance.cpp') diff --git a/src/TapDance.cpp b/src/TapDance.cpp new file mode 100644 index 0000000..e5f870d --- /dev/null +++ b/src/TapDance.cpp @@ -0,0 +1,40 @@ +/*********************************************************************** + * A firmware Sketch for the Keyboardio Model 01 + * Copyright © 2016, 2017, 2018 Gergely Nagy + * Copyright © 2019 Guilhem Moulin + * + * 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, either version 3 of the License, or (at + * your option) any later version. + + * 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 "TapDance.h" + +bool cancelOneShot = false; +void tapDanceAction(uint8_t tapDanceIndex, byte row, byte col, uint8_t tapCount, + kaleidoscope::plugin::TapDance::ActionType tapDanceAction) { + /* Cancel any pending on-shot effects when a tap-dance key is released */ + if (tapDanceAction == kaleidoscope::plugin::TapDance::Release) + cancelOneShot = true; + + switch (tapDanceIndex) { + case COLON: + return tapDanceActionKeys(tapCount, tapDanceAction, + LSHIFT(Key_Semicolon), Key_Semicolon); + case LPB: + return tapDanceActionKeys(tapCount, tapDanceAction, + Key_LeftBracket, Key_LeftParen); + case RPB: + return tapDanceActionKeys(tapCount, tapDanceAction, + Key_RightBracket, Key_RightParen); + } +} -- cgit v1.2.3