Skip to content

Commit

Permalink
Rip out old macro and action_function system (#16025)
Browse files Browse the repository at this point in the history
* Rip out old macro and action_function system

* Update quantum/action_util.c

Co-authored-by: Joel Challis <[email protected]>
  • Loading branch information
fauxpark and zvecr authored Jan 24, 2022
1 parent 3340ca4 commit 1d11ae3
Show file tree
Hide file tree
Showing 21 changed files with 8 additions and 538 deletions.
1 change: 0 additions & 1 deletion common_features.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ QUANTUM_SRC += \
$(QUANTUM_DIR)/led.c \
$(QUANTUM_DIR)/action.c \
$(QUANTUM_DIR)/action_layer.c \
$(QUANTUM_DIR)/action_macro.c \
$(QUANTUM_DIR)/action_tapping.c \
$(QUANTUM_DIR)/action_util.c \
$(QUANTUM_DIR)/eeconfig.c \
Expand Down
4 changes: 0 additions & 4 deletions data/templates/avr/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT

/* disable these deprecated features by default */
#define NO_ACTION_MACRO
#define NO_ACTION_FUNCTION

/* Bootmagic Lite key configuration */
//#define BOOTMAGIC_LITE_ROW 0
//#define BOOTMAGIC_LITE_COLUMN 0
4 changes: 0 additions & 4 deletions data/templates/ps2avrgb/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,6 @@
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT

/* disable these deprecated features by default */
#define NO_ACTION_MACRO
#define NO_ACTION_FUNCTION

/* Bootmagic Lite key configuration */
//#define BOOTMAGIC_LITE_ROW 0
//#define BOOTMAGIC_LITE_COLUMN 0
5 changes: 0 additions & 5 deletions docs/config_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,6 @@ If you define these options you will disable the associated feature, which can s
* disable tap dance and other tapping features
* `#define NO_ACTION_ONESHOT`
* disable one-shot modifiers
* `#define NO_ACTION_MACRO`
* disable old-style macro handling using `MACRO()`, `action_get_macro()` _(deprecated)_
* `#define NO_ACTION_FUNCTION`
* disable old-style function handling using `fn_actions`, `action_function()` _(deprecated)_

## Features That Can Be Enabled

Expand Down Expand Up @@ -383,7 +379,6 @@ This is a [make](https://www.gnu.org/software/make/manual/make.html) file that i
* A list of [layouts](feature_layouts.md) this keyboard supports.
* `LTO_ENABLE`
* Enables Link Time Optimization (LTO) when compiling the keyboard. This makes the process take longer, but it can significantly reduce the compiled size (and since the firmware is small, the added time is not noticeable).
However, this will automatically disable the legacy TMK Macros and Functions features, as these break when LTO is enabled. It does this by automatically defining `NO_ACTION_MACRO` and `NO_ACTION_FUNCTION`. (Note: This does not affect QMK [Macros](feature_macros.md) and [Layers](feature_layers.md).)
## AVR MCU Options
* `MCU = atmega32u4`
Expand Down
3 changes: 0 additions & 3 deletions docs/feature_haptic_feedback.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,6 @@ With the entry of `#define NO_HAPTIC_MOD` in config.h, the following keys will n
* `TT()` layer tap toggle keys, when held to activate a layer. However when tapped `TAPPING_TOGGLE` times to permanently toggle the layer, on the last tap haptic feedback is still triggered.
* `MT()` mod tap keys, when held to keep a usual modifier key pressed. However when tapped, and the key is quickly released, and sends a keycode, haptic feedback is still triggered. See also [Mod-Tap](mod_tap.md).

### NO_HAPTIC_FN
With the entry of `#define NO_HAPTIC_FN` in config.h, deprecated `fn_actions` type function keys will not trigger a feedback.

### NO_HAPTIC_ALPHA
With the entry of `#define NO_HAPTIC_ALPHA` in config.h, none of the alpha keys (A ... Z) will trigger a feedback.

Expand Down
2 changes: 1 addition & 1 deletion docs/keymap.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ After this you'll find a list of LAYOUT() macros. A LAYOUT() is simply a list of

`keymaps[][MATRIX_ROWS][MATRIX_COLS]` in QMK holds the 16 bit action code (sometimes referred as the quantum keycode) in it. For the keycode representing typical keys, its high byte is 0 and its low byte is the USB HID usage ID for keyboard.

> TMK from which QMK was forked uses `const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS]` instead and holds the 8 bit keycode. Some keycode values are reserved to induce execution of certain action codes via the `fn_actions[]` array.
> TMK from which QMK was forked uses `const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS]` instead and holds the 8 bit keycode.
#### Base Layer

Expand Down
4 changes: 2 additions & 2 deletions keyboards/deltasplit75/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET,
KC_BSLS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, KC_VOLU, KC_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
M(1), KC_LEFT, KC_DOWN, KC_RGHT, KC_PAUS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, KC_VOLD, M(0), KC_PSCR, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, KC_LEFT, KC_DOWN, KC_RGHT, KC_PAUS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, KC_VOLD, _______, KC_PSCR, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),

Expand Down
2 changes: 1 addition & 1 deletion keyboards/mechmini/v2/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[1] = LAYOUT_ortho(
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LBRC, KC_RBRC, KC_MINS, KC_EQL, KC_BSLS, KC_DEL,
KC_TRNS, KC_TRNS, KC_TRNS, M(1), M(1), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_END, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_END, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY),

[2] = LAYOUT_ortho(
Expand Down
26 changes: 1 addition & 25 deletions quantum/action.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "led.h"
#include "action_layer.h"
#include "action_tapping.h"
#include "action_macro.h"
#include "action_util.h"
#include "action.h"
#include "wait.h"
Expand Down Expand Up @@ -634,12 +633,7 @@ void process_action(keyrecord_t *record, action_t action) {
break;
# endif
#endif
/* Extentions */
#ifndef NO_ACTION_MACRO
case ACT_MACRO:
action_macro_play(action_get_macro(record, action.func.id, action.func.opt));
break;
#endif

#ifdef SWAP_HANDS_ENABLE
case ACT_SWAP_HANDS:
switch (action.swap.code) {
Expand Down Expand Up @@ -712,11 +706,6 @@ void process_action(keyrecord_t *record, action_t action) {
}
# endif
}
#endif
#ifndef NO_ACTION_FUNCTION
case ACT_FUNCTION:
action_function(record, action.func.id, action.func.opt);
break;
#endif
default:
break;
Expand Down Expand Up @@ -1041,7 +1030,6 @@ void clear_keyboard_but_mods_and_keys() {
host_consumer_send(0);
#endif
clear_weak_mods();
clear_macro_mods();
send_keyboard_report();
#ifdef MOUSEKEY_ENABLE
mousekey_clear();
Expand Down Expand Up @@ -1104,12 +1092,6 @@ bool is_tap_action(action_t action) {
return true;
}
return false;
case ACT_MACRO:
case ACT_FUNCTION:
if (action.func.opt & FUNC_TAP) {
return true;
}
return false;
}
return false;
}
Expand Down Expand Up @@ -1166,12 +1148,6 @@ void debug_action(action_t action) {
case ACT_LAYER_TAP_EXT:
dprint("ACT_LAYER_TAP_EXT");
break;
case ACT_MACRO:
dprint("ACT_MACRO");
break;
case ACT_FUNCTION:
dprint("ACT_FUNCTION");
break;
case ACT_SWAP_HANDS:
dprint("ACT_SWAP_HANDS");
break;
Expand Down
17 changes: 0 additions & 17 deletions quantum/action.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "keyboard.h"
#include "keycode.h"
#include "action_code.h"
#include "action_macro.h"

#ifdef __cplusplus
extern "C" {
#endif

/* Disable macro and function features when LTO is enabled, since they break */
#ifdef LTO_ENABLE
# ifndef NO_ACTION_MACRO
# define NO_ACTION_MACRO
# endif
# ifndef NO_ACTION_FUNCTION
# define NO_ACTION_FUNCTION
# endif
#endif

#ifndef TAP_CODE_DELAY
# define TAP_CODE_DELAY 0
#endif
Expand Down Expand Up @@ -72,12 +61,6 @@ void action_exec(keyevent_t event);
action_t action_for_key(uint8_t layer, keypos_t key);
action_t action_for_keycode(uint16_t keycode);

/* macro */
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt);

/* user defined special function */
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt);

/* keyboard-specific key event (pre)processing */
bool process_record_quantum(keyrecord_t *record);

Expand Down
32 changes: 0 additions & 32 deletions quantum/action_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* 101E|LLLL|1111 0100 One Shot Layer (0xF4) [TAP]
* 101E|LLLL|1111 xxxx Reserved (0xF5-FF)
* ELLLL: layer 0-31(E: extra bit for layer 16-31)
*
* Extensions(11xx)
* ----------------
* ACT_MACRO(1100):
* 1100|opt | id(8) Macro play?
* 1100|1111| id(8) Macro record?
*
* 1101|xxxx xxxx xxxx (reserved)
* 1110|xxxx xxxx xxxx (reserved)
*
* ACT_FUNCTION(1111):
* 1111| address(12) Function?
* 1111|opt | id(8) Function?
*/
enum action_kind_id {
/* Key Actions */
Expand All @@ -111,9 +98,6 @@ enum action_kind_id {
ACT_LAYER_MODS = 0b1001,
ACT_LAYER_TAP = 0b1010, /* Layer 0-15 */
ACT_LAYER_TAP_EXT = 0b1011, /* Layer 16-31 */
/* Extensions */
ACT_MACRO = 0b1100,
ACT_FUNCTION = 0b1111
};

/** \brief Action Code Struct
Expand Down Expand Up @@ -164,11 +148,6 @@ typedef union {
uint8_t page : 2;
uint8_t kind : 4;
} usage;
struct action_function {
uint8_t id : 8;
uint8_t opt : 4;
uint8_t kind : 4;
} func;
struct action_swap {
uint8_t code : 8;
uint8_t opt : 4;
Expand Down Expand Up @@ -275,17 +254,6 @@ enum layer_param_tap_op {
#define ACTION_DEFAULT_LAYER_BIT_XOR(part, bits) ACTION_LAYER_BITOP(OP_BIT_XOR, (part), (bits), 0)
#define ACTION_DEFAULT_LAYER_BIT_SET(part, bits) ACTION_LAYER_BITOP(OP_BIT_SET, (part), (bits), 0)

/* Macro */
#define ACTION_MACRO(id) ACTION(ACT_MACRO, (id))
#define ACTION_MACRO_TAP(id) ACTION(ACT_MACRO, FUNC_TAP << 8 | (id))
#define ACTION_MACRO_OPT(id, opt) ACTION(ACT_MACRO, (opt) << 8 | (id))
/* Function */
enum function_opts {
FUNC_TAP = 0x8, /* indciates function is tappable */
};
#define ACTION_FUNCTION(id) ACTION(ACT_FUNCTION, (id))
#define ACTION_FUNCTION_TAP(id) ACTION(ACT_FUNCTION, FUNC_TAP << 8 | (id))
#define ACTION_FUNCTION_OPT(id, opt) ACTION(ACT_FUNCTION, (opt) << 8 | (id))
/* OneHand Support */
enum swap_hands_param_tap_op {
OP_SH_TOGGLE = 0xF0,
Expand Down
93 changes: 0 additions & 93 deletions quantum/action_macro.c

This file was deleted.

Loading

0 comments on commit 1d11ae3

Please sign in to comment.