aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/common/action.h
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2021-08-18 00:18:58 +0100
committerGitHub <noreply@github.com>2021-08-18 00:18:58 +0100
commitb8e913c8db73ebf890e4604ee41991a34354a600 (patch)
tree258035f8fda9f83f08a309f6cd608b9c61476678 /tmk_core/common/action.h
parent96e2b13d1de227cdc2b918fb0292bd832d346a25 (diff)
downloadqmk_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.h132
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/*
2Copyright 2012,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#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
28extern "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 */
42typedef 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 */
51typedef 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 */
62void action_exec(keyevent_t event);
63
64/* action for key */
65action_t action_for_key(uint8_t layer, keypos_t key);
66action_t action_for_keycode(uint16_t keycode);
67
68/* macro */
69const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt);
70
71/* user defined special function */
72void action_function(keyrecord_t *record, uint8_t id, uint8_t opt);
73
74/* keyboard-specific key event (pre)processing */
75bool process_record_quantum(keyrecord_t *record);
76
77/* Utilities for actions. */
78#if !defined(NO_ACTION_LAYER) && !defined(STRICT_LAYER_RELEASE)
79extern bool disable_action_cache;
80#endif
81
82/* Code for handling one-handed key modifiers. */
83#ifdef SWAP_HANDS_ENABLE
84extern bool swap_hands;
85extern const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS];
86# if (MATRIX_COLS <= 8)
87typedef uint8_t swap_state_row_t;
88# elif (MATRIX_COLS <= 16)
89typedef uint16_t swap_state_row_t;
90# elif (MATRIX_COLS <= 32)
91typedef uint32_t swap_state_row_t;
92# else
93# error "MATRIX_COLS: invalid value"
94# endif
95
96void process_hand_swap(keyevent_t *record);
97#endif
98
99void process_record_nocache(keyrecord_t *record);
100void process_record(keyrecord_t *record);
101void process_record_handler(keyrecord_t *record);
102void post_process_record_quantum(keyrecord_t *record);
103void process_action(keyrecord_t *record, action_t action);
104void register_code(uint8_t code);
105void unregister_code(uint8_t code);
106void tap_code(uint8_t code);
107void tap_code_delay(uint8_t code, uint16_t delay);
108void register_mods(uint8_t mods);
109void unregister_mods(uint8_t mods);
110void register_weak_mods(uint8_t mods);
111void unregister_weak_mods(uint8_t mods);
112// void set_mods(uint8_t mods);
113void clear_keyboard(void);
114void clear_keyboard_but_mods(void);
115void clear_keyboard_but_mods_and_keys(void);
116void layer_switch(uint8_t new_layer);
117bool is_tap_key(keypos_t key);
118bool is_tap_record(keyrecord_t *record);
119bool is_tap_action(action_t action);
120
121#ifndef NO_ACTION_TAPPING
122void process_record_tap_hint(keyrecord_t *record);
123#endif
124
125/* debug */
126void debug_event(keyevent_t event);
127void debug_record(keyrecord_t record);
128void debug_action(action_t action);
129
130#ifdef __cplusplus
131}
132#endif