Parent directory

action_tapping.h

2244 bytes
 1/*
 2Copyright 2013 Jun Wako <wakojun@gmail.com>
 3
 4This program is free software: you can redistribute it and/or modify
 5it under the terms of the GNU General Public License as published by
 6the Free Software Foundation, either version 2 of the License, or
 7(at your option) any later version.
 8
 9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program.  If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#pragma once
19
20/* period of tapping(ms) */
21#ifndef TAPPING_TERM
22#    define TAPPING_TERM 200
23#endif
24
25/* period of quick tap(ms) */
26#if !defined(QUICK_TAP_TERM) || QUICK_TAP_TERM > TAPPING_TERM
27#    define QUICK_TAP_TERM TAPPING_TERM
28#endif
29
30/* tap count needed for toggling a feature */
31#ifndef TAPPING_TOGGLE
32#    define TAPPING_TOGGLE 5
33#endif
34
35#define WAITING_BUFFER_SIZE 8
36
37#ifndef NO_ACTION_TAPPING
38uint16_t get_record_keycode(keyrecord_t *record, bool update_layer_cache);
39uint16_t get_event_keycode(keyevent_t event, bool update_layer_cache);
40void     action_tapping_process(keyrecord_t record);
41#endif
42
43uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record);
44uint16_t get_quick_tap_term(uint16_t keycode, keyrecord_t *record);
45bool     get_permissive_hold(uint16_t keycode, keyrecord_t *record);
46bool     get_retro_tapping(uint16_t keycode, keyrecord_t *record);
47bool     get_hold_on_other_key_press(uint16_t keycode, keyrecord_t *record);
48
49#ifdef DYNAMIC_TAPPING_TERM_ENABLE
50extern uint16_t g_tapping_term;
51#endif
52
53#if defined(TAPPING_TERM_PER_KEY) && !defined(NO_ACTION_TAPPING)
54#    define GET_TAPPING_TERM(keycode, record) get_tapping_term(keycode, record)
55#elif defined(DYNAMIC_TAPPING_TERM_ENABLE) && !defined(NO_ACTION_TAPPING)
56#    define GET_TAPPING_TERM(keycode, record) g_tapping_term
57#else
58#    define GET_TAPPING_TERM(keycode, record) (TAPPING_TERM)
59#endif
60
61#ifdef QUICK_TAP_TERM_PER_KEY
62#    define GET_QUICK_TAP_TERM(keycode, record) get_quick_tap_term(keycode, record)
63#else
64#    define GET_QUICK_TAP_TERM(keycode, record) (QUICK_TAP_TERM)
65#endif