summaryrefslogtreecommitdiff
path: root/quantum/keymap_common.c
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2022-01-25 08:22:20 +1100
committerGitHub <noreply@github.com>2022-01-24 21:22:20 +0000
commit1d11ae3087f583c4f4756169802b33adea71ed94 (patch)
tree6a9deedeecec0220c2dccd10e90941956c4d27b7 /quantum/keymap_common.c
parent3340ca46e82c8b348d9131de53b73e83d1f2c285 (diff)
Rip out old macro and action_function system (#16025)
* Rip out old macro and action_function system * Update quantum/action_util.c Co-authored-by: Joel Challis <git@zvecr.com>
Diffstat (limited to 'quantum/keymap_common.c')
-rw-r--r--quantum/keymap_common.c41
1 files changed, 0 insertions, 41 deletions
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c
index 5007f15f11..cd67f71a8f 100644
--- a/quantum/keymap_common.c
+++ b/quantum/keymap_common.c
@@ -20,7 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
20#include "keycode.h" 20#include "keycode.h"
21#include "action_layer.h" 21#include "action_layer.h"
22#include "action.h" 22#include "action.h"
23#include "action_macro.h"
24#include "debug.h" 23#include "debug.h"
25#include "quantum.h" 24#include "quantum.h"
26 25
@@ -80,24 +79,6 @@ action_t action_for_keycode(uint16_t keycode) {
80 // Split it up 79 // Split it up
81 action.code = ACTION_MODS_KEY(keycode >> 8, keycode & 0xFF); // adds modifier to key 80 action.code = ACTION_MODS_KEY(keycode >> 8, keycode & 0xFF); // adds modifier to key
82 break; 81 break;
83#ifndef NO_ACTION_FUNCTION
84 case KC_FN0 ... KC_FN31:
85 action.code = keymap_function_id_to_action(FN_INDEX(keycode));
86 break;
87 case QK_FUNCTION ... QK_FUNCTION_MAX:;
88 // Is a shortcut for function action_layer, pull last 12bits
89 // This means we have 4,096 FN macros at our disposal
90 action.code = keymap_function_id_to_action((int)keycode & 0xFFF);
91 break;
92#endif
93#ifndef NO_ACTION_MACRO
94 case QK_MACRO ... QK_MACRO_MAX:
95 if (keycode & 0x800) // tap macros have upper bit set
96 action.code = ACTION_MACRO_TAP(keycode & 0xFF);
97 else
98 action.code = ACTION_MACRO(keycode & 0xFF);
99 break;
100#endif
101#ifndef NO_ACTION_LAYER 82#ifndef NO_ACTION_LAYER
102 case QK_LAYER_TAP ... QK_LAYER_TAP_MAX: 83 case QK_LAYER_TAP ... QK_LAYER_TAP_MAX:
103 action.code = ACTION_LAYER_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF); 84 action.code = ACTION_LAYER_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF);
@@ -165,30 +146,8 @@ action_t action_for_keycode(uint16_t keycode) {
165 return action; 146 return action;
166} 147}
167 148
168__attribute__((weak)) const uint16_t PROGMEM fn_actions[] = {
169
170};
171
172/* Macro */
173__attribute__((weak)) const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { return MACRO_NONE; }
174
175/* Function */
176__attribute__((weak)) void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {}
177
178// translates key to keycode 149// translates key to keycode
179__attribute__((weak)) uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) { 150__attribute__((weak)) uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) {
180 // Read entire word (16bits) 151 // Read entire word (16bits)
181 return pgm_read_word(&keymaps[(layer)][(key.row)][(key.col)]); 152 return pgm_read_word(&keymaps[(layer)][(key.row)][(key.col)]);
182} 153}
183
184// translates function id to action
185__attribute__((weak)) uint16_t keymap_function_id_to_action(uint16_t function_id) {
186// The compiler sees the empty (weak) fn_actions and generates a warning
187// This function should not be called in that case, so the warning is too strict
188// If this function is called however, the keymap should have overridden fn_actions, and then the compile
189// is comparing against the wrong array
190#pragma GCC diagnostic push
191#pragma GCC diagnostic ignored "-Warray-bounds"
192 return pgm_read_word(&fn_actions[function_id]);
193#pragma GCC diagnostic pop
194}