aboutsummaryrefslogtreecommitdiffstats
path: root/src/TapDance.cpp
blob: 7af53938b544ab899db8fd65ba2eee1233a711c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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, KeyAddr keyAddr, 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);
    }
}