diff options
Diffstat (limited to 'src/TapDance.cpp')
-rw-r--r-- | src/TapDance.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
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 <guilhem@fripost.org> + * + * 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 <http://www.gnu.org/licenses/>. + **********************************************************************/ + +#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); + } +} |