diff options
author | Joel Challis <git@zvecr.com> | 2021-08-18 00:18:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-18 00:18:58 +0100 |
commit | b8e913c8db73ebf890e4604ee41991a34354a600 (patch) | |
tree | 258035f8fda9f83f08a309f6cd608b9c61476678 /tmk_core/common/action.h | |
parent | 96e2b13d1de227cdc2b918fb0292bd832d346a25 (diff) | |
download | qmk_firmware-b8e913c8db73ebf890e4604ee41991a34354a600.tar.gz qmk_firmware-b8e913c8db73ebf890e4604ee41991a34354a600.zip |
Migrate platform independent code from tmk_core -> quantum (#13673)
* Migrate action|keyboard|keycode|eeconfig from tmk_core -> quantum
Diffstat (limited to 'tmk_core/common/action.h')
-rw-r--r-- | tmk_core/common/action.h | 132 |
1 files changed, 0 insertions, 132 deletions
diff --git a/tmk_core/common/action.h b/tmk_core/common/action.h deleted file mode 100644 index 3d357b33b..000000000 --- a/tmk_core/common/action.h +++ /dev/null | |||
@@ -1,132 +0,0 @@ | |||
1 | /* | ||
2 | Copyright 2012,2013 Jun Wako <wakojun@gmail.com> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #pragma once | ||
19 | |||
20 | #include <stdint.h> | ||
21 | #include <stdbool.h> | ||
22 | #include "keyboard.h" | ||
23 | #include "keycode.h" | ||
24 | #include "action_code.h" | ||
25 | #include "action_macro.h" | ||
26 | |||
27 | #ifdef __cplusplus | ||
28 | extern "C" { | ||
29 | #endif | ||
30 | |||
31 | /* Disable macro and function features when LTO is enabled, since they break */ | ||
32 | #ifdef LTO_ENABLE | ||
33 | # ifndef NO_ACTION_MACRO | ||
34 | # define NO_ACTION_MACRO | ||
35 | # endif | ||
36 | # ifndef NO_ACTION_FUNCTION | ||
37 | # define NO_ACTION_FUNCTION | ||
38 | # endif | ||
39 | #endif | ||
40 | |||
41 | /* tapping count and state */ | ||
42 | typedef struct { | ||
43 | bool interrupted : 1; | ||
44 | bool reserved2 : 1; | ||
45 | bool reserved1 : 1; | ||
46 | bool reserved0 : 1; | ||
47 | uint8_t count : 4; | ||
48 | } tap_t; | ||
49 | |||
50 | /* Key event container for recording */ | ||
51 | typedef struct { | ||
52 | keyevent_t event; | ||
53 | #ifndef NO_ACTION_TAPPING | ||
54 | tap_t tap; | ||
55 | #endif | ||
56 | #ifdef COMBO_ENABLE | ||
57 | uint16_t keycode; | ||
58 | #endif | ||
59 | } keyrecord_t; | ||
60 | |||
61 | /* Execute action per keyevent */ | ||
62 | void action_exec(keyevent_t event); | ||
63 | |||
64 | /* action for key */ | ||
65 | action_t action_for_key(uint8_t layer, keypos_t key); | ||
66 | action_t action_for_keycode(uint16_t keycode); | ||
67 | |||
68 | /* macro */ | ||
69 | const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt); | ||
70 | |||
71 | /* user defined special function */ | ||
72 | void action_function(keyrecord_t *record, uint8_t id, uint8_t opt); | ||
73 | |||
74 | /* keyboard-specific key event (pre)processing */ | ||
75 | bool process_record_quantum(keyrecord_t *record); | ||
76 | |||
77 | /* Utilities for actions. */ | ||
78 | #if !defined(NO_ACTION_LAYER) && !defined(STRICT_LAYER_RELEASE) | ||
79 | extern bool disable_action_cache; | ||
80 | #endif | ||
81 | |||
82 | /* Code for handling one-handed key modifiers. */ | ||
83 | #ifdef SWAP_HANDS_ENABLE | ||
84 | extern bool swap_hands; | ||
85 | extern const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS]; | ||
86 | # if (MATRIX_COLS <= 8) | ||
87 | typedef uint8_t swap_state_row_t; | ||
88 | # elif (MATRIX_COLS <= 16) | ||
89 | typedef uint16_t swap_state_row_t; | ||
90 | # elif (MATRIX_COLS <= 32) | ||
91 | typedef uint32_t swap_state_row_t; | ||
92 | # else | ||
93 | # error "MATRIX_COLS: invalid value" | ||
94 | # endif | ||
95 | |||
96 | void process_hand_swap(keyevent_t *record); | ||
97 | #endif | ||
98 | |||
99 | void process_record_nocache(keyrecord_t *record); | ||
100 | void process_record(keyrecord_t *record); | ||
101 | void process_record_handler(keyrecord_t *record); | ||
102 | void post_process_record_quantum(keyrecord_t *record); | ||
103 | void process_action(keyrecord_t *record, action_t action); | ||
104 | void register_code(uint8_t code); | ||
105 | void unregister_code(uint8_t code); | ||
106 | void tap_code(uint8_t code); | ||
107 | void tap_code_delay(uint8_t code, uint16_t delay); | ||
108 | void register_mods(uint8_t mods); | ||
109 | void unregister_mods(uint8_t mods); | ||
110 | void register_weak_mods(uint8_t mods); | ||
111 | void unregister_weak_mods(uint8_t mods); | ||
112 | // void set_mods(uint8_t mods); | ||
113 | void clear_keyboard(void); | ||
114 | void clear_keyboard_but_mods(void); | ||
115 | void clear_keyboard_but_mods_and_keys(void); | ||
116 | void layer_switch(uint8_t new_layer); | ||
117 | bool is_tap_key(keypos_t key); | ||
118 | bool is_tap_record(keyrecord_t *record); | ||
119 | bool is_tap_action(action_t action); | ||
120 | |||
121 | #ifndef NO_ACTION_TAPPING | ||
122 | void process_record_tap_hint(keyrecord_t *record); | ||
123 | #endif | ||
124 | |||
125 | /* debug */ | ||
126 | void debug_event(keyevent_t event); | ||
127 | void debug_record(keyrecord_t record); | ||
128 | void debug_action(action_t action); | ||
129 | |||
130 | #ifdef __cplusplus | ||
131 | } | ||
132 | #endif | ||